◆ __init__()
def python.utils.TreeDict.__init__ |
( |
|
self, |
|
|
|
dic = {} , |
|
|
|
key_wrapper = None |
|
) |
| |
◆ __missing__()
def python.utils.TreeDict.__missing__ |
( |
|
self, |
|
|
|
key, |
|
|
|
wrap = True |
|
) |
| |
Definition at line 27 of file Reconstruction/RecExample/RecExOnline/python/utils.py.
27 def __missing__(self, key, wrap=True):
28 if self.default_factory
is None:
raise KeyError((key,))
29 if wrap
and self.key_wrapper:
30 key = self.key_wrapper(key)
32 return self.__missing__(key[0], wrap=
False)
34 return self[key[0]][key[1]]
35 self[key] = value = self.default_factory()
◆ __repr__()
def python.utils.TreeDict.__repr__ |
( |
|
self, |
|
|
|
level = 0 |
|
) |
| |
Definition at line 48 of file Reconstruction/RecExample/RecExOnline/python/utils.py.
48 def __repr__(self, level=0):
50 items =
list(self.items())
52 for i, (key, val)
in enumerate(items):
53 LS = BRANCH
if i < len(items)-1
else TAIL
54 ret += SPACE(
' '*len_key)*level + LS(key.ljust(len_key)) +
'\n'
55 if isinstance(val, TreeDict):
56 ret += val.__repr__(level+1)
58 ret += SPACE(
' '*len_key)*(level+1) + LS(
str(val).ljust(len_key)) +
'\n'
◆ __setitem__()
def python.utils.TreeDict.__setitem__ |
( |
|
self, |
|
|
|
key, |
|
|
|
value, |
|
|
|
wrap = True |
|
) |
| |
◆ _repr_pretty_()
def python.utils.TreeDict._repr_pretty_ |
( |
|
self, |
|
|
|
p, |
|
|
|
cycle |
|
) |
| |
|
private |
◆ to_dict()
def python.utils.TreeDict.to_dict |
( |
|
self | ) |
|
◆ default_factory
python.utils.TreeDict.default_factory |
◆ key_wrapper
python.utils.TreeDict.key_wrapper |
The documentation for this class was generated from the following file: