Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Attributes
Archetypes.utils.OrderedDict Class Reference

List of all members.

Public Member Functions

def __init__
def __setitem__
def __delitem__
def clear
def keys
def items
def reverse
def values
def update
def copy
def setdefault
def popitem
def pop

Static Public Attributes

tuple security = ClassSecurityInfo()

Private Attributes

 _keys

Detailed Description

A wrapper around dictionary objects that provides an ordering for
   keys() and items().

Definition at line 668 of file utils.py.


Constructor & Destructor Documentation

def Archetypes.utils.OrderedDict.__init__ (   self,
  dict = None 
)

Definition at line 675 of file utils.py.

00675 
00676     def __init__(self, dict=None): 
00677         self._keys = []     
00678         BaseDict.__init__(self, dict)     
00679         if dict is not None:       
00680             self._keys = self.data.keys()


Member Function Documentation

def Archetypes.utils.OrderedDict.__delitem__ (   self,
  key 
)

Definition at line 686 of file utils.py.

00686 
00687     def __delitem__(self, key):
00688         BaseDict.__delitem__(self, key)
00689         self._keys.remove(key)

def Archetypes.utils.OrderedDict.__setitem__ (   self,
  key,
  item 
)

Definition at line 681 of file utils.py.

00681 
00682     def __setitem__(self, key, item):
00683         if not self.data.has_key(key):
00684             self._keys.append(key)
00685         return BaseDict.__setitem__(self, key, item)

Here is the caller graph for this function:

Definition at line 690 of file utils.py.

00690 
00691     def clear(self):
00692         BaseDict.clear(self)
00693         self._keys = []

Here is the caller graph for this function:

Definition at line 714 of file utils.py.

00714 
00715     def copy(self):
00716         if self.__class__ is OrderedDict:
00717             c = OrderedDict()
00718             for k, v in self.items():
00719                 c[k] = v
00720             return c
00721         import copy
00722         c = copy.copy(self)
00723         return c

Here is the call graph for this function:

Definition at line 697 of file utils.py.

00697 
00698     def items(self):
00699         return [(k, self.get(k)) for k in self._keys]

Here is the caller graph for this function:

Definition at line 694 of file utils.py.

00694 
00695     def keys(self):
00696         return self._keys

Here is the caller graph for this function:

def Archetypes.utils.OrderedDict.pop (   self,
  key 
)

Definition at line 737 of file utils.py.

00737 
00738     def pop(self, key):
00739         v = self.data.pop(key) # will raise KeyError if needed
00740         self._keys.remove(key)
00741         return v
00742 
00743 InitializeClass(OrderedDict)
00744 

Here is the caller graph for this function:

Definition at line 729 of file utils.py.

00729 
00730     def popitem(self):
00731         if not self.data:
00732             raise KeyError, 'dictionary is empty'
00733         k = self._keys.pop()
00734         v = self.data.get(k)
00735         del self.data[k]
00736         return (k, v)

Here is the call graph for this function:

Definition at line 700 of file utils.py.

00700 
00701     def reverse(self):
00702         items = list(self.items())
00703         items.reverse()
00704         return items

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.utils.OrderedDict.setdefault (   self,
  key,
  failobj = None 
)

Definition at line 724 of file utils.py.

00724 
00725     def setdefault(self, key, failobj=None):
00726         if not self.data.has_key(key):
00727             self._keys.append(key)
00728         return BaseDict.setdefault(self, key, failobj)

def Archetypes.utils.OrderedDict.update (   self,
  dict 
)

Definition at line 708 of file utils.py.

00708 
00709     def update(self, dict):
00710         for k in dict.keys():
00711             if not self.data.has_key(k):
00712                 self._keys.append(k)
00713         return BaseDict.update(self, dict)

Here is the caller graph for this function:

Definition at line 705 of file utils.py.

00705 
00706     def values(self):
00707         return [self.get(k) for k in self._keys]

Here is the caller graph for this function:


Member Data Documentation

Definition at line 676 of file utils.py.

tuple Archetypes.utils.OrderedDict.security = ClassSecurityInfo() [static]

Definition at line 672 of file utils.py.


The documentation for this class was generated from the following file: