Asterisk - The Open Source Telephony Project  18.5.0
Public Member Functions
MultiOrderedDict Class Reference
Inheritance diagram for MultiOrderedDict:
Inheritance graph
[legend]
Collaboration diagram for MultiOrderedDict:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, args, kwds)
 
def __setitem__ (self, key, val, i=None)
 
def copy (self)
 
def insert (self, i, key, val)
 
- Public Member Functions inherited from OrderedDict
def __delitem__ (self, key, dict_delitem=dict.__delitem__)
 
def __eq__ (self, other)
 
def __init__ (self, args, kwds)
 
def __iter__ (self)
 
def __ne__ (self, other)
 
def __reduce__ (self)
 
def __repr__ (self, _repr_running={})
 
def __reversed__ (self)
 
def __setitem__ (self, key, value, dict_setitem=dict.__setitem__)
 
def clear (self)
 
def copy (self)
 
def fromkeys (cls, iterable, value=None)
 
def items (self)
 
def iteritems (self)
 
def iterkeys (self)
 
def itervalues (self)
 
def keys (self)
 
def pop (self, key, default=__marker)
 
def popitem (self, last=True)
 
def setdefault (self, key, default=None)
 
def update (args, kwds)
 
def values (self)
 
def viewitems (self)
 
def viewkeys (self)
 
def viewvalues (self)
 

Detailed Description

Definition at line 266 of file astdicts.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  args,
  kwds 
)

Definition at line 267 of file astdicts.py.

267  def __init__(self, *args, **kwds):
268  OrderedDict.__init__(self, *args, **kwds)
269 

Member Function Documentation

◆ __setitem__()

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

Definition at line 270 of file astdicts.py.

References len().

270  def __setitem__(self, key, val, i=None):
271  if key not in self:
272 # print("__setitem__ key = " + key + " val = " + val)
273  OrderedDict.__setitem__(
274  self, key, val if isinstance(val, list) else [val])
275  return
276 # print("inserting key = " + key + " val = " + val)
277  vals = self[key]
278  if i is None:
279  i = len(vals)
280 
281  if not isinstance(val, list):
282  if val not in vals:
283  vals.insert(i, val)
284  else:
285  for j in val.reverse():
286  if j not in vals:
287  vals.insert(i, j)
288 
289 
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)

◆ copy()

def copy (   self)

Definition at line 293 of file astdicts.py.

References OrderedDict.iteritems().

293  def copy(self):
294  # TODO - find out why for some reason copies
295  # the [] as an [[]], so do manually
296  c = MultiOrderedDict() #self.__class__(self)
297  for key, val in self.iteritems():
298  for v in val:
299  c[key] = v
300  return c
301 
static int copy(char *infile, char *outfile)
Utility function to copy a file.

◆ insert()

def insert (   self,
  i,
  key,
  val 
)

Definition at line 290 of file astdicts.py.

References OrderedDict.__setitem__().

Referenced by Section.add_defaults(), and Section.add_templates().

290  def insert(self, i, key, val):
291  self.__setitem__(key, val, i)
292 

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