Return a copy of the dictionary's list of ``(key, value)`` pairs.
763258
def items(self):
        ''''''
        return [(self.keys[x], self.values[x]) for x in range(len(self.keys))]
913145
def as_dict(self):
        """"""

        d = {}
        for key, value in self:
            d.setdefault(key, []).append(value)
        return d
605100
def _get_by(key, val, l):
    
    return [x for x in l if _check_value_recursively(key, val, x)]
674462
def get_name2value_dict(self):
        """"""
        x = {}
        for val, num in self._values:
            x[val] = num
        return x
635680
def save_list(key, *values):
    
    return json.dumps({key: [_get_json(value) for value in values]})
262646
def keys_with_value(dictionary, value):
        ""

        subset = [key for key in dictionary if dictionary[key] == value]

        return subset
431278
def getall(self, key, type=None):
        
        values = []
        for k, v in self._items:
            if k == key:
                if type is not None:
                    try:
                        values.append(type(v))
                    except ValueError:
                        pass
                else:
                    values.append(v)
        return values
899626
def as_dict(self):
        
        out = dict({})
        for key in self.keys():
            if self._has_delimiter(key):
                pk, ck = key.split(self._delimiter, 1)
                if self._has_delimiter(ck):
                    ck = ck.split(self._delimiter, 1)[0]
                if isinstance(self._values[pk], FlatDict) and pk not in out:
                    out[pk] = dict()
                if isinstance(self._values[pk][ck], FlatDict):
                    out[pk][ck] = self._values[pk][ck].as_dict()
                else:
                    out[pk][ck] = self._values[pk][ck]
            else:
                out[key] = self._values[key]
        return out
466635
def key_list(items=None):
    '''
    
    '''
    if items is None:
        items = []

    ret = {}
    if items and isinstance(items, list):
        for item in items:
            if 'name' in item:
                # added for consistency with old code
                if 'id' not in item:
                    item['id'] = item['name']
                ret[item['name']] = item
    return ret
411772
def pickle_dict(items):
    '''
    '''
    ret = {}
    pickled_keys = []
    for key, val in items.items():
        if isinstance(val, basestring):
            ret[key] = val
        else:
            pickled_keys.append(key)
            ret[key] = pickle.dumps(val)
    if pickled_keys:
        ret['_pickled'] = ','.join(pickled_keys)
    return ret
1075016
def as_dict(self):
        """"""
        def conv(v):
            if isinstance(v, SerializableAttributesHolder):
                return v.as_dict()
            elif isinstance(v, list):
                return [conv(x) for x in v]
            elif isinstance(v, dict):
                return {x:conv(y) for (x,y) in v.items()}
            else:
                return v
        return {k.replace('_', '-'): conv(v) for (k, v) in self._attributes.items()}
598065
def fromkeys (cls, iterable, value=None):
        """"""
        d = cls()
        for k in iterable:
            dict.__setitem__(d, k.lower(), value)
        return d
776625
def dict_map(f, primitive, dic):
    """"""

    if primitive(dic):
        return f(dic)
    if isinstance(dic, Mapping):
        return {dict_map(f, primitive, key): dict_map(f, primitive, value)
                for key, value in dic.items()}
    if isinstance(dic, str):
        return dic
    if isinstance(dic, Sequence):
        return [dict_map(f, primitive, value) for value in dic]
    return dic
572265
def valuesToDict(key):
    """"""
    d = {}
    size = _winreg.QueryInfoKey(key)[1]
    for i in xrange(size):
        d[_winreg.EnumValue(key, i)[0]] = _winreg.EnumValue(key, i)[1]
    return d
153216
def list_to_compare_dict(self, list_form):
        """"""
        compare_dict = {}
        for field in list_form:
            if field['name'] in compare_dict:
                self.pr_dbg("List has duplicate field %s:\n%s" %
                            (field['name'], compare_dict[field['name']]))
                if compare_dict[field['name']] != field:
                    self.pr_dbg("And values are different:\n%s" % field)
                return None
            compare_dict[field['name']] = field
            for ign_f in self.mappings_ignore:
                compare_dict[field['name']][ign_f] = 0
        return compare_dict
651892
def fromkeys(cls, iterable, value, **kwargs):
        
        return cls(((k, value) for k in iterable), **kwargs)
1332354
def values(self, key=_absent):
        
        if key is not _absent and key in self._map:
            return self.getlist(key)
        return list(self.itervalues())