Returns rules according to given filters
508986
def filter(filters = {})
      all.select do |rule|
        [:country, :type].each do |condition|
          break false if filters[condition] && filters[condition] != rule[condition]
          true
        end
      end
    end
824375
def filter(self, table, items, filter_string):
        """"""
        query = filter_string.lower()
        return [item for item in items
                if query in item.name.lower()]
443912
def filter(cls, iterable, cond, *a, **kw):
    

    return cls(x for x in iterable if cond(x, *a, **kw))
817474
protected function checkFilters()
    {
        $current = $this->prepareForReturn($this->current);

        foreach ($this->filters as $tuple) {
            $result = call_user_func(
                $tuple[0],
                $current->copy(),
                $this->key,
                $this
            );

            if ($result === static::END_ITERATION) {
                return static::END_ITERATION;
            }

            if (!$result) {
                return false;
            }
        }

        return true;
    }
525623
def with(*conditions, &block)
      @filters ||= []

      @filters << {:negate => false, :filter => block} if block
      conditions.each do |condition|
        @filters << {:negate => false, :filter => condition}
      end
    end
1310284
protected function get_filters_as_booleans() {
        $filters = [
            BLOCK_TIMELINE_FILTER_BY_NONE => false,
            BLOCK_TIMELINE_FILTER_BY_OVERDUE => false,
            BLOCK_TIMELINE_FILTER_BY_7_DAYS => false,
            BLOCK_TIMELINE_FILTER_BY_30_DAYS => false,
            BLOCK_TIMELINE_FILTER_BY_3_MONTHS => false,
            BLOCK_TIMELINE_FILTER_BY_6_MONTHS => false
        ];

        // Set the selected filter to true.
        $filters[$this->filter] = true;

        return $filters;
    }
1365630
def filtered(self, efilter):
        '''
        
        '''
        if not self.params:
            self.params={'filter' : efilter}
            return self
        if not self.params.has_key('filter'):
            self.params['filter'] = efilter
            return self
        self.params['filter'].update(efilter)
        return self
796234
def get_candidates(rules)
      candidates = []
      rules.each { |rule| candidates << rule if rule.ever_matched? && rule.time_to_report? }
      candidates
    end
160722
def match(self, rule):
        
        if len(self.filters) == 0:
            return True

        for filter in self.filters:
            if filter.match(rule):
                return True
        return False
764031
public function filterRules(array $rules = array())
    {
        if (empty($rules)) {
            return $this->filterRules;
        }

        $this->filterRules = $rules;

        return $this;
    }
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
507438
def _get_name_filters(cls, filters):
        """"""
        filters = filters.get(cls.__uid_field__)
        if not filters:
            filters = '.*'
        elif not isinstance(filters, string_types):
            filters = r'(%s)' % ('|'.join(filters))
        return filters
779312
def filter(self, **filters):
        

        q = self._clone()
        for key, value in filters.items():
            filter_key = re.split('__', key)
            filter_attr = filter_key[0]
            if filter_attr not in self._valid_filter_attrs:
                raise ClientValidationError("Invalid filter attribute: %s" % key)

            # we use __ as a separator in the Python library, the APIs use '.'
            q._filters['.'.join(filter_key)].append(value)
        return q
430909
def _query_filter(search, urlkwargs, definitions):
    """"""
    filters, urlkwargs = _create_filter_dsl(urlkwargs, definitions)

    for filter_ in filters:
        search = search.filter(filter_)

    return (search, urlkwargs)
551591
def get_filter(self, **filter_kwargs):
        
        filter_kwargs.update(self.base_filter_kwargs)
        if filter_kwargs:
            return [models.Q(**filter_kwargs)]
        return []
1029413
def filter(self, table, mappings, filter_string):
        """"""
        q = filter_string.lower()
        return [mapping for mapping in mappings
                if q in mapping.ud.lower()]
802604
def make_rule(filter, *symbolizers):
    
    scale_tests = [test for test in filter.tests if test.isMapScaled()]
    other_tests = [test for test in filter.tests if not test.isMapScaled()]
    
    # these will be replaced with values as necessary
    minscale, maxscale, filter = None, None, None
    
    for scale_test in scale_tests:

        if scale_test.op in ('>', '>='):
            if scale_test.op == '>=':
                value = scale_test.value
            elif scale_test.op == '>':
                value = scale_test.value + 1

            minscale = output.MinScaleDenominator(value)

        if scale_test.op in ('<', '<='):
            if scale_test.op == '<=':
                value = scale_test.value
            elif scale_test.op == '<':
                value = scale_test.value - 1

            maxscale = output.MaxScaleDenominator(value)
    
    filter_text = ' and '.join(test2str(test) for test in other_tests)
    
    if filter_text:
        filter = output.Filter(filter_text)

    rule = output.Rule(minscale, maxscale, filter, [s for s in symbolizers if s])
    
    return rule