Implementation of tojson filter (only present in Jinja 2.9 and later). If
    Jinja 2.9 or later is installed, then the upstream version of this filter
    will be used.
486824
def tojson(val, indent=None):
    '''
    
    '''
    options = {'ensure_ascii': True}
    if indent is not None:
        options['indent'] = indent
    return (
        salt.utils.json.dumps(
            val, **options
        ).replace('<', '\\u003c')
         .replace('>', '\\u003e')
         .replace('&', '\\u0026')
         .replace("'", '\\u0027')
    )
650177
def configure_filters(app):
    

    for (name, filter) in _filters.iteritems():
        app.jinja_env.filters[name] = filter
396497
def allow_filtering(self):
        
        clone = copy.deepcopy(self)
        clone._allow_filtering = True
        return clone
592642
def element_info_as_json_with_filter(name, _filter):
    
    if name and _filter:
        element = fetch_meta_by_name(name, filter_context=_filter)
        if element.json:
            return element.json
145664
def dicts_filter(dicts_object, field_to_filter, value_of_filter):
    
    lambda_query = lambda value: value[field_to_filter] == value_of_filter

    filtered_coin = filter(lambda_query, dicts_object)
    selected_coins = list(filtered_coin)
    #if not selected_coin: #Empty list, no coin found
    #    raise AttributeError('attribute %s not found' % attr)
    return selected_coins
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;
  }
538029
def build_annotation_dict_any_filter(annotations: Mapping[str, Iterable[str]]) -> EdgePredicate:
    
    if not annotations:
        return keep_edge_permissive

    @edge_predicate
    def annotation_dict_any_filter(edge_data: EdgeData) -> bool:
        """Check if the any of the annotations in the enclosed query match."""
        return _annotation_dict_any_filter(edge_data, query=annotations)

    return annotation_dict_any_filter
676693
def dict_filter(*args, **kwargs):
    
    result = {}
    for arg in itertools.chain(args, (kwargs,)):
        dict_filter_update(result, arg)
    return result
781354
public boolean isBloomFilteringSupported() {
        if (clientVersion >= params.getProtocolVersionNum(NetworkParameters.ProtocolVersion.BLOOM_FILTER)
                && clientVersion < params.getProtocolVersionNum(NetworkParameters.ProtocolVersion.BLOOM_FILTER_BIP111))
            return true;
        if ((localServices & NODE_BLOOM) == NODE_BLOOM)
            return true;
        return false;
    }
609038
def clean_filters(filters: Mapping = None) -> str:
    

    if filters and isinstance(filters, dict):
        for k, v in filters.items():
            if not isinstance(v, list):
                v = [v]
            filters[k] = v

    return json.dumps(filters)
945498
def get_repository_filter(perceval_backend, perceval_backend_name,
                          term=False):
    
    from .github import GITHUB

    filter_ = {}

    if not perceval_backend:
        return filter_

    field = 'origin'
    value = perceval_backend.origin

    if perceval_backend_name in ["meetup", "nntp", "stackexchange", "jira"]:
        # Until tag is supported in all raw and enriched indexes
        # we should use origin. But stackexchange and meetup won't work with origin
        # because the tag must be included in the filter.
        # For nntp we have a common group server as origin, so we need to use also the tag.
        # And in jira we can filter by product, and the origin is the same jira server.
        field = 'tag'
        value = perceval_backend.tag

    if perceval_backend:
        if not term:
            filter_ = {"name": field,
                       "value": value}
        else:
            filter_ = '''
                {"term":
                    { "%s" : "%s"  }
                }
            ''' % (field, value)
            # Filters are always a dict
            filter_ = json.loads(filter_)

    if value in ['', GITHUB + '/', 'https://meetup.com/']:
        # Support for getting all items from a multiorigin index
        # In GitHub we receive GITHUB + '/', the site url without org and repo
        # In Meetup we receive https://meetup.com/ as the tag
        filter_ = {}

    return filter_
693382
def filter(name, callable=nil, &block)
      if block_given?
        transforms[name.to_sym] = block
      else
        transforms[name.to_sym] = callable
      end
    end
586080
def explicit_content_filter=(filter_level)
      filter_level = FILTER_LEVELS[filter_level] if filter_level.is_a?(Symbol)

      update_server_data(explicit_content_filter: filter_level)
    end
940403
def _validate_json_format(self, filter_value, schema_validation_type):
        
        ok = False
        try:
            validators.json_schema_validation_format(filter_value, schema_validation_type)
            ok = True
        except ValueError as e:
            pass
        return ok
1157853
def add_filter(filter = nil, &block)
      id = "#{filter.inspect}/#{block.inspect}".hash

      @filters[id] = if filter.kind_of?(Filter)
                       filter
                     elsif filter.kind_of?(String)
                       StringFilter.new(filter)
                     elsif filter.kind_of?(Regexp)
                       RegexpFilter.new(filter)
                     elsif block
                       BlockFilter.new(block)
                     else
                       raise ArgumentError, 'Please specify either a string, ' \
                         'filter, or block to filter source files with!'
                     end

      true
    end
624379
function getHbsCompatibleFilter (filterName) {
    var specialReturnValue = filterName === 'yavu' ? '\uFFFD' : '';
    return function filter (s) {
        // align with Handlebars preference to return '' when s is null/undefined, except in unquoted attr, '\uFFFD' is returned to avoid context breaking
        return s === null || s === undefined ? specialReturnValue : 
            // Unlike escapeExpression(), return s instead of s.toHTML() since downstream
            //  filters of the same chain has to be disabled too.
            //  Handlebars will invoke SafeString.toString() at last during data binding
            s.toHTML ? s : xssFilters._privFilters[filterName](s);
    };
}
1294359
def filter(self, **kwargs):
        
        readFilter = ReadFilter(**kwargs)
        self._filters.append(readFilter.filter)
        return self