Build a function inclusion filter for a collection of functions.
550230
def _collection_function_inclusion_builder(funcs: Iterable[str]) -> NodePredicate:
    """"""
    funcs = set(funcs)

    if not funcs:
        raise ValueError('can not build function inclusion filter with empty list of functions')

    def functions_inclusion_filter(_: BELGraph, node: BaseEntity) -> bool:
        """Pass only for a node that is one of the enclosed functions."""
        return node.function in funcs

    return functions_inclusion_filter
968512
def filtered(f):
    '''
    
    '''

    def _filter(f, self, *args, **kwargs):
        frame = f(self, *args, **kwargs)
        ret = type(self)(frame)
        ret._lbound = self._lbound
        ret._rbound = self._rbound
        return ret

    if HAS_DECORATOR:
        return decorator(_filter, f)
    else:
        def err_func(*args, **kwargs):
            raise RuntimeError("`pip install decorator` required")
        return err_func
856907
def compose_functions(*func_list):
    
    def apply_composition(f, g):
        def compose(x):
            return f(g(x))
        return compose
    composed_func = functools.reduce(apply_composition, func_list)
    return composed_func
937293
def simplefilter(f):
    
    return type(f.__name__, (FunctionFilter,), {
        '__module__': getattr(f, '__module__'),
        '__doc__': f.__doc__,
        'function': f,
    })
515246
def make_funcs(dataset, setdir, store):
    """"""
    return {
        'cat': lambda *lists: [x for lst in lists for x in lst],
        'comments': lambda: None,
        'detail_route': detail_route,
        'format': lambda fmt, *args: fmt.format(*args),
        'get': partial(getnode, dataset, setdir, store),
        'join': lambda sep, *args: sep.join([x for x in args if x]),
        'len': len,
        'link': (lambda href, title, target=None:
                 {'href': href or "",
                  'title': title or "",
                  'target': '_blank' if target is None else target}),
        'list': lambda *x: filter(None, list(x)),
        'max': max,
        'min': min,
        'status': lambda: ['#STATUS#'],
        'sum': sum,
        'tags': lambda: ['#TAGS#'],
        'trace': print_trace,
    }
939514
function filterTasks (type, tasks, alltasks) {
    var contains = function (task) {
        return _.includes(tasks, task.name);
    };

    if (type === 'include') {
        return _.filter(alltasks, contains);
    } else if (type === 'exclude') {
        return _.reject(alltasks, contains);
    }
    return alltasks;
}
765736
def functions(self, value):
        

        if value is not None:
            assert type(value) is tuple, "'{0}' attribute: '{1}' type is not 'tuple'!".format("functions", value)
            for element in value:
                assert type(element) is LibraryHook, "'{0}' attribute: '{1}' type is not 'LibraryHook'!".format(
                    "functions", element)
        self.__functions = value
844900
private void processFunctions(String name, String text, String type,
      List<MtasCRMParserFunctionOutput> functionOutputList) {
    if (functions.containsKey(type) && functions.get(type).containsKey(name)
        && text != null) {
      MtasCRMParserFunction function = functions.get(type).get(name);
      String[] value;
      if (function.split != null) {
        value = text.split(Pattern.quote(function.split));
      } else {
        value = new String[] { text };
      }
      for (int c = 0; c < value.length; c++) {
        boolean checkedEmpty = false;
        if (value[c].equals("")) {
          checkedEmpty = true;
        }
        if (function.output.containsKey(value[c])) {
          ArrayList<MtasCRMParserFunctionOutput> list = function.output
              .get(value[c]);
          for (MtasCRMParserFunctionOutput listItem : list) {
            functionOutputList.add(listItem.create(value[c]));
          }
        }
        if (!checkedEmpty && function.output.containsKey("")) {
          ArrayList<MtasCRMParserFunctionOutput> list = function.output.get("");
          for (MtasCRMParserFunctionOutput listItem : list) {
            functionOutputList.add(listItem.create(value[c]));
          }
        }
      }
    }
  }
397304
def filter_t(func):
    
    return Transformation('filter({0})'.format(name(func)),
                          partial(filter, func),
                          {ExecutionStrategies.PARALLEL})
209812
def filter_simple(filter):
    
    def function_getter(function):
        if isinstance(function, Filter):
            function.add_filter(filter)

            return function
        else:
            return Filter(
                filter=filter,
                callback=function,
            )

    return function_getter
965565
def exclude_functions(self, *funcs):
        
        for f in funcs:
            f.exclude = True
        run_time_s = sum(0 if s.exclude else s.own_time_s for s in self.stats)
        cProfileFuncStat.run_time_s = run_time_s
274716
def where(self, relation, filter_fn):
        '''  '''
        assert type(relation).__name__ in {'str','unicode'}, 'where needs the first arg to be a string'
        assert callable(filter_fn), 'filter_fn needs to be callable'
        return VList(i for i in self if relation in i._relations() and any(filter_fn(_()) for _ in i[relation]))
1089953
function createFilterFunction (resource) {
  return resource.has instanceof Function
    ? id => resource.has(id)
    : id => resource[id]
}
771760
def add_filter(self, ftype, func):
        '''  '''
        if not isinstance(ftype, type):
            raise TypeError("Expected type object, got %s" % type(ftype))
        self.castfilter = [(t, f) for (t, f) in self.castfilter if t != ftype]
        self.castfilter.append((ftype, func))
        self.castfilter.sort()
662777
def filter(self, func):
        """"""
        return self.__class__( [ i for i in self.res if func(*i) ], name='filtered %s'%self.listname)
260996
def filter(self, func):
        
        return self._wrap(list(filter(func, self.obj)))
977307
function(a) {
    var fn = function(n, src, got, all) {
      if (n === 0) {
        all.push(got);
        return;
      }

      for (var j = 0; j < src.length; j++) {
        fn(n - 1, src.slice(j + 1), got.concat([src[j]]), all);
      }
    };

    var excluded = excludedPlugins.map(function(plugin) {
      return 'plugins/' + plugin + '.js';
    });

    // Remove the plugins that we don't want to build
    a = a.filter(function(n) {
      return excluded.indexOf(n) === -1;
    });

    var all = [a];

    for (var i = 0; i < a.length; i++) {
      fn(i, a, [], all);
    }

    return all;
  }