Make filters from GET variables.

        :return dict: filters
496413
def get_filters(self, request, **resources):
        
        filters = dict()

        if not self._meta.fields:
            return filters

        for field in request.GET.iterkeys():
            tokens = field.split(LOOKUP_SEP)
            field_name = tokens[0]

            if field_name not in self._meta.fields:
                continue

            exclude = False
            if tokens[-1] == 'not':
                exclude = True
                tokens.pop()

            value = request.GET.getlist(field)
            if len(tokens) == 1:
                value = map(self._meta.model._meta.get_field(field_name).to_python, value)

            if len(value) > 1:
                tokens.append('in')
            else:
                value = value.pop()

            filters[LOOKUP_SEP.join(tokens)] = (value, exclude)

        return filters
379759
def make_filter(**tests):
    """"""
    tests = [AttrTest(k, v) for k, v in tests.items()]
    return Filter(tests)
843320
def get_filter(self):
        
        q = self.q().select('name').expand('filter')
        response = self.session.get(self.build_url(''), params=q.as_params())
        if not response:
            return None
        data = response.json()
        return data.get('criteria', None)
122978
def _parse_cli_filters(filters):
        
        parsed_filters = []
        for filter_entry in filters:
            filter_parts = re.match('^Name=(?P<name_value>[^,]+),Values=\[?(?P<key_values>[^\]]+)\]?', filter_entry)
            parsed_filters.append({
                'Name': filter_parts.group('name_value'),
                'Values': filter_parts.group('key_values').split(',')
            })
        return parsed_filters
140161
def _func_filters(self, filters):
        '''
        '''
        if not isinstance(filters, (list,tuple)):
            raise TypeError('func_filters must be a <type list> or <type tuple>')

        for i, func in enumerate(filters) :
            if isinstance(func, str) and func == 'reverse':
                filters[i] = 'reverse()'
            elif isinstance(func, tuple) and func[0] in YQL.FUNC_FILTERS:
                filters[i] = '{:s}(count={:d})'.format(*func)
            elif isinstance(func, dict) :
                func_stmt = ''
                func_name = list(func.keys())[0] # Because of Py3
                values = [ "{0}='{1}'".format(v[0], v[1]) for v in func[func_name] ]
                func_stmt = ','.join(values)
                func_stmt = '{0}({1})'.format(func_name, func_stmt)
                filters[i] = func_stmt
            else:
                raise TypeError('{0} is neither a <str>, a <tuple> or a <dict>'.format(func))
        return '| '.join(filters)
557494
def filter(cls, filters, iterable):
    ''''''
    if isinstance(filters, Filter):
      filters = [filters]

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

    return iterable
866193
def lookups(self):
        ""
        for filter in self._filters:
            yield filter.key, filter.display, filter.no_argument
612346
def get_filters_params(self, params=None):
        
        if not params:
            params = self.params
        lookup_params = params.copy()  # a dictionary of the query string
        # Remove all the parameters that are globally and systematically
        # ignored.
        for ignored in IGNORED_PARAMS:
            if ignored in lookup_params:
                del lookup_params[ignored]
        return lookup_params
66688
def _get_variables(self):
        """"""
        if self._specs_in[_VARIABLES_STR] == 'all':
            return _get_all_objs_of_type(
                Var, getattr(self._obj_lib, 'variables', self._obj_lib)
            )
        else:
            return set(self._specs_in[_VARIABLES_STR])
1088838
def _apply_filters(self):
        
        # apply filters
        filters = []
        for f in self._filters:
            filters.append('{}{}{}'.format(f['name'], f['operator'], f['value']))
        self.tcex.log.debug(u'filters: {}'.format(filters))

        if filters:
            self._request.add_payload('filters', ','.join(filters))
1258225
def variables(self):
        ''''''
        return sorted(list(self.mapping.vars.keys()),
                      key = lambda v : self.mapping.vars[v].index)
264098
def filters(self):
        
        results = []
        filters = self.qs.get('filter')
        if filters is not None:
            try:
                results.extend(json.loads(filters))
            except (ValueError, TypeError):
                raise InvalidFilters("Parse error")
        if self._get_key_values('filter['):
            results.extend(self._simple_filters(self._get_key_values('filter[')))
        return results
218011
def and_filter_from_opts(opts):
    ''''''
    return filters.and_filter(*list(chain.from_iterable([
        o for o in opts.values() if o]
    )))
943531
def set_filters(self, filters):
        
        if filters == None or isinstance(filters, (tuple, list)):
            self.filters = filters
        else:
            self.filters = [ filters ]
173006
def get_filters(self):
        
        return [
            self.compute_style_filter,
            self.render_filter,
            self.calc_widths_filter,
            self.format_row_filter,
            self.align_rows_filter,
        ]
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
1342707
def extract_filters(user_params, options = {})
      filters_hash = {}

      apply_default_filters = options.fetch(:apply_default_filters) { true }

      configuration[:filters].each do |filter_name, filter_options|
        user_value = format_filter_value(user_params[filter_name])

        filter_arg = apply_default_filters && user_value.nil? ? filter_options[:default] : user_value
        filters_hash[filter_name] = filter_arg unless filter_arg.nil?
      end

      filters_hash
    end