Return a new Options object that is filtered by the specified
        list of keys. Mutating self.kwargs to filter is unsafe due to
        the option expansion that occurs on initialization.
4457
def filtered(self, allowed):
        
        kws = {k:v for k,v in self.kwargs.items() if k in allowed}
        return self.__class__(key=self.key,
                              allowed_keywords=self.allowed_keywords,
                              merge_keywords=self.merge_keywords, **kws)
730858
function Filter(opts) {
  this.model = opts.model

  this.filteredKeys = isPlainObject(opts.filteredKeys)
    ? {
        private: opts.filteredKeys.private || [],
        protected: opts.filteredKeys.protected || []
      }
    : {
        private: [],
        protected: []
      }

  if (this.model && this.model.discriminators && isPlainObject(opts.excludedMap)) {
    for (const modelName in this.model.discriminators) {
      if (opts.excludedMap[modelName]) {
        this.filteredKeys.private = this.filteredKeys.private.concat(opts.excludedMap[modelName].private)
        this.filteredKeys.protected = this.filteredKeys.protected.concat(opts.excludedMap[modelName].protected)
      }
    }
  }
}
755901
def queue_once_key(name, kwargs, restrict_to=None):
    
    keys = ['qo', force_string(name)]
    # Restrict to only the keys allowed in keys.
    if restrict_to is not None:
        restrict_kwargs = {key: kwargs[key] for key in restrict_to}
        keys += kwargs_to_list(restrict_kwargs)
    else:
        keys += kwargs_to_list(kwargs)
    key = "_".join(keys)
    return key
232592
def _replace_scalars_in_kwargs(self, kwargs):
        
        _check_type('kwargs', kwargs, dict)

        new_kwargs = {}
        for (name, value) in iteritems(kwargs):
            if isinstance(value, list):
                new_kwargs[name] = self._replace_scalars_in_args(value)
            elif isinstance(value, dict):
                new_kwargs[name] = self._replace_scalars_in_kwargs(value)
            elif isinstance(value, string_types):
                new_kwargs[name] = self._replace_scalar(value)
            else:
                new_kwargs[name] = value
        return new_kwargs
582570
def filter_params(params):
    
    if params is not None:
        new_params = copy.deepcopy(params)
        new_params = dict((k, v) for k, v in new_params.items() if v is not None)
        for key, value in new_params.items():
            if isinstance(value, bool):
                new_params[key] = "true" if value else "false"
        return new_params
746872
public Dict filter(String... keys) {
		final Dict result = new Dict(keys.length, 1);

		for (String key : keys) {
			if (this.containsKey(key)) {
				result.put(key, this.get(key));
			}
		}
		return result;
	}
911277
def []=(key, val)
      supported_option?(key) || raise(UnsupportedOptionError, key.inspect)
      values[key] = val
    end
222365
def copy(input, **params):
    
    PARAM_FIELDS = 'fields'

    def filter_fields(obj, fields):
        return {k:v for k,v in obj.items() if k in fields}

    if PARAM_FIELDS in params:
        fields = params.get(PARAM_FIELDS)
        if isinstance(input, list):
            res = []
            for row in input:
                res.append(filter_fields(row, fields))
            return res
        elif isinstance(input, dict):
            return filter_fields(input, fields)
        else:
            raise NotImplementedError('{} is not supported'.format(type(input)))
    else:
        return input
276658
function filterByKeys(keys, values) {
  var filtered = {};

  forEach(keys, function (name) {
    filtered[name] = values[name];
  });
  return filtered;
}
74419
def _get_option(target_obj, key):
    
    getter_name = 'get_{key}'.format(**locals())
    by_attribute = functools.partial(getattr, target_obj, key)
    getter = getattr(target_obj, getter_name, by_attribute)
    return getter()
1234963
def _filter_kwargs(self, keep_list, **kwargs):
        ''' 
        '''
        new_kwargs = {}
        for argName, argVal in kwargs.items():
            if argName.lower() in keep_list:
                new_kwargs[argName.lower()] = argVal
        return new_kwargs
461815
def get_filter(self, **filter_kwargs):
        

        q_objects = super(ListView, self).get_filter(**filter_kwargs)
        form = self.get_filter_form()
        if form:
            q_objects.extend(form.get_filter())

        return q_objects
229041
def _filter_keys(d: dict, keys: set) -> dict:
        
        return {key: d[key] for key in keys if key in d}
1354762
def slice(*keys, **options)
      return super if options.include?(:raw)
      new_expires = expires_at(options, nil)
      options = Utils.without(options, :expires)

      with_updates(options) do |updates|
        @adapter.slice(*keys, **options).map do |key, entry|
          entry = invalidate_entry(key, entry, new_expires) do |new_entry|
            updates[key] = new_entry
          end
          next if entry.nil?
          value, _ = entry
          [key, value]
        end.reject(&:nil?)
      end
    end
1179768
def filter_by(self, **kwargs):
        
        ret = self.__class__(
            columns=self.columns, row_columns=self.row_columns, tab=self.tab,
            key_on=self.key_on)
        for row in self:
            if False not in [row[k] == v for k, v in kwargs.items()]:
                ret.append(row)
        return ret
583245
def extend(self, *args, **kwargs):
        """"""
        if len(args) > 1:
            raise TypeError('expected at most 1 arguments, got %d' % len(args))

        iterable = args[0] if args else None
        if iterable:
            if isinstance(iterable, Mapping) or hasattr(iterable, 'items'):
                for key, value in iterable.items():
                    self.append(key, value)
            elif hasattr(iterable, 'keys'):
                for key in iterable.keys():
                    self.append(key, iterable[key])
            else:
                for key, value in iterable:
                    self.append(key, value)

        for key, value in kwargs.items():
            self.append(key, value)
139369
def kwinsert_mk(clas,pool_or_cursor,**kwargs):
    ""
    if 'returning' in kwargs: raise ValueError("don't call kwinsert_mk with 'returning'")
    return set_options(
      pool_or_cursor,
      clas(*clas.kwinsert(pool_or_cursor,returning='*',**kwargs))
    )