

def create_filter(predicate_param, predicate_factory):
    "Create a filter function from a string parameter.\n\n  :param predicate_param: Create a filter for this param string. Each string is a\n                          comma-separated list of arguments to the predicate_factory.\n                          If the entire comma-separated list is prefixed by a '-' then the\n                          sense of the resulting filter is inverted.\n  :param predicate_factory: A function that takes a parameter and returns a predicate, i.e., a\n                            function that takes a single parameter (of whatever type the filter\n                            operates on) and returns a boolean.\n  :return: A filter function of one argument that is the logical OR of the predicates for each of\n           the comma-separated arguments. If the comma-separated list was prefixed by a '-',\n           the sense of the filter is inverted.\n  "
    (modifier, param) = _extract_modifier(predicate_param)
    predicates = map(predicate_factory, param.split(','))

    def filt(x):
        return modifier(any(map((lambda pred: pred(x)), predicates)))
    return filt

dataset/ETHPy150Open pantsbuild/pants/src/python/pants/util/filtering.py create_filter/original