Example #1
0
    def handleLightFix(self):
        target = os.path.relpath(self.rejSmali.getPath(), utils.REJECT)
        print "  "
        print "  %s %s" % (Paint.bold("FIX CONFLICTS IN"), target)
        for mEntry in self.mBSLib.getEntryList(self.getRejectEntryList()):
            (canReplaceEntry,
             canNotReplaceEntry) = self.mTSLib.getCanReplaceEntry(
                 self.mBSLib, self.rejSmali.getClassName(), [mEntry], False)
            if utils.has(canReplaceEntry, mEntry):
                print "  %s %s" % (Paint.green("[PASS]"), mEntry.getName())
                utils.SLog.ok("\n>>>> Fix reject %s %s in %s: " %
                              (mEntry.getType(), mEntry.getName(),
                               self.rejSmali.getPath()))
                self.replaceEntryToBosp(mEntry)

            for entry in canReplaceEntry:
                if entry != mEntry:
                    self.replaceEntryToBosp(entry)
            if len(canNotReplaceEntry) > 0:
                self.mCanNotReplaceEntry.extend(canNotReplaceEntry)
                if utils.has(canNotReplaceEntry, mEntry):
                    print "  %s %s" % (Paint.red("[FAIL]"), mEntry.getName())

                    utils.SLog.fail("  %s" % target)
                    #utils.SLog.fail("  CONFLICTS: %s %s in %s" % (mEntry.getType(), mEntry.getName(), self.getRealTargetPath(self.mTSLib.getSmali(mEntry.getClassName()))))
                    #utils.SLog.fail("  Can not be replaced by bosp, because of the follows:")
                for entry in canNotReplaceEntry:
                    #utils.SLog.fail("     %s %s in %s" % (entry.getType(), entry.getName(), self.getRealTargetPath(self.mTSLib.getSmali(entry.getClassName()))))
                    pass
Example #2
0
 def onChange(self, data):
     if utils.has(data, 'news'):
         if data['news']:
             self.set('news_age', self.getNewsAge(data['news'].toJSON()))
         else:
             self.set('news_age', MAX_NEWS_AGE)
     elif utils.has(data, 'next_market_open_margin'):
         self.set('next_open_up',
                  self.getOpenMarginClass(data['next_market_open_margin']))
Example #3
0
 def __init__(self, options={}):
     Model.__init__(self, options)
     params = config.get('yahoo.api.url.params')
     if utils.has(options, 'startdate') and utils.has(options, 'enddate'):
         params['period1'] = options['startdate']
         params['period2'] = options['enddate']
     if utils.has(options, 'granularity'):
         params['interval'] = options['granularity']
     if utils.has(options, 'ticker'):
         ticker = options['ticker']
     else:
         ticker = config.get('yahoo.api.url.ticker')
     self.url = config.get('yahoo.api.url.root') + ticker + '?' + urlencode(
         params)
Example #4
0
 def __populate(self, options):
     for prop in self.props():
         if _.has(options, prop):
             if _.has(self.children(), prop):
                 self.attributes[prop] = self.children()[prop](
                     options[prop])
             elif _.has(self.collections(), prop):
                 if isinstance(options[prop], list):
                     self.attributes[prop] = self.collections()[prop](
                         options[prop])
                 else:
                     self.attributes[prop] = options[prop]
             else:
                 self.attributes[prop] = options[prop]
     self.onPopulate(self.toJSON())
     return self
Example #5
0
    def __init__(self, options={}):
        Model.__init__(self, options)
        params = {}
        if utils.has(options, 'symbol'):
            params['identifier'] = options['symbol']
        else:
            params = config.get('intrinio.api.url.params')

        self.url = config.get('intrinio.api.url.root') + '?' + urlencode(
            params)
Example #6
0
 def has(self, prop):
     return _.has(self.attributes, prop)
Example #7
0
 def restrict_tag_or(self, tags):
     self.contacts = [
         contact for contact in self.contacts if has(contact.tags, tags)
     ]