returns new list with elements from input that satisfies given filter condition
11235
public static <T> List<T> positiveFilter(List<T> input, Predicate<T> filter) {
        argumentsAreNotNull(input, filter);
        return input.stream().filter(filter).collect(Collectors.toList());
    }
203446
def cleandata(inputlist):
    
    output = []
    for e in inputlist:
        new = []
        for f in e:
            if f == "--":
                new.append(None)
            else:
                new.append(float(f))
        output.append(new)
    return output
91571
function (node, name,filter) {
        if(filter && utils.isString(filter)){
           var className = filter;
           filter =  function(node){return domUtils.hasClass(node,className)}
        }
        name = utils.trim(name).replace(/[ ]{2,}/g,' ').split(' ');
        var arr = [];
        for(var n = 0,ni;ni=name[n++];){
            var list = node.getElementsByTagName(ni);
            for (var i = 0, ci; ci = list[i++];) {
                if(!filter || filter(ci))
                    arr.push(ci);
            }
        }

        return arr;
    }
1271561
def filter_vectors(self, input_list):
        
        try:
            # Return filtered (vector, data, distance )tuple list. Will fail
            # if input is list of (vector, data) tuples.
            return [x for x in input_list if x[2] < self.distance_threshold]
        except:
            # Otherwise just return input list
            return input_list
222365
def copy(input, **params):
    
    PARAM_FIELDS = 'fields'

    def filter_fields(obj, fields):
        return {k:v for k,v in obj.items() if k in fields}

    if PARAM_FIELDS in params:
        fields = params.get(PARAM_FIELDS)
        if isinstance(input, list):
            res = []
            for row in input:
                res.append(filter_fields(row, fields))
            return res
        elif isinstance(input, dict):
            return filter_fields(input, fields)
        else:
            raise NotImplementedError('{} is not supported'.format(type(input)))
    else:
        return input
557494
def filter(cls, filters, iterable):
    ''''''
    if isinstance(filters, Filter):
      filters = [filters]

    for filter in filters:
      iterable = filter.generator(iterable)

    return iterable
504416
public static <E> List<E> filter(final Iterable<E> iterable, final Predicate<E> pred) {
        final List<E> filtered = newArrayList();
        for (E element : iterable) {
            if (pred.test(element)) {
                filtered.add(element);
            }
        }
        return filtered;
    }
478042
def filtre(liste_base, criteres) -> groups.Collection:
        

        def choisi(ac):
            for cat, li in criteres.items():
                v = ac[cat]
                if not (v in li):
                    return False
            return True

        return groups.Collection(a for a in liste_base if choisi(a))
103494
def _build_filter_list(self, filters):
        
        i = 0
        for (filter_type, values) in filters.items():
            if isinstance(values[0], str):
                for line in values[0].split('\n'):
                    line = line.strip()
                    yield "{filter_name} {filter_type} {filter_value}".format(
                        filter_name="filter" + str(i),
                        filter_type=filter_type,
                        filter_value='"{}" {}'.format(line, " ".join([str(v) for v in values[1:]]))).strip()
                    i += 1
            else:
                yield "{filter_name} {filter_type} {filter_value}".format(
                    filter_name="filter" + str(i),
                    filter_type=filter_type,
                    filter_value=" ".join([str(v) for v in values]))
                i += 1
1337369
def _flatten(self, iterator, **filter_options):
        '''
        
        '''
        resp = list()
        for entry in iterator:
            for tup in entry:
                if self._matches_filter(tup, **filter_options):
                    resp.append(tup)
        return resp
76037
def getElementsByName(self, name):
        
        try:
            return filter(lambda x: x.name == name, self._lattice_eleobjlist)
        except:
            return []
443912
def filter(cls, iterable, cond, *a, **kw):
    

    return cls(x for x in iterable if cond(x, *a, **kw))
1180858
public static <T> List<T> filtered(Collection<T> data, Filter<T> filter) {
        List<T> list = new ArrayList<>();
        if (!Utils.isEmpty(data)) {
            for (T item : data) {
                if (filter.accept(item)) {
                    list.add(item);
                }
            }
        }
        return list;
    }
1086307
def _filter_by_pattern(self, pattern):
        """"""
        try:
            _len = len(pattern)
        except TypeError:
            raise TypeError("pattern is not a list of Booleans. Got {}".format(
                type(pattern)))
        _filt_values = [d for i, d in enumerate(self._values) if pattern[i % _len]]
        _filt_datetimes = [d for i, d in enumerate(self.datetimes) if pattern[i % _len]]
        return _filt_values, _filt_datetimes
781864
def _filtered_list(self, selector):
        
        res = []
        for elem in self.obj:
            self._append(elem, selector, res)
        return res
763650
private static <E extends Element> Set<E> setFilter(Set<? extends Element> elements,
                                                        Set<ElementKind> targetKinds,
                                                        Class<E> clazz) {
        // Return set preserving iteration order of input set.
        Set<E> set = new LinkedHashSet<E>();
        for (Element e : elements) {
            if (targetKinds.contains(e.getKind()))
                set.add(clazz.cast(e));
        }
        return set;
    }
334613
def list(self, filterfn=lambda x: True):
        
        return [self / p for p in self.listdir() if filterfn(self / p)]