Search through all contract accounts.

        :param expression:
        :param callback_func:
433617
def search(self, expression, callback_func):
        
        cnt = 0
        indexer = AccountIndexer(self)

        for contract, address_hash, balance in self.get_contracts():

            if contract.matches_expression(expression):

                try:
                    address = _encode_hex(indexer.get_contract_by_hash(address_hash))
                except AddressNotFoundError:
                    """The hash->address mapping does not exist in our index.

                    If the index is up-to-date, this likely means that
                    the contract was created by an internal transaction.
                    Skip this contract as right now we don't have a good
                    solution for this.
                    """

                    continue

                callback_func(contract, address, balance)

            cnt += 1

            if not cnt % 1000:
                log.info("Searched %d contracts" % cnt)
881892
def find_checker(func: CallableT) -> Optional[CallableT]:
    """"""
    contract_checker = None  # type: Optional[CallableT]
    for a_wrapper in _walk_decorator_stack(func):
        if hasattr(a_wrapper, "__preconditions__") or hasattr(a_wrapper, "__postconditions__"):
            contract_checker = a_wrapper

    return contract_checker
774734
def get_contracts(self):
        """"""
        for account in self.reader._get_head_state().get_all_accounts():
            if account.code is not None:
                code = _encode_hex(account.code)
                contract = EVMContract(code, enable_online_lookup=False)

                yield contract, account.address, account.balance
185583
def _contains_internal_dynamic_call(contract):
        
        for func in contract.all_functions_called:
            for node in func.nodes:
                for ir in node.irs:
                    if isinstance(ir, (InternalDynamicCall)):
                        return True
        return False
53739
def _detect(self):
        
        results = []
        for c in self.contracts:
            unindexed_params = self.detect_erc20_unindexed_event_params(c)
            if unindexed_params:
                info = "{} ({}) does not mark important ERC20 parameters as 'indexed':\n"
                info = info.format(c.name, c.source_mapping_str)
                for (event, parameter) in unindexed_params:
                    info += "\t-{} ({}) does not index parameter '{}'\n".format(event.name, event.source_mapping_str, parameter.name)

                # Add the events to the JSON (note: we do not add the params/vars as they have no source mapping).
                json = self.generate_json_result(info)
                self.add_functions_to_json([event for event, _ in unindexed_params], json)
                results.append(json)

        return results
1324524
function findCallbacks (subscriptions, channel) {
    // First try to see if a callback for the exact channel exists
    if(Object.keys(subscriptions).indexOf(channel)!==-1)
        return subscriptions[channel];
    // If it doesn't then let's try to see if the channel matches a wildcard callback
    var pattern = matchesWildcard(subscriptions, channel);
    if (pattern!== undefined) {
        return subscriptions[pattern];
    }
    // If there's no exact match or wildcard we have to return undefined
    return undefined;
}
1129418
function(expression, onChange, callbackContext) {
    var observer = this._observations.createObserver(expression, onChange, callbackContext || this);
    this._observers.push(observer);
    if (this.observersEnabled) observer.bind(this._context);
    return observer;
  }
1191087
def detect_deprecation_in_expression(self, expression):
        
        # Perform analysis on this expression
        export = ExportValues(expression)
        export_values = export.result()

        # Define our results list
        results = []

        # Check if there is usage of any deprecated solidity variables or functions
        for dep_var in self.DEPRECATED_SOLIDITY_VARIABLE:
            if SolidityVariableComposed(dep_var[0]) in export_values:
                results.append(dep_var)
        for dep_func in self.DEPRECATED_SOLIDITY_FUNCTIONS:
            if SolidityFunction(dep_func[0]) in export_values:
                results.append(dep_func)

        return results
151412
def find_all(self, string, callback):
		
		for index, output in self.iter(string):
			callback(index, output)
511882
def all(self, func=None):
        
        if func is None:
            func = lambda x, *args: x
        self.altmp = True

        def testEach(value, index, *args):
            if func(value, index, *args) is False:
                self.altmp = False

        self._clean.each(testEach)
        return self._wrap(self.altmp)
859010
def after_match(self, func, full_fallback=False):
        
        iterator = iter(self)
        for item in iterator:
            if func(item):
                return iterator
        if full_fallback:
            iterator = iter(self)
        return iterator
363249
async def filterindex(source, func):
    
    source = transform.enumerate.raw(source)
    async with streamcontext(source) as streamer:
        async for i, item in streamer:
            if func(i):
                yield item
968956
def show_all(key):
    '''
    
    '''
    def func(request, abbr, session, bill_id, key):
        # get fixed version
        fixed_bill_id = fix_bill_id(bill_id)
        # redirect if URL's id isn't fixed id without spaces
        if fixed_bill_id.replace(' ', '') != bill_id:
            return redirect('bill', abbr=abbr, session=session,
                            bill_id=fixed_bill_id.replace(' ', ''))
        bill = db.bills.find_one({settings.LEVEL_FIELD: abbr,
                                  'session': session,
                                  'bill_id': fixed_bill_id})
        if bill is None:
            raise Http404('no bill found {0} {1} {2}'.format(abbr, session,
                                                             bill_id))
        return render(request, templatename('bill_all_%s' % key),
                      dict(abbr=abbr, metadata=Metadata.get_object(abbr),
                           bill=bill, sources=bill['sources'],
                           nav_active='bills'))
    return func
995139
def filter_callbacks(cls, client, event_data):
        """"""

        for event in cls.filter_events(client, event_data):
            for cb in event.callbacks:
                yield cb
201082
def _detect(self):
        
        results = []
        for c in self.slither.contracts:
            for f in c.functions + c.modifiers:
                if f.contract != c:
                    continue
                unused_return = self.detect_unused_return_values(f)
                if unused_return:
                    info = "{}.{} ({}) does not use the value returned by external calls:\n"
                    info = info.format(f.contract.name,
                                       f.name,
                                       f.source_mapping_str)
                    for node in unused_return:
                        info += "\t-{} ({})\n".format(node.expression, node.source_mapping_str)

                    json = self.generate_json_result(info)
                    self.add_function_to_json(f, json)
                    self.add_nodes_to_json(unused_return, json)
                    results.append(json)

        return results
1199718
function(accountsError, accountsResult) {
        const fixedAccountsResult = accountsResult.slice(0);

        // if no error, fixed result
        if (!accountsError) {
          fixedAccountsResult.map(function(item) {
            return String(item.toLowerCase());
          });
        }

        // fire oldd callback with new fix
        oldCallback(accountsError, fixedAccountsResult);
      }
317363
def _detect(self):
        
        results = []
        for c in self.contracts:
            functions = IncorrectERC20InterfaceDetection.detect_incorrect_erc20_interface(c)
            if functions:
                info = "{} ({}) has incorrect ERC20 function interface(s):\n"
                info = info.format(c.name,
                                   c.source_mapping_str)
                for function in functions:
                    info += "\t-{} ({})\n".format(function.name, function.source_mapping_str)
                json = self.generate_json_result(info)
                self.add_functions_to_json(functions, json)
                results.append(json)

        return results