return function with searching criteria
482481
function(obj, name, callback){
      if (!obj) return Belt.noop;

      var s = _.pick(obj, B._api_objects[name + 's']);

      var stream = B._gateway[name].search(function(search){
          _.each(s, function(v, k){
            if (_.isObject(v)) return search[k].call(search)[v.op](v.val, v.val2);

            return search[k].call(search).is(v);
          });
        })
      , results = []
      , err;

      stream.on('data', function(r){
        return results.push(r);
      });
      stream.on('error', function(e){
        return err = e;
      });
      return stream.on('end', function(){
        return callback(err, results);
      });
    }
993937
def function(self, rule, args, **kwargs):
        
        fname = rule.function
        try:
            return self.functions[fname](args)
        except KeyError:
            raise FilteringRuleException("Invalid function name '{}'".format(fname))
754871
function createFind(findIndexFunc) {
      return function(collection, predicate, fromIndex) {
        var iterable = Object(collection);
        if (!isArrayLike(collection)) {
          var iteratee = getIteratee(predicate, 3);
          collection = keys(collection);
          predicate = function(key) { return iteratee(iterable[key], key, iterable); };
        }
        var index = findIndexFunc(collection, predicate, fromIndex);
        return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined$1;
      };
    }
1031276
def get_function(self, fun=None):
        """"""
        sfun = str(fun)
        self.say('get_function:' + sfun, verbosity=100)

        if not fun:
            return NoRuleFunction()  # dummy to execute via no_fun

        if sfun in self._rule_functions:
            return self._rule_functions[sfun]
        else:
            self.add_function(name=sfun,
                              fun=self.rule_function_not_found(fun))
            self.cry('fun(%s) not found, returning dummy' %
                     (sfun), verbosity=10)
            if sfun in self._rule_functions:
                return self._rule_functions[sfun]
            else:
                self.rule_function_not_found(fun)
732530
def _find_function(name,
                   region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    for funcs in __utils__['boto3.paged_call'](conn.list_functions):
        for func in funcs['Functions']:
            if func['FunctionName'] == name:
                return func
    return None
660342
def filter_by_func(self, func:Callable)->'ItemList':
        ""
        self.items = array([o for o in self.items if func(o)])
        return self
414091
function createFind(findIndexFunc) {
    return function(collection, predicate, fromIndex) {
      var iterable = Object(collection);
      predicate = baseIteratee(predicate, 3);
      if (!isArrayLike(collection)) {
        var props = keys(collection);
      }
      var index = findIndexFunc(props || collection, function(value, key) {
        if (props) {
          key = value;
          value = iterable[key];
        }
        return predicate(value, key, iterable);
      }, fromIndex);
      return index > -1 ? collection[props ? props[index] : index] : undefined;
    };
  }
181240
def p_return(p):
    
    if not FUNCTION_LEVEL:  # At less one level, otherwise, this return is from a GOSUB
        p[0] = make_sentence('RETURN')
        return

    if FUNCTION_LEVEL[-1].kind != KIND.sub:
        syntax_error(p.lineno(1), 'Syntax Error: Functions must RETURN a value, or use EXIT FUNCTION instead.')
        p[0] = None
        return

    p[0] = make_sentence('RETURN', FUNCTION_LEVEL[-1])
217602
function isFoundIn (str) {
  str = stripUrls(str)
  return function find (searchfor) {
    if (searchfor instanceof RegExp) return searchfor.test(str)
    else if (typeof searchfor === 'function') return searchfor(str)
    else return str && str.indexOf(searchfor) >= 0
  }
}
1219970
function search(user, pass, userArray) {
      return _.findWhere(userArray, { user: user, pass: pass });
    }
404176
def search(cls, term, weights=None, with_score=False, score_alias='score',
               explicit_ordering=False):
        """"""
        return cls._search(
            term,
            weights,
            with_score,
            score_alias,
            cls.rank,
            explicit_ordering)
668209
def true_false_returns(func):
    

    @functools.wraps(func)
    def _execute(*args, **kwargs):
        """Executes function, if error returns False, else True

        :param args: args of function
        :param kwargs: extra args of function
        :param *args: args
        :param **kwargs: extra args
        :return: True iff ok, else False
        """

        try:
            func(*args, **kwargs)
            return True
        except:
            return False

    return _execute
73896
def wants(cls, *service_names):
        """"""
        def _decorator(cls_):                                # pylint: disable=missing-docstring
            for service_name in service_names:
                cls_._services_requested[service_name] = "want"  # pylint: disable=protected-access
            return cls_
        return _decorator
538148
def indexMatch(L, func):
    ''
    for i, x in enumerate(L):
        if func(x):
            return i
549626
function findByNameEx(args, matches) {

		// create a variable to store the matches
		matches = matches || [];
		
		// set option defaults
		args.name       = Array.isArray(args.name) ? args.name : [args.name];
		args.recursive  = (typeof(args.recursive) === 'boolean') ? args.recursive : false;
		args.limit      = !isNaN(args.limit) ? args.limit : 1;
		args.properties = args.properties || [];
		
		// check for a starting point, if one doesnt exist begin at the datacenter level
		if (!args.parent) {
			return rootSearch(args)
			.then(function(parents) {
				return findByNameEx({
					type       : args.type,
					name       : args.name,
					properties : args.properties,
					parent     : parents,
					recursive  : args.recursive,
					limit      : args.limit
				}, matches);
			});
		}
		
		// convert the parent to an array if it is not one
		args.parent = Array.isArray(args.parent) ? args.parent : [args.parent];
		
		// perform the search
		return Promise.each(args.parent, function(parent) {
			
			// check if the match limit is met
			if (matches.length >= args.limit) {
				return;
			}
			
			// perform the search on each name
			return Promise.each(args.name, function(name) {
				
				// check if the match limit is met
				if (matches.length >= args.limit) {
					return;
				}
				
				// perform the search
				return _client.getServiceContent({
					method: 'FindChild',
					service: 'searchIndex',
					params: {
						entity: util.moRef(parent.type, parent.id),
						name: name
					}
				})
				.then(function(result) {

					var id = _.get(result, '$value');
					
					if (id) {
						matches.push(id);
					}					
				});
			})
			.then(function() {
				
				// check if the match limit is met, if not and recursive
				// attempt to descend the child objects
				if (matches.length < args.limit && args.recursive) {
					
					// get the children of the current parent
					return _client.retrieve({
						type: parent.type,
						id: parent.id,
						properties: ['childEntity']
					})
					.then(function(mo) {

						var parents = [];
						
						// get all of the child folders
						_.forEach(_.get(mo, '[0].childEntity'), function(child) {
							if (child.match(/^group-.*/)) {
								parents.push({
									type: 'Folder',
									id: child
								});
							}
						});
						
						// if there were folders, recurse
						if (parents.length > 0) {
							return findByNameEx({
								type       : args.type,
								name       : args.name,
								properties : args.properties,
								parent     : parents,
								recursive  : args.recursive,
								limit      : args.limit
							}, matches);
						}
					});
				}
			});
		})
		.then(function() {
			return matches;
		});
	}
1255180
function search(patt, options = {}) {
    return new Promise((resolve, reject) => glob(
        patt, options, (err, files) => err ? reject(err) : resolve(files)
    ));
}
310251
function(value, context, argCount) {
    if (value === null) return _identity;
    if (_isFunction(value)) return optimizeCb(value, context, argCount);
    if (_isObject(value)) return _matcher(value);
    return _property(value);
  }