cpython-withatomic / Lib /

"""A more or less complete user-defined wrapper around dictionary objects."""

class UserDict:
    def __init__(self, dict=None): = {}
        if dict is not None: self.update(dict)
    def __repr__(self): return repr(
    def __cmp__(self, dict):
        if isinstance(dict, UserDict):
            return cmp(,
            return cmp(, dict)
    def __len__(self): return len(
    def __getitem__(self, key): return[key]
    def __setitem__(self, key, item):[key] = item
    def __delitem__(self, key): del[key]
    def clear(self):
    def copy(self):
        if self.__class__ is UserDict:
            return UserDict(
        import copy
        data =
   = {}
            c = copy.copy(self)
   = data
        return c
    def keys(self): return
    def items(self): return
    def iteritems(self): return
    def iterkeys(self): return
    def itervalues(self): return
    def values(self): return
    def has_key(self, key): return
    def update(self, dict):
        if isinstance(dict, UserDict):
        elif isinstance(dict, type(
            for k, v in dict.items():
                self[k] = v
    def get(self, key, failobj=None):
        if not self.has_key(key):
            return failobj
        return self[key]
    def setdefault(self, key, failobj=None):
        if not self.has_key(key):
            self[key] = failobj
        return self[key]
    def popitem(self):
    def __contains__(self, key):
        return key in

class IterableUserDict(UserDict):
    def __iter__(self):
        return iter(
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.