Adds a packet filter to this NIO.
        Filter "freq_drop" drops packets.
        Filter "capture" captures packets.

        :param direction: "in", "out" or "both"
        :param filter_name: name of the filter to apply
972714
def bind_filter(self, direction, filter_name):
        

        if direction not in self._dynamips_direction:
            raise DynamipsError("Unknown direction {} to bind filter {}:".format(direction, filter_name))
        dynamips_direction = self._dynamips_direction[direction]

        yield from self._hypervisor.send("nio bind_filter {name} {direction} {filter}".format(name=self._name,
                                                                                              direction=dynamips_direction,
                                                                                              filter=filter_name))

        if direction == "in":
            self._input_filter = filter_name
        elif direction == "out":
            self._output_filter = filter_name
        elif direction == "both":
            self._input_filter = filter_name
            self._output_filter = filter_name
365262
def out_filter_get(self, address):
        

        func_name = 'neighbor.out_filter.get'
        param = {
            neighbors.IP_ADDRESS: address,
        }

        return call(func_name, **param)
952887
def get_filter_item(name: str, operation: bytes, value: bytes) -> bytes:
    
    assert isinstance(name, str)
    assert isinstance(value, bytes)
    if operation is None:
        return filter_format(b"(%s=%s)", [name, value])
    elif operation == "contains":
        assert value != ""
        return filter_format(b"(%s=*%s*)", [name, value])
    else:
        raise ValueError("Unknown search operation %s" % operation)
620254
def add_filter(self, package_filter):
        
        filters = self.filters + [package_filter]
        self.filters = sorted(filters, key=lambda x: x.cost)
338132
public function addFilterHandler($filterName, $filterHandlerName, $priority = 50)
    {
        $this->addHandler(self::FILTER, $filterName, $filterHandlerName, $priority);
    }
123950
def add_filter(self, key, filter_value):
        
        seek = u"filter[%s]" % key
        if self.validate_filter(key, filter_value):
            self.filters[key] = filter_value
            return True
        else:
            msg = u'Invalid filter value: filter:%s value:%s' % (key, filter_value)
            print msg
            raise SalesKingException("FILTER_INVALID", msg )
649343
function doFilter(tracer, err, serverId, msg, opts, filters, index, operate, cb) {
    if (index < filters.length) {
        tracer.info('client', __filename, 'doFilter', `do ${operate} filter ${filters[index].name}`);
    }
    if (index >= filters.length || !!err) {
        utils.invokeCallback(cb, tracer, err, serverId, msg, opts);
        return;
    }
    const filter = filters[index];
    if (typeof filter === 'function') {
        filter(serverId, msg, opts, (target, message, options) => {
            index++;
            // compatible for pomelo filter next(err) method
            if (utils.getObjectClass(target) === 'Error') {
                doFilter(tracer, target, serverId, msg, opts, filters, index, operate, cb);
            } else {
                doFilter(tracer, null, target || serverId, message || msg, options || opts, filters, index, operate, cb);
            }
        });
        return;
    }
    if (typeof filter[operate] === 'function') {
        filter[operate](serverId, msg, opts, (target, message, options) => {
            index++;
            if (utils.getObjectClass(target) === 'Error') {
                doFilter(tracer, target, serverId, msg, opts, filters, index, operate, cb);
            } else {
                doFilter(tracer, null, target || serverId, message || msg, options || opts, filters, index, operate, cb);
            }
        });
        return;
    }
    index++;
    doFilter(tracer, err, serverId, msg, opts, filters, index, operate, cb);
}
1028182
def addFilter(self, layer_id, where=None, outFields="*"):
        
        import copy
        f = copy.deepcopy(self._filterTemplate)
        f['layerId'] = layer_id
        f['outFields'] = outFields
        if where is not None:
            f['where'] = where
        if f not in self._filter:
            self._filter.append(f)
619019
def add_filter(filter, filter_options = {})
      filter = RequestLogAnalyzer::Filter.const_get(RequestLogAnalyzer.to_camelcase(filter)) if filter.is_a?(Symbol)
      @filters << filter.new(source.file_format, @options.merge(filter_options))
    end
473899
def filter(self, track=None, follow=None, locations=None, event=None,
               record_keepalive=False):
        
        if locations is not None:
            if type(locations) == list:
                locations = ','.join(locations)
            locations = locations.replace('\\', '')

        url = 'https://stream.twitter.com/1.1/statuses/filter.json'
        params = {
            "stall_warning": True,
            "include_ext_alt_text": True
        }
        if track:
            params["track"] = track
        if follow:
            params["follow"] = follow
        if locations:
            params["locations"] = locations
        headers = {'accept-encoding': 'deflate, gzip'}
        errors = 0
        while True:
            try:
                log.info("connecting to filter stream for %s", params)
                resp = self.post(url, params, headers=headers, stream=True)
                errors = 0
                for line in resp.iter_lines(chunk_size=1024):
                    if event and event.is_set():
                        log.info("stopping filter")
                        # Explicitly close response
                        resp.close()
                        return
                    if not line:
                        log.info("keep-alive")
                        if record_keepalive:
                            yield "keep-alive"
                        continue
                    try:
                        yield json.loads(line.decode())
                    except Exception as e:
                        log.error("json parse error: %s - %s", e, line)
            except requests.exceptions.HTTPError as e:
                errors += 1
                log.error("caught http error %s on %s try", e, errors)
                if self.http_errors and errors == self.http_errors:
                    log.warning("too many errors")
                    raise e
                if e.response.status_code == 420:
                    if interruptible_sleep(errors * 60, event):
                        log.info("stopping filter")
                        return
                else:
                    if interruptible_sleep(errors * 5, event):
                        log.info("stopping filter")
                        return
            except Exception as e:
                errors += 1
                log.error("caught exception %s on %s try", e, errors)
                if self.http_errors and errors == self.http_errors:
                    log.warning("too many exceptions")
                    raise e
                log.error(e)
                if interruptible_sleep(errors, event):
                    log.info("stopping filter")
                    return
252608
public static function filter($name, $handler)
    {
        if (! $handler instanceof \Closure and ! in_array(Filter::class, class_implements($handler), false)) {
            throw new \InvalidArgumentException("Failed adding Filter. Provided handler for [{$name}] is not valid. Must either provide a \\Closure or classpath that impelments \\Docit\\Docit\\Contracts\\Filter");
        }

        static::$filters[ $name ] = $handler;
    }
69117
def in_filter_get(self, address):
        

        func_name = 'neighbor.in_filter.get'
        param = {
            neighbors.IP_ADDRESS: address,
        }

        return call(func_name, **param)
198244
def filter(self, filter_fn):
        
        op = Operator(
            _generate_uuid(),
            OpType.Filter,
            "Filter",
            filter_fn,
            num_instances=self.env.config.parallelism)
        return self.__register(op)
44053
public String findFilter(String destination) {
        FindFilterEvent event = new FindFilterEvent();
        event.setDestination(destination);
        try {
            Object obj = delegate.callManager(event);
            if (obj != null && obj instanceof String) {
                return (String) obj;
            } else {
                throw new CanalException("No Such Canal by [" + destination + "]");
            }
        } catch (Exception e) {
            throw new CanalException("call_manager_error", e);
        }
    }
783022
def get_filter_rule(self, _filter, way='in'):
        
        if isinstance(_filter, zobjects.FilterRule):
            _filter = _filter.name
        for f in self.get_filter_rules(way=way):
            if f.name == _filter:
                return f
        return None
815624
def get_filter(self, name=constants.STRING_FILTER):
        
        try:
            filter_key = c_uamqp.symbol_value(name)
            return self._address.filter_set[filter_key].value
        except (TypeError, KeyError):
            return None
119673
def applyFilters(self, endpoint):
        """"""
        for filter_function in self.filter_functions:
            e = filter_function(endpoint)
            if e is not None:
                # Once one of the filters has returned an
                # endpoint, do not apply any more.
                return e

        return None