CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Attributes | Properties | Private Member Functions | Private Attributes | Static Private Attributes
frozendict.frozendict Class Reference
Inheritance diagram for frozendict.frozendict:

Public Member Functions

def __hash__
 
def __init__
 
def __new__
 
def __repr__
 

Static Public Attributes

 pop = _blocked_attribute
 

Properties

 _blocked_attribute = property(_blocked_attribute)
 

Private Member Functions

def _blocked_attribute
 

Private Attributes

 _cached_hash
 

Static Private Attributes

 __delitem__ = _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.

38 
39  def __init__(self, *args, **kw):
40  pass

Member Function Documentation

def frozendict.frozendict.__hash__ (   self)

Definition at line 41 of file frozendict.py.

41 
42  def __hash__(self):
43  try:
44  return self._cached_hash
45  except AttributeError:
46  h = self._cached_hash = hash(frozenset(self.items()))
47  return h
def frozendict.frozendict.__new__ (   cls,
  args,
  kw 
)

Definition at line 13 of file frozendict.py.

Referenced by SequenceTypes._ModuleSequenceType.copyAndExclude().

13 
14  def __new__(cls, *args, **kw):
15  new = dict.__new__(cls)
16 
17  args_ = []
18  for arg in args:
19  if isinstance(arg, dict):
20  arg = copy.copy(arg)
21  for k, v in arg.items():
22  if isinstance(v, dict):
23  arg[k] = frozendict(v)
24  elif isinstance(v, list):
25  v_ = list()
26  for elm in v:
27  if isinstance(elm, dict):
28  v_.append( frozendict(elm) )
29  else:
30  v_.append( elm )
31  arg[k] = tuple(v_)
32  args_.append( arg )
33  else:
34  args_.append( arg )
35 
36  dict.__init__(new, *args_, **kw)
37  return new
def frozendict.frozendict.__repr__ (   self)

Definition at line 48 of file frozendict.py.

48 
49  def __repr__(self):
50  return "frozendict(%s)" % dict.__repr__(self)
51 
def frozendict.frozendict._blocked_attribute (   obj)
private

Definition at line 6 of file frozendict.py.

References frozendict.frozendict._blocked_attribute.

6 
7  def _blocked_attribute(obj):
raise AttributeError("A frozendict cannot be modified.")

Member Data Documentation

frozendict.frozendict.__delitem__ = _blocked_attribute
staticprivate

Definition at line 10 of file frozendict.py.

frozendict.frozendict._cached_hash
private

Definition at line 45 of file frozendict.py.

Referenced by frozendict.frozendict.__hash__().

frozendict.frozendict.pop = _blocked_attribute
static

Definition at line 11 of file frozendict.py.

Referenced by SequenceTypes.Schedule._replaceIfHeldDirectly(), and esMonitoring.LineHistoryEnd.write().

Property Documentation

frozendict.frozendict._blocked_attribute = property(_blocked_attribute)
staticprivate

Definition at line 8 of file frozendict.py.

Referenced by frozendict.frozendict._blocked_attribute().