CMS 3D CMS Logo

Public Member Functions | Static Public Attributes | Properties | Private Member Functions | Private Attributes | Static Private Attributes

frozendict::frozendict Class Reference

List of all members.

Public Member Functions

def __hash__
def __init__
def __new__
def __repr__

Static Public Attributes

 pop = popitemsetdefaultupdate_blocked_attribute

Properties

 _blocked_attribute = property(_blocked_attribute)

Private Member Functions

def _blocked_attribute

Private Attributes

 _cached_hash

Static Private Attributes

 __delitem__ = __setitem__clear_blocked_attribute

Detailed Description

Definition at line 5 of file frozendict.py.


Constructor & Destructor Documentation

def frozendict::frozendict::__init__ (   self,
  args,
  kw 
)

Definition at line 38 of file frozendict.py.

00039                                    :
00040         pass


Member Function Documentation

def frozendict::frozendict::__hash__ (   self)

Definition at line 41 of file frozendict.py.

00042                       :
00043         try:
00044             return self._cached_hash
00045         except AttributeError:
00046             h = self._cached_hash = hash(frozenset(self.items()))
00047             return h

def frozendict::frozendict::__new__ (   cls,
  args,
  kw 
)

Definition at line 13 of file frozendict.py.

00014                                  :
00015         new = dict.__new__(cls)
00016 
00017         args_ = []
00018         for arg in args:
00019             if isinstance(arg, dict):
00020                 arg = copy.copy(arg)
00021                 for k, v in arg.items():
00022                     if isinstance(v, dict):
00023                         arg[k] = frozendict(v)
00024                     elif isinstance(v, list):
00025                         v_ = list()
00026                         for elm in v:
00027                             if isinstance(elm, dict):
00028                                 v_.append( frozendict(elm) )
00029                             else:
00030                                 v_.append( elm )
00031                         arg[k] = tuple(v_)
00032                 args_.append( arg )
00033             else:
00034                 args_.append( arg )
00035 
00036         dict.__init__(new, *args_, **kw)
00037         return new

def frozendict::frozendict::__repr__ (   self)

Definition at line 48 of file frozendict.py.

00049                       :
00050         return "frozendict(%s)" % dict.__repr__(self)
00051 
def frozendict::frozendict::_blocked_attribute (   obj) [private]

Definition at line 6 of file frozendict.py.

00007                                :
        raise AttributeError, "A frozendict cannot be modified."

Member Data Documentation

frozendict::frozendict::__delitem__ = __setitem__clear_blocked_attribute [static, private]

Definition at line 10 of file frozendict.py.

Definition at line 41 of file frozendict.py.

frozendict::frozendict::pop = popitemsetdefaultupdate_blocked_attribute [static]

Definition at line 11 of file frozendict.py.


Property Documentation

frozendict::frozendict::_blocked_attribute = property(_blocked_attribute) [static, private]

Definition at line 8 of file frozendict.py.