This will return the filter key/value pairs as Black Duck expects them: [key1:value1,key1:value2,key2:value3] etc
504525
public List<String> getFilterParameters() {
        final List<String> parameters = new ArrayList<>();
        filterKeysToValues.forEach((filterKey, filterValues) -> {
            filterValues.forEach(filterValue -> {
                final String parameterString = String.format("%s:%s", filterKey, filterValue);
                parameters.add(parameterString);
            });
        });

        return parameters;
    }
332314
def _filter_cache(self, dmap, kdims):
        
        filtered = []
        for key, value in dmap.data.items():
            if not any(kd.values and v not in kd.values for kd, v in zip(kdims, key)):
                filtered.append((key, value))
        return filtered
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
605100
def _get_by(key, val, l):
    
    return [x for x in l if _check_value_recursively(key, val, x)]
545668
def _Q_to_filter(self, q):
        
        default_filter = ANDFilter
        if q.connector == "OR":
            default_filter = ORFilter
        filters = []
        for child in q.children:
            if isinstance(child, Q):
                if child.children:
                    filters.append(self._Q_to_filter(child))
            elif isinstance(child, tuple):
                field, value = child
                filters.append(self._build_inner_filter(field, value))
        if len(filters) == 1:
            filter = filters[0]
            if q.negated:
                return NotFilter(filter)
            return filter
        if q.negated:
            return NotFilter(default_filter(filters))
        return default_filter(filters)
500214
@Override
    public List values(CacheKeyFilter filter) throws IOException {
	if (CacheUtil.allowAll(filter)) return values();

	List<String> keys = keys();

	List<Object> list = new ArrayList<Object>();
	Iterator<String> it = keys.iterator();
	String key;
	while (it.hasNext()) {
	    key = it.next();
	    if (filter.accept(key)) {
		CacheEntry ce = getQuiet(key, null);
		if (ce != null) // possible that the entry is gone since keys(); call above
		    list.add(ce.getValue());
	    }
	}
	return list;
    }
303450
def get_filtered_keys(self, suffix, *args, **kwargs):
        

        accepted_key_types = kwargs.get('accepted_key_types', None)

        if accepted_key_types and 'set' not in accepted_key_types:
            raise ImplementationError(
                '%s can only return keys of type "set"' % self.__class__.__name__
            )

        # special "in" case: we get n keys and make an unionstore with them then return this key
        if suffix == 'in':

            args = list(args)
            values = set(args.pop())

            if not values:
                return []  # no keys

            in_keys = [
                self.get_storage_key(transform_value=False, *(args+[value]))
                for value in values
            ]

            tmp_key = unique_key(self.connection)
            self.connection.sunionstore(tmp_key, *in_keys)

            return [(tmp_key, 'set', True)]

        # do not transform because we already have the value we want to look for
        return [(self.get_storage_key(transform_value=False, *args), 'set', False)]
224347
def list(filter = nil)
      @backend.transaction(true){
        result = @backend[:user].keys.collect{|k| decrypt(k)}

        if filter.blank?
          result
        else
          result.select{|k,v| k =~ /#{filter}/}
        end
      }
    end
858296
public static <R> Set<R> filterAndListKeys(Iterator<R> keys, KeyFilter<R> filter) {
        Set<R> ret = new HashSet<R>();
        while (keys.hasNext()) {
            R key = keys.next();
            R filtered = filter.filter(key);
            if (filtered != null) {
                ret.add(filtered);
            }
        }
        return ret;
    }
970853
def get_values(self, data, filter_values):
        
        values = super(ModelTermsFacet, self).get_values(data, filter_values)
        ids = [key for (key, doc_count, selected) in values]
        # Perform a model resolution: models are feched from DB
        # We use model field to cast IDs
        ids = [self.model_field.to_mongo(id) for id in ids]
        objects = self.model.objects.in_bulk(ids)

        return [
            (objects.get(self.model_field.to_mongo(key)), doc_count, selected)
            for (key, doc_count, selected) in values
        ]
1005206
def get_pks_for_filter(self, key, filter_type, value):
        
        start, end, __ = self.get_boundaries(filter_type, value)  # we have nothing to exclude
        return self.connection.zrangebyscore(key, start, end)
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
1013697
def filter_out_none_valued_keys(self, d):
        # type: (typing.Dict[K, V]) -> typing.Dict[K, V]
        """"""
        new_d = {}
        for k, v in d.items():
            if v is not None:
                new_d[k] = v
        return new_d
1211102
def map_query_filters(filters)
      Hash[filters.map do |key, value|
        case value
        when Hash then
          if value.key? :any then format_query_filter('$in', key, value[:any])
          elsif value.key? :all then format_query_filter('$all', key, value[:all])
          else raise UnknownFilterQueryOperator, value.keys.join(','), caller end
        else format_query_filter('$all', key, value)
        end
      end]
    end
279385
def get_key_value_pairs(self, subsystem, filename):
        
        assert subsystem in self
        return util.read_key_value_pairs_from_file(self.per_subsystem[subsystem], subsystem + '.' + filename)
166016
def keys(self):
        """"""
        result = []
        if self.fresh_index is not None:
            result += self.fresh_index.keys()
        if self.opt_index is not None:
            result += self.opt_index.keys()
        return result
302166
def filter!(keys, params, options={:recursive => true})  # :nodoc:
      case params
      when Hash, ParamsHash
        params.keys.each do |k, v|
          unless (keys.include?(k) or Github::Validations::VALID_API_KEYS.include?(k))
            params.delete(k)
          else
            filter!(keys, params[k]) if options[:recursive]
          end
        end
      when Array
        params.map! do |el|
          filter!(keys, el) if options[:recursive]
        end
      else
        params
      end
      return params
    end