![]() |
ATLAS Offline Software
|
Classes | |
| class | ldict |
| class | lproperty |
Functions | |
| make_lproperty (func) | |
| make_alias (prop) | |
| listClassLProperties (cls) | |
| onlyAttributesAreProperties (cls) | |
| clonable (cls) | |
| flattenDic (inD) | |
Variables | |
| bool | _locked |
| __bases__ | |
| _allowedattributes = listClassLProperties( cls ) | |
| bool | _nomoreattributes = False |
| __init__origin = cls.__init__ | |
| __init__ = initwraper | |
| __setattr__ = setattr | |
| clone = clone | |
| bool | isClonable = True |
This module defines utilities for the jet config. These are mainly to allow to "lock" the standard, reference definitions so they are not accidentally changed by some user scripts.
| python.Utilities.clonable | ( | cls | ) |
Transforms the input class cls by adding a clone() method. This clone() method returns a clone instance with a _locked attribute set to False by default (so the clone is modifiable)
Definition at line 114 of file Utilities.py.
| python.Utilities.flattenDic | ( | inD | ) |
returns a copy of the inD dictionnary with no nested directories. Instead the content of nested dict inside inD are indexed by keys constructed from nested keys :
{'A' : 3 , 'B' : { 'C':5, 'D': 6} } --> {'A' : 3 , 'B.C':5, 'B.D': 6}
This works only if nested dic have str keys.
This function is used mainly in trigger config
Definition at line 173 of file Utilities.py.
| python.Utilities.listClassLProperties | ( | cls | ) |
Definition at line 63 of file Utilities.py.
| python.Utilities.make_alias | ( | prop | ) |
Returns a property which act as a read-only alias to existing prop
Definition at line 55 of file Utilities.py.
| python.Utilities.make_lproperty | ( | func | ) |
creates a property from a class method (or a str) which can be locked if the holding class has its _locked attribute set to True
usage :
class A:
# simple locked property
x = make_lproperty('x')
# same but using decorator
@make_lproperty
def y(self): pass
# same but now with customized setter :
@make_lproperty
def z(self): pass
@z.lsetter
def z(self, v):
print("setting z to ",v)
self._z = v
Definition at line 20 of file Utilities.py.
| python.Utilities.onlyAttributesAreProperties | ( | cls | ) |
Transforms the input class cls so the only attributes which can be set are the lproperty of the class.
Best used as a decorator. Ex :
@onlyAttributesAreProperties
class A:
myprop0 = make_lproperty('myprop0')
a = A()
a.myprop0 = 0 # ok
a.mypropO = 3 # impossible
Definition at line 75 of file Utilities.py.
|
private |
Definition at line 71 of file Utilities.py.
|
private |
Definition at line 103 of file Utilities.py.
|
private |
Definition at line 96 of file Utilities.py.
|
private |
Definition at line 110 of file Utilities.py.
|
protected |
Definition at line 89 of file Utilities.py.
|
protected |
Definition at line 50 of file Utilities.py.
|
protected |
Definition at line 93 of file Utilities.py.
| python.Utilities.clone = clone |
Definition at line 134 of file Utilities.py.
| bool python.Utilities.isClonable = True |
Definition at line 135 of file Utilities.py.