MultiOrderedDict Class Reference

Inheritance diagram for MultiOrderedDict:

Inheritance graph
[legend]
Collaboration diagram for MultiOrderedDict:

Collaboration graph
[legend]

Public Member Functions

def __init__
def __setitem__
def copy
def insert

Detailed Description

Definition at line 264 of file astdicts.py.


Member Function Documentation

def __init__ (   self,
  args,
  kwds 
)

Initialize an ordered dictionary.  Signature is the same as for
regular dictionaries, but keyword arguments are not recommended
because their insertion order is arbitrary.

Reimplemented from OrderedDict.

Reimplemented in Section.

Definition at line 265 of file astdicts.py.

00265                                      :
00266         OrderedDict.__init__(self, *args, **kwds)
00267 
    def __setitem__(self, key, val, i=None):

def __setitem__ (   self,
  key,
  val,
  i = None 
)

Reimplemented from OrderedDict.

Definition at line 268 of file astdicts.py.

00268                                            :
00269         if key not in self:
00270 #            print "__setitem__ key = ", key, " val = ", val
00271             OrderedDict.__setitem__(
00272                 self, key, val if isinstance(val, list) else [val])
00273             return
00274 #        print "inserting key = ", key, " val = ", val
00275         vals = self[key]
00276         if i is None:
00277             i = len(vals)
00278 
00279         if not isinstance(val, list):
00280             if val not in vals:
00281                 vals.insert(i, val)
00282         else:
00283             for j in val.reverse():
00284                 if j not in vals:
00285                     vals.insert(i, j)
00286 
00287 
    def insert(self, i, key, val):

def copy (   self  ) 

Reimplemented from OrderedDict.

Definition at line 291 of file astdicts.py.

00291                   :
00292         # TODO - find out why for some reason copies
00293         #        the [] as an [[]], so do manually
00294         c = MultiOrderedDict() #self.__class__(self)
00295         for key, val in self.iteritems():
00296             for v in val:
00297                 c[key] = v
00298         return c
        return c

def insert (   self,
  i,
  key,
  val 
)

Definition at line 288 of file astdicts.py.

00288                                  :
00289         self.__setitem__(key, val, i)
00290 
    def copy(self):


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

Generated on Thu Apr 16 06:41:37 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6