CMS 3D CMS Logo

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__ (self)
 
def __init__ (self, *args, **kw)
 
def __new__ (cls, *args, **kw)
 
def __repr__ (self)
 

Static Public Attributes

 clear
 
 pop
 
 popitem
 
 setdefault
 
 update
 

Properties

 _blocked_attribute = property(_blocked_attribute)
 

Private Member Functions

def _blocked_attribute (obj)
 

Private Attributes

 _cached_hash
 

Static Private Attributes

 __delitem__
 
 __setitem__
 

Detailed Description

Definition at line 5 of file frozendict.py.

Constructor & Destructor Documentation

◆ __init__()

def frozendict.frozendict.__init__ (   self,
args,
**  kw 
)

Definition at line 38 of file frozendict.py.

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

Member Function Documentation

◆ __hash__()

def frozendict.frozendict.__hash__ (   self)

Definition at line 41 of file frozendict.py.

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

◆ __new__()

def frozendict.frozendict.__new__ (   cls,
args,
**  kw 
)

Definition at line 13 of file frozendict.py.

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

Referenced by SequenceTypes._ModuleSequenceType.copyAndExclude().

◆ __repr__()

def frozendict.frozendict.__repr__ (   self)

Definition at line 48 of file frozendict.py.

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

◆ _blocked_attribute()

def frozendict.frozendict._blocked_attribute (   obj)
private

Definition at line 6 of file frozendict.py.

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

References frozendict.frozendict._blocked_attribute.

Member Data Documentation

◆ __delitem__

frozendict.frozendict.__delitem__
staticprivate

Definition at line 10 of file frozendict.py.

◆ __setitem__

frozendict.frozendict.__setitem__
staticprivate

Definition at line 10 of file frozendict.py.

◆ _cached_hash

frozendict.frozendict._cached_hash
private

Definition at line 45 of file frozendict.py.

◆ clear

frozendict.frozendict.clear
static

Definition at line 10 of file frozendict.py.

Referenced by BeautifulSoup.Tag.setString().

◆ pop

frozendict.frozendict.pop
static

Definition at line 11 of file frozendict.py.

Referenced by esMonitoring.LineHistoryEnd.write().

◆ popitem

frozendict.frozendict.popitem
static

Definition at line 11 of file frozendict.py.

◆ setdefault

frozendict.frozendict.setdefault
static

Definition at line 11 of file frozendict.py.

◆ update

frozendict.frozendict.update
static

Property Documentation

◆ _blocked_attribute

frozendict.frozendict._blocked_attribute = property(_blocked_attribute)
staticprivate

Definition at line 8 of file frozendict.py.

Referenced by frozendict.frozendict._blocked_attribute().

cond::hash
Definition: Time.h:19
frozendict
Definition: frozendict.py:1