Converts friend filters to a string representation for transport.
19415
def _filterDictToStr(self, filterDict):
        
        values = []
        for key, vals in filterDict.items():
            if key not in ('contentRating', 'label'):
                raise BadRequest('Unknown filter key: %s', key)
            values.append('%s=%s' % (key, '%2C'.join(vals)))
        return '|'.join(values)
257545
function split(nodes, filters) {
    var result = {};
    var nNodes = nodes.length, nFilters = filters.length;
    var iNode = 0;
    for (var iFilter = 0; iFilter < nFilters; iFilter++) {
        var filter = filters[iFilter];
        var next = [];
        while (iNode < nNodes && nodes[iNode].type === filter.type) {
            next.push(nodes[iNode]);
            iNode++;
        }
        result[filter.name] = next;
    }
    return result;
}
252342
public static Map<String,Map<String, String>> parseFilter(String filter) {
        return parseFilter(filter, true, DEFAULT_FILTER_KEY);
    }
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
123971
def to_pb(self):
        
        chain = data_v2_pb2.RowFilter.Chain(
            filters=[row_filter.to_pb() for row_filter in self.filters]
        )
        return data_v2_pb2.RowFilter(chain=chain)
470589
def _parse_filter_string(filter_string):
    
    assert "=" in filter_string, "filter string requires an '=', got {0}".format(filter_string)
    split_values = filter_string.split('=')
    assert len(split_values) == 2, "more than one equals found in filter string {0}!".format(filter_string)
    return split_values
855927
private String urlEncodeFilters(final Map<String, List<String>> filters) throws DockerException {
    try {
      final String unencodedFilters = objectMapper().writeValueAsString(filters);
      if (!unencodedFilters.isEmpty()) {
        return urlEncode(unencodedFilters);
      }
    } catch (IOException e) {
      throw new DockerException(e);
    }
    return null;
  }
985812
def get_pks_for_filter(self, key, filter_type, value):
        
        start, end, exclude = self.get_boundaries(filter_type, value)
        members = self.connection.zrangebylex(key, start, end)
        if exclude is not None:
            # special case where we don't want the exact given value, but we cannot
            # exclude it from the sorted set directly
            return [
                member_pk
                for member_value, member_pk in
                [self._extract_value_from_storage(member) for member in members]
                if member_value != exclude
            ]
        else:
            return [self._extract_value_from_storage(member)[-1] for member in members]
1000532
def dfilter(fn, record):
    
    return dict([(k, v) for k, v in record.items() if fn(v)])
10012
def filter_data(self, data, values=None, args=None):
        """"""
        if args:
            if not args.rprotocol:
                return data
        if not values: values = args.rprotocol
        newdata = {}
        if 'parser' in data.keys():
            newdata['parser'] = data['parser']
            newdata['source_path'] = data['source_path']
            newdata['source_file'] = data['source_file']
            newdata['source_file_mtime'] = data['source_file_mtime']
            newdata['source_file_year'] = data['source_file_year']
        newdata['entries'] = []

        for entry in data['entries']:
            if 'protocol' in entry.keys():
                if entry['protocol'] not in values:
                    newdata['entries'].append(entry)
            else:
                newdata['entries'].append(entry)

        return newdata
147553
def _rec_filter_to_info(line):
    
    parts = line.rstrip().split("\t")
    move_filters = {"bSeq": "strand", "bPcr": "damage"}
    new_filters = []
    bias_info = []
    for f in parts[6].split(";"):
        if f in move_filters:
            bias_info.append(move_filters[f])
        elif f not in ["."]:
            new_filters.append(f)
    if bias_info:
        parts[7] += ";DKFZBias=%s" % ",".join(bias_info)
    parts[6] = ";".join(new_filters or ["PASS"])
    return "\t".join(parts) + "\n"
1365016
private String getStringPredicate(String fieldName, String filterValue, List<Object> prms)
    {
        if (filterValue == null)
        {
            return "";
        }
        return getStringPredicate(fieldName, Arrays.asList(filterValue), prms);
    }
1036867
function _fnConvert(filters) {
                var _iF, _lenF, _keysF,
                    _filter,
                    _state;

                // convert filter object to array filter
                if (angular.isObject(filters) && !angular.isArray(filters)) {
                    _keysF  = Object.keys(filters);
                    _lenF   = _keysF.length;
                    _filter = [];

                    if (_lenF > 0) {
                        for (_iF = 0; _iF < _lenF; _iF++) {

                            if (typeof filters[_keysF[_iF]] === 'string' && filters[_keysF[_iF]].length === 0) {
                                continue;
                            } else if (angular.isArray(filters[_keysF[_iF]])) {
                                _state = filters[_keysF[_iF]];
                            } else if (angular.isObject(filters[_keysF[_iF]])) {
                                _state = _fnConvert(filters[_keysF[_iF]]);
                            } else {
                                _state = {
                                    field:    _keysF[_iF],
                                    callback: filters[_keysF[_iF]]
                                };
                            }
                            _filter.push(_state);
                        }
                    }

                    return _filter;
                }
                else {
                    return filters;
                }
            }
1216416
Filter<S> parseRoot() {
        Filter<S> filter = parseFilter();
        int c = nextCharIgnoreWhitespace();
        if (c >= 0) {
            mPos--;
            throw error("Unexpected trailing characters");
        }
        return filter;
    }
1127536
def get_filtered_send(self, cmdargs, send, target):
        """"""
        parser = arguments.ArgParser(self.config)
        parser.add_argument('--filter')
        try:
            filterargs, remainder = parser.parse_known_args(cmdargs)
        except arguments.ArgumentException as ex:
            return str(ex), None
        cmdargs = ' '.join(remainder)
        if filterargs.filter is None:
            return cmdargs, send
        filter_list, output = textutils.append_filters(filterargs.filter)
        if filter_list is None:
            return output, None

        # define a new send to handle filter chaining
        def filtersend(msg, mtype='privmsg', target=target, ignore_length=False):
            self.send(target, self.connection.real_nickname, msg, mtype, ignore_length, filters=filter_list)

        return cmdargs, filtersend
1287003
function _getFilterIndex(filterSets, filter) {
        var index = -1;

        if (!filter || !filterSets.length) {
            return index;
        }

        return _.findIndex(filterSets, _.partial(_.isEqual, filter));
    }
1373304
def filter(self, filter):
        """"""
        if hasattr(filter, '__call__'):
            return [entry for entry in self.entries if filter(entry)]
        else:
            pattern = re.compile(filter, re.IGNORECASE)
            return [entry for entry in self.entries if pattern.match(entry)]