0 -> Dict.forEach 1 -> Dict.map 2 -> Dict.filter 3 -> Dict.some 4 -> Dict.every 5 -> Dict.find 6 -> Dict.findKey 7 -> Dict.mapPairs
972207
function(TYPE){
  var IS_MAP   = TYPE == 1
    , IS_EVERY = TYPE == 4;
  return function(object, callbackfn, that /* = undefined */){
    var f      = ctx(callbackfn, that, 3)
      , O      = toIObject(object)
      , result = IS_MAP || TYPE == 7 || TYPE == 2
          ? new (typeof this == 'function' ? this : Dict) : undefined
      , key, val, res;
    for(key in O)if(has(O, key)){
      val = O[key];
      res = f(val, key, object);
      if(TYPE){
        if(IS_MAP)result[key] = res;            // map
        else if(res)switch(TYPE){
          case 2: result[key] = val; break;     // filter
          case 3: return true;                  // some
          case 5: return val;                   // find
          case 6: return key;                   // findKey
          case 7: result[res[0]] = res[1];      // mapPairs
        } else if(IS_EVERY)return false;        // every
      }
    }
    return TYPE == 3 || IS_EVERY ? IS_EVERY : result;
  };
}
919107
def clean_dict_keys(d):
    
    new_d = {}
    for (k, v) in d.iteritems():
        new_d[str(k)] = v
    return new_d
1079045
def many(cls, filter=None, **kwargs):
        """"""
        from mongoframes.queries import Condition, Group, to_refs

        # Flatten the projection
        kwargs['projection'], references, subs = \
                cls._flatten_projection(
                    kwargs.get('projection', cls._default_projection)
                    )

        # Find the documents
        if isinstance(filter, (Condition, Group)):
            filter = filter.to_dict()

        documents = list(cls.get_collection().find(to_refs(filter), **kwargs))

        # Dereference the documents (if required)
        if references:
            cls._dereference(documents, references)

        # Add sub-frames to the documents (if required)
        if subs:
            cls._apply_sub_frames(documents, subs)

        return [cls(d) for d in documents]
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
782463
def filter_data(data, filter_dict):
    
    for key, match_string in filter_dict.items():
        if key not in data:
            logger.warning("{0} doesn't match a top level key".format(key))
            continue
        values = data[key]
        matcher = re.compile(match_string)
        if isinstance(values, list):
            values = [v for v in values if matcher.search(v)]
        elif isinstance(values, dict):
            values = dict((k, v) for k, v in values.items() if matcher.search(k))
        else:
            raise MiuraException("cannot filter a {0}".format(type(values)))
        data[key] = values
1349348
def documents(cls, filter=None, **kwargs):
        
        documents = [cls(document) for document in cls.find(filter, **kwargs)]
        return [document for document in documents if document.document]
1019084
def _clean_dict(in_dict):
    
    out = {}
    for key, value in iteritems(in_dict):
        if isinstance(value, dict):
            value = _clean_dict(value)
        if value is None:
            continue
        out[key] = value
    return out
1101032
def _flatten_dict(self, dict_):
        
        flattened_dict = {}
        for (key, value) in dict_.iteritems():
            if isinstance(value, dict):
                flattened_dict.update(self._flatten_dict(value))
            else:
                flattened_dict[key] = value
        return flattened_dict
283589
function each(object, func, thisp) {
	return Object.keys(object).map(key => {
		return func.call(thisp, key, object[key]);
	});
}
912820
def ignore(mapping):
    
    if isinstance(mapping, Mapping):
        return AsDict(mapping)
    elif isinstance(mapping, list):
        return [ignore(item) for item in mapping]
    return mapping
8070
def filter(self, f):
        
        def func(iterator):
            return filter(f, iterator)
        return self.mapPartitions(func, True)
395736
def combine_dictionaries(dicts: List[Dict[str, Any]]) -> Dict[str, Any]:
    
    return dict(ChainMap(*dicts))
1026532
def compare(dicts):
    """"""

    common_members = {}
    common_keys = reduce(lambda x, y: x & y, map(dict.keys, dicts))
    for k in common_keys:
        common_members[k] = list(
            reduce(lambda x, y: x & y, [set(d[k]) for d in dicts]))

    return common_members
888797
def set_filters(self, filters):
        
        if not isinstance(filters, dict):
            raise Exception("filters must be a dict")
        self.filters = {}
        for key in filters.keys():
            value = filters[key]
            self.add_filter(key,value)
1057406
def each(&block)
      return @results.each(&block) if @results
      @results = []
      cur_v_i = Array.new(@data.keys.length, 0)
      keys = @data.keys.sort_by(&:to_s)
      result = {}
      keys.each do |key|
        result[key] = @data[key][0]
      end
      while true
        r = result.dup
        @results << r
        block.call(r) if block
        keys.each_with_index do |k, k_i|
          v_i = ((cur_v_i[k_i] = (1 + cur_v_i[k_i]) % @data[k].length))
          result[k] = @data[k][v_i]
          if v_i > 0 # Found next ?
            break
          elsif k_i == keys.length - 1 # Last?
            return
          end
        end
      end
      @results
    end
381016
def filter_by(lookup_dict,
              lookup,
              traverse,
              merge=None,
              default='default',
              base=None):
    '''
    
    '''
    ret = None
    # Default value would be an empty list if lookup not found
    val = traverse_dict_and_list(traverse, lookup, [])

    # Iterate over the list of values to match against patterns in the
    # lookup_dict keys
    for each in val if isinstance(val, list) else [val]:
        for key in lookup_dict:
            test_key = key if isinstance(key, six.string_types) \
                else six.text_type(key)
            test_each = each if isinstance(each, six.string_types) \
                else six.text_type(each)
            if fnmatch.fnmatchcase(test_each, test_key):
                ret = lookup_dict[key]
                break
        if ret is not None:
            break

    if ret is None:
        ret = lookup_dict.get(default, None)

    if base and base in lookup_dict:
        base_values = lookup_dict[base]
        if ret is None:
            ret = base_values

        elif isinstance(base_values, Mapping):
            if not isinstance(ret, Mapping):
                raise SaltException(
                    'filter_by default and look-up values must both be '
                    'dictionaries.')
            ret = salt.utils.dictupdate.update(copy.deepcopy(base_values), ret)

    if merge:
        if not isinstance(merge, Mapping):
            raise SaltException(
                'filter_by merge argument must be a dictionary.')

        if ret is None:
            ret = merge
        else:
            salt.utils.dictupdate.update(ret, copy.deepcopy(merge))

    return ret
348006
def dict2kvlist(o):
    '''
    
    '''
    return chain.from_iterable((k, v) for k, v in o.items())