Attach core filters to filterset
437919
def attach_core_filters(cls):
        
        opts = cls._meta
        base_filters = cls.base_filters.copy()
        cls.base_filters.clear()
        for name, filter_ in six.iteritems(base_filters):
            if isinstance(filter_, AutoFilters):
                field = filterset.get_model_field(opts.model, filter_.name)
                filter_exclusion = filter_.extra.pop('drop', [])
                for lookup_expr in utils.lookups_for_field(field):
                    if lookup_expr not in filter_exclusion:
                        new_filter = cls.filter_for_field(field, filter_.name, lookup_expr)
                        # by convention use field name for filters with exact lookup_expr
                        if lookup_expr != 'exact':
                            filter_name = LOOKUP_SEP.join([name, lookup_expr])
                        else:
                            filter_name = name
                        cls.base_filters[filter_name] = new_filter
1174134
def compile_filter(bpf_filter, iface=None):
    
    if not TCPDUMP:
        raise Scapy_Exception("tcpdump is not available. Cannot use filter !")
    try:
        process = subprocess.Popen([
            conf.prog.tcpdump,
            "-p",
            "-i", (conf.iface if iface is None else iface),
            "-ddd",
            "-s", str(MTU),
            bpf_filter],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        )
    except OSError as ex:
        raise Scapy_Exception("Failed to attach filter: %s" % ex)
    lines, err = process.communicate()
    ret = process.returncode
    if ret:
        raise Scapy_Exception(
            "Failed to attach filter: tcpdump returned: %s" % err
        )
    lines = lines.strip().split(b"\n")
    return get_bpf_pointer(lines)
1065712
def _add_filters(self, **filters):
        """"""
        for key, value in filters.items():
            if self._field_is_pk(key):
                pk = self.cls.get_field('pk').normalize(value)
                self._lazy_collection['pks'].add(pk)
            else:
                # store the info to call the index later, in ``_prepare_sets``
                # (to avoid doing extra work if the collection is never called)
                index, suffix, extra_field_parts = self._parse_filter_key(key)
                parsed_filter = ParsedFilter(index, suffix, extra_field_parts, value)
                self._lazy_collection['sets'].append(parsed_filter)

        return self
608678
@SuppressWarnings("unchecked")
    private void loadFilters(Map<String, FilterConfiguration> filters, Environment environment) throws ClassNotFoundException {
        if (filters != null) {
            for (Map.Entry<String, FilterConfiguration> filterEntry : filters.entrySet()) {
                FilterConfiguration filter = filterEntry.getValue();

                // Create filter holder
                FilterHolder filterHolder = new FilterHolder((Class<? extends Filter>) Class.forName(filter.getClazz()));

                // Set name of filter
                filterHolder.setName(filterEntry.getKey());
                
                // Set params
                if (filter.getParam() != null) {
                    for (Map.Entry<String, String> entry : filter.getParam().entrySet()) {
                        filterHolder.setInitParameter(entry.getKey(), entry.getValue());
                    }
                }

                // Add filter
                environment.getApplicationContext().addFilter(filterHolder, filter.getUrl(), EnumSet.of(DispatcherType.REQUEST));
            }
        }
    }
722616
function(filterName, input, args) {
            var self            = this,
                hooks           = self.constructor.filters[filterName],
                output          = input,
                extensionName   = '';

            if (!hooks || h.isEmptyObject(hooks)) return output;

            args = args || [];

            for (extensionName in hooks) {
                args = h.arrayFromList(args);

                args.unshift(output);

                output = hooks[extensionName].apply(self, args);
            }

            return output;
        }
695186
private void filter(ValueSet filterValueSet, ValueSet valueSet) {
        if (filterValueSet != null && valueSet != null && !filterValueSet.isEmpty() && !valueSet.isEmpty()) {
            Iterator it = filterValueSet.iterator();
            while (it.hasNext()) {
                Object o = it.next();
                if (valueSet.contains(o)) {
                    it.remove();
                }
            }
        }
    }
856302
def resolve(self, event_handler, *custom_filters, **full_config
                ) -> typing.List[typing.Union[typing.Callable, AbstractFilter]]:
        
        filters_set = []
        filters_set.extend(self._resolve_registered(event_handler,
                                                    {k: v for k, v in full_config.items() if v is not None}))
        if custom_filters:
            filters_set.extend(custom_filters)

        return filters_set
939533
def attach_filter(fd, bpf_filter, iface):
    """"""
    bp = compile_filter(bpf_filter, iface)
    # Assign the BPF program to the interface
    ret = LIBC.ioctl(c_int(fd), BIOCSETF, cast(pointer(bp), c_char_p))
    if ret < 0:
        raise Scapy_Exception("Can't attach the BPF filter !")
56830
def _sync_filters(self, filters_json):
        """""""
        for filter_json in filters_json:
            filter_id = filter_json['id']
            self.filters[filter_id] = Filter(filter_json, self)
270799
def get_filterset(self, request, queryset, view):
        
        # TODO: .base_filters vs. .filters attr (not always present)
        filterset_class = self.get_filterset_class(view, queryset)
        kwargs = self.get_filterset_kwargs(request, queryset, view)
        self._validate_filter(kwargs.pop('filter_keys'), filterset_class)
        if filterset_class is None:
            return None
        return filterset_class(**kwargs)
109061
public void addFilter(AbstractLogFilter<E> filter) {
                Validate.notNull(filter);
                filters.add(filter);
                uptodate = false;
                filter.addObserver(this);
        }
758444
def apply_filter(self):
    ''''''
    self._ensure_modification_is_safe()

    if len(self.query.filters) > 0:
      self._iterable = Filter.filter(self.query.filters, self._iterable)
538933
public void setFilters(String filters)
    {
        for (String filter : filters.split(",")) {
            filteredFrames.add("at " + filter.trim());
        }
    }
485409
function _applyFilters(rawdata, filterOptions) {
			var dataToWorkOn = (JSON.parse(JSON.stringify(rawdata)));
			var containerWidth = document.querySelector('#sapUiSupportPerfHeaderTimeline').offsetWidth - document.querySelector('#sapUiSupportPerfHeaderTimelineBarInfoWrapper').offsetWidth;
			var scrollWidth = 20;
			var filteredTime = 1;

			dataToWorkOn = _filterByTime(filterOptions.filterByTime, dataToWorkOn);
			dataToWorkOn = _sortBy(filterOptions.orderByValue, dataToWorkOn);
			dataToWorkOn = _filterMinValue(filterOptions.minValue, dataToWorkOn);

			if (dataToWorkOn.length) {
				filteredTime = filterOptions.filterByTime.end - filterOptions.filterByTime.start;
			}

			_widthSingleUnit = ((containerWidth - scrollWidth) / filteredTime); //ms in px

			return dataToWorkOn;
		}
981676
function setCurrentFilter(filter) {
    var token = cache.get('token');
    var dfrd = Q.defer();
    var id;
    if (!token) {
      dfrd.reject(MODULE_ERRORS.undefinedToken);
    } else {
      id = typeof filter === 'string' ? filter : filter.id;
      request(format(URLs.setCurrentFilter, PROTOCOL, conf.host, id,
        token), function(err, res, body) {
        if (err) {
          dfrd.reject(err);
        } else {
          _extractEmptyResponse(body, dfrd);
          dfrd.resolve(true);
        }
      });
    }
    return dfrd.promise;
  }
370098
void importFilter() {
        filterOpenFileChooser.setDialogTitle(L10N.getLocalString("dlg.importFilter_ttl", "Import and merge filter..."));

        boolean retry = true;
        File f;
        while (retry) {
            retry = false;

            int value = filterOpenFileChooser.showOpenDialog(mainFrame);

            if (value != JFileChooser.APPROVE_OPTION) {
                return;
            }

            f = filterOpenFileChooser.getSelectedFile();

            if (!f.exists()) {
                JOptionPane.showMessageDialog(filterOpenFileChooser, "No such file", "Invalid File", JOptionPane.WARNING_MESSAGE);
                retry = true;
                continue;
            }
            Filter filter;
            try {
                filter = Filter.parseFilter(f.getPath());
            } catch (IOException e) {
                JOptionPane.showMessageDialog(filterOpenFileChooser, "Could not load filter.");
                retry = true;
                continue;
            }
            mainFrame.setProjectChanged(true);
            Filter suppressionFilter = mainFrame.getProject().getSuppressionFilter();

            for (Matcher m : filter.getChildren()) {
                suppressionFilter.addChild(m);
            }

            PreferencesFrame.getInstance().updateFilterPanel();
        }

    }
853298
def set_filters(self, can_filers=None):
        
        if self.__set_filters_has_been_called:
            logger.warn("using filters is not supported like this, see note on NicanBus")
        else:
            # allow the constructor to call this without causing a warning
            self.__set_filters_has_been_called = True