![]() |
ATLAS Offline Software
|
Classes | |
| class | ldict |
| class | lproperty |
Functions | |
| def | make_lproperty (func) |
| def | make_alias (prop) |
| def | listClassLProperties (cls) |
| def | onlyAttributesAreProperties (cls) |
| def | clonable (cls) |
| def | flattenDic (inD) |
Variables | |
| _allowedattributes | |
| _nomoreattributes | |
| _locked | |
| __init__origin | |
| __init__ | |
| __setattr__ | |
| clone | |
| isClonable | |
| def 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.
| def 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.
| def python.Utilities.listClassLProperties | ( | cls | ) |
Definition at line 63 of file Utilities.py.
| def 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.
| def 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.
| def 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 103 of file Utilities.py.
|
private |
Definition at line 96 of file Utilities.py.
|
private |
Definition at line 110 of file Utilities.py.
|
private |
Definition at line 89 of file Utilities.py.
|
private |
Definition at line 94 of file Utilities.py.
|
private |
Definition at line 93 of file Utilities.py.
| python.Utilities.clone |
Definition at line 134 of file Utilities.py.
| python.Utilities.isClonable |
Definition at line 135 of file Utilities.py.
1.8.18