ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.Configurables.CfgPyComponent Class Reference

Configurable base class for all Py compmonents -------------------------—. More...

Inheritance diagram for python.Configurables.CfgPyComponent:
Collaboration diagram for python.Configurables.CfgPyComponent:

Public Member Functions

def __init__ (self, name, **kw)
 
def getDlls (self)
 
def msg (self)
 
def getHandle (self)
 
def __getstate__ (self)
 
def __setstate__ (self, state)
 
def setup (self)
 
def merge (self, other)
 

Public Attributes

 OutputLevel
 special case of the OutputLevel: take the value from the svcMgr.MessageSvc if none already set by user More...
 

Detailed Description

Configurable base class for all Py compmonents -------------------------—.

Definition at line 46 of file Configurables.py.

Constructor & Destructor Documentation

◆ __init__()

def python.Configurables.CfgPyComponent.__init__ (   self,
  name,
**  kw 
)

Reimplemented in python.Configurables.CfgPyAud, python.Configurables.CfgPyAlgTool, python.Configurables.CfgPyService, and python.Configurables.CfgPyAlgorithm.

Definition at line 47 of file Configurables.py.

47  def __init__(self, name, **kw):
48  self.__dict__['__cpp_type__'] = self.getType()
49  for n,v in kw.items():
50  setattr(self, n, v)
51 

Member Function Documentation

◆ __getstate__()

def python.Configurables.CfgPyComponent.__getstate__ (   self)

Definition at line 63 of file Configurables.py.

63  def __getstate__(self):
64  state = super().__getstate__()
65  state.update(self.__dict__)
66  return state
67 

◆ __setstate__()

def python.Configurables.CfgPyComponent.__setstate__ (   self,
  state 
)

Definition at line 68 of file Configurables.py.

68  def __setstate__(self, state):
69  self.__dict__.update(state)
70  super().__setstate__(state)
71 

◆ getDlls()

def python.Configurables.CfgPyComponent.getDlls (   self)

Definition at line 52 of file Configurables.py.

52  def getDlls(self):
53  return 'AthenaPython'
54 

◆ getHandle()

def python.Configurables.CfgPyComponent.getHandle (   self)

Definition at line 60 of file Configurables.py.

60  def getHandle(self):
61  return None
62 

◆ merge()

def python.Configurables.CfgPyComponent.merge (   self,
  other 
)
Basic merge for Python components.
Checks that all attributes/properties are identical.

Definition at line 91 of file Configurables.py.

91  def merge(self, other):
92  """Basic merge for Python components.
93  Checks that all attributes/properties are identical.
94  """
95  if self is other:
96  return self
97 
98  if type(self) is not type(other):
99  raise TypeError(f"cannot merge instance of {type(other).__name__} into "
100  f"an instance of { type(self).__name__}")
101 
102  if self.name != other.name:
103  raise ValueError(f"cannot merge configurables with different names ({self.name} and {other.name})")
104 
105  for prop in other.__dict__:
106  if (hasattr(self, prop) and getattr(self, prop) == getattr(other, prop)):
107  continue
108  else:
109  raise ValueError(f"conflicting settings for property {prop} of {self.name}: "
110  f"{getattr(self,prop)} vs {getattr(other,prop)}")
111  return self
112 
113 

◆ msg()

def python.Configurables.CfgPyComponent.msg (   self)

Definition at line 56 of file Configurables.py.

56  def msg(self):
57  import AthenaCommon.Logging as _L
58  return _L.logging.getLogger( self.getName() )
59 

◆ setup()

def python.Configurables.CfgPyComponent.setup (   self)

Reimplemented in python.Configurables.CfgPyAud, python.Configurables.CfgPyAlgTool, python.Configurables.CfgPyService, and python.Configurables.CfgPyAlgorithm.

Definition at line 72 of file Configurables.py.

72  def setup(self):
73  if isinstance(self, LegacyConfigurable):
74  from AthenaCommon.AppMgr import ServiceMgr as svcMgr
75  if not hasattr( svcMgr, 'PyComponentMgr' ):
76  from AthenaPython.AthenaPythonCompsConf import PyAthena__PyComponentMgr
77  svcMgr += PyAthena__PyComponentMgr('PyComponentMgr')
78 
79 
81  self.OutputLevel = _get_prop_value (self, 'OutputLevel')
82 
83 
84  o = PyComponents.instances.get(self.getName(), None)
85  if not (o is None) and not (o is self):
86  err = "A python component [%r] has already been "\
87  "registered with the PyComponents registry !" % o
88  raise RuntimeError(err)
89  PyComponents.instances[self.getName()] = self
90 

Member Data Documentation

◆ OutputLevel

python.Configurables.CfgPyComponent.OutputLevel

special case of the OutputLevel: take the value from the svcMgr.MessageSvc if none already set by user

Definition at line 81 of file Configurables.py.


The documentation for this class was generated from the following file:
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.utility.LHE.merge
def merge(input_file_pattern, output_file)
Merge many input LHE files into a single output file.
Definition: LHE.py:29
python.setup
def setup()
Definition: Control/Hephaestus/python/__init__.py:9
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
WriteBchToCool.update
update
Definition: WriteBchToCool.py:67