ATLAS Offline Software
Loading...
Searching...
No Matches
JetMonitoringConfig.ConfigDict Class Reference
Inheritance diagram for JetMonitoringConfig.ConfigDict:
Collaboration diagram for JetMonitoringConfig.ConfigDict:

Public Member Functions

 __init__ (self, **kwargs)
 __getattr__ (self, attr)
 __setattr__ (self, attr, value)
 __setitem__ (self, attr, value)
 clone (self, **kwargs)
 dump (self, out=None)

Protected Member Functions

 _dump (self, writeFunc)

Detailed Description

A python dictionary extended so that each entry in the dict can also be accessed as 
   member attribute.  
Ex: 
   d = ConfigDict(aKey = 4)
   d.aKey # --> == 4 is the same as d["aKey"]
   d.bKey = 12 # now d["bKey"] is existing and set to 12      

all other usual methods of dictionary are working as expected.    

Definition at line 33 of file JetMonitoringConfig.py.

Constructor & Destructor Documentation

◆ __init__()

JetMonitoringConfig.ConfigDict.__init__ ( self,
** kwargs )

Definition at line 43 of file JetMonitoringConfig.py.

43 def __init__(self, **kwargs):
44 dict.__init__(self, **kwargs)
45 for k,v in kwargs.items():
46 dict.__setattr__(self, k, v)

Member Function Documentation

◆ __getattr__()

JetMonitoringConfig.ConfigDict.__getattr__ ( self,
attr )

Definition at line 47 of file JetMonitoringConfig.py.

47 def __getattr__(self, attr):
48 try:
49 return self[attr]
50 except KeyError:
51 dict.__getattribute__(self,attr)
52 #raise AttributeError(attr)
53

◆ __setattr__()

JetMonitoringConfig.ConfigDict.__setattr__ ( self,
attr,
value )

Definition at line 54 of file JetMonitoringConfig.py.

54 def __setattr__(self, attr, value):
55 if attr in ['keys', 'clear', 'update', 'pop', 'iteritems', 'values','setdefault','get','has_key','copy']:
56 print('ConfigDict ERROR can not assign attribute ', attr)
57 return
58 dict.__setitem__(self, attr, value)
59 dict.__setattr__(self, attr, value)
void print(char *figname, TCanvas *c1)

◆ __setitem__()

JetMonitoringConfig.ConfigDict.__setitem__ ( self,
attr,
value )

Definition at line 60 of file JetMonitoringConfig.py.

60 def __setitem__(self, attr, value):
61 if attr in ['keys', 'clear', 'update', 'pop', 'iteritems', 'values','setdefault','get','has_key','copy']:
62 print('ConfigDict ERROR can not assign attribute ', attr)
63 return
64 dict.__setitem__(self, attr, value)
65 dict.__setattr__(self, attr, value)
66
67

◆ _dump()

JetMonitoringConfig.ConfigDict._dump ( self,
writeFunc )
protected

Reimplemented in JetMonitoringConfig.HistoSpec, JetMonitoringConfig.JetMonAlgSpec, JetMonitoringConfig.SelectSpec, and JetMonitoringConfig.VarSpec.

Definition at line 85 of file JetMonitoringConfig.py.

85 def _dump(self, writeFunc):
86 def write(s, e='\n'): writeFunc(' '+s,e)
87 writeFunc(self.__class__.__name__+'(')
88 for k,v in sorted(self.items()):
89 if isinstance(v, ConfigDict):
90 write(k+' = ','')
91 v._dump(write)
92 else:
93 write(k+' = '+str(v))
94 writeFunc(')')
95
96
97
98
99# **********************************************************
100# **********************************************************
101# Helper functions
102# **********************************************************
103
104

◆ clone()

JetMonitoringConfig.ConfigDict.clone ( self,
** kwargs )

Reimplemented in JetMonitoringConfig.HistoSpec, and JetMonitoringConfig.ToolSpec.

Definition at line 68 of file JetMonitoringConfig.py.

68 def clone(self, **kwargs):
69 from copy import deepcopy
70 c = deepcopy(self)
71 for k,v in kwargs.items():
72 setattr(c,k,v)
73 return c
74
75

◆ dump()

JetMonitoringConfig.ConfigDict.dump ( self,
out = None )
prints the content of this dict on stdout (default) or in the file 'out' 

Definition at line 76 of file JetMonitoringConfig.py.

76 def dump(self, out=None):
77 """ prints the content of this dict on stdout (default) or in the file 'out' """
78 if out is None :
79 from sys import stdout
80 out = stdout
81 _write = out.write
82 def write(s, e='\n'): _write(s+e)
83 self._dump(write)
84
-event-from-file

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