ATLAS Offline Software
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
python.trfArgClasses.argSubstepList Class Reference

Argument class for substep lists, suitable for preExec/postExec. More...

Inheritance diagram for python.trfArgClasses.argSubstepList:
Collaboration diagram for python.trfArgClasses.argSubstepList:

Public Member Functions

def __init__ (self, value=None, runarg=True, name=None, defaultSubstep='all', splitter=None, separator=':')
 argSubstepList constructor More...
 
def value (self)
 Return argument value. More...
 
def prodsysDescription (self)
 
def value (self, value)
 Set argument value. More...
 
def returnMyValue (self, name=None, substep=None, first=False, exe=None)
 Return the value of this substep arg for an executor with the given parameters. More...
 
def isRunarg (self)
 Return runarg status. More...
 
def name (self)
 Name getter. More...
 
def name (self, value)
 Name setter. More...
 
def __str__ (self)
 String conversion of our value. More...
 
def __repr__ (self)
 Repr conversion of our value. More...
 
def __eq__ (self, other)
 Comparison is based on value attribute. More...
 
def __nq__ (self, other)
 
def __lt__ (self, other)
 
def __gt__ (self, other)
 

Public Attributes

 value
 

Private Member Functions

def _parseStringAsSubstep (self, value)
 Specialist parser for lists, which applies the splitter string, if defined. More...
 

Private Attributes

 _splitter
 
 _value
 
 _defaultSubstep
 
 _separator
 
 _runarg
 
 _name
 

Detailed Description

Argument class for substep lists, suitable for preExec/postExec.

substep is followed by a ':' then the python fragments. The substep is validated and set as the key in a dictionary with the value being the python following the ':'.

Definition at line 2028 of file trfArgClasses.py.

Constructor & Destructor Documentation

◆ __init__()

def python.trfArgClasses.argSubstepList.__init__ (   self,
  value = None,
  runarg = True,
  name = None,
  defaultSubstep = 'all',
  splitter = None,
  separator = ':' 
)

argSubstepList constructor

Adds the optional splitter argument to the base argSubstep class

Parameters
splitterCharacter used to split the string into multiple list elements

Definition at line 2033 of file trfArgClasses.py.

2033  def __init__(self, value = None, runarg = True, name = None, defaultSubstep = 'all', splitter = None, separator=':'): self._splitter = splitter
2034  super(argSubstepList, self).__init__(value, runarg, name, defaultSubstep, separator)
2035 
2036 
2037 

Member Function Documentation

◆ __eq__()

def python.trfArgClasses.argument.__eq__ (   self,
  other 
)
inherited

Comparison is based on value attribute.

Definition at line 161 of file trfArgClasses.py.

161  def __eq__(self,other):
162  return self.value == other.value
163 

◆ __gt__()

def python.trfArgClasses.argument.__gt__ (   self,
  other 
)
inherited

Definition at line 170 of file trfArgClasses.py.

170  def __gt__(self, other):
171  return self.value > other.value
172 

◆ __lt__()

def python.trfArgClasses.argument.__lt__ (   self,
  other 
)
inherited

Definition at line 167 of file trfArgClasses.py.

167  def __lt__(self, other):
168  return self.value < other.value
169 

◆ __nq__()

def python.trfArgClasses.argument.__nq__ (   self,
  other 
)
inherited

Definition at line 164 of file trfArgClasses.py.

164  def __nq__(self, other):
165  return self.value != other.value
166 

◆ __repr__()

def python.trfArgClasses.argument.__repr__ (   self)
inherited

Repr conversion of our value.

Reimplemented in python.trfArgClasses.argList.

Definition at line 157 of file trfArgClasses.py.

157  def __repr__(self):
158  return repr(self.value)
159 

◆ __str__()

def python.trfArgClasses.argument.__str__ (   self)
inherited

String conversion of our value.

Reimplemented in python.trfArgClasses.argFile, python.trfArgClasses.argKeyFloatValueList, python.trfArgClasses.argIntList, python.trfArgClasses.argList, and python.trfArgClasses.argString.

Definition at line 153 of file trfArgClasses.py.

153  def __str__(self):
154  return '{0}: Value {1} (isRunArg={2})'.format(self.__class__.__name__, self._value, self._runarg)
155 

◆ _parseStringAsSubstep()

def python.trfArgClasses.argSubstepList._parseStringAsSubstep (   self,
  value 
)
private

Specialist parser for lists, which applies the splitter string, if defined.

Returns
Tuple of substep plus a list of strings

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2080 of file trfArgClasses.py.

2080  def _parseStringAsSubstep(self, value):
2081  subStepList = super(argSubstepList, self)._parseStringAsSubstep(value)
2082  if self._splitter:
2083  subStepList = [(s[0], s[1].split(self._splitter)) for s in subStepList]
2084  else:
2085  subStepList = [(s[0], [s[1]]) for s in subStepList]
2086  return subStepList
2087 

◆ isRunarg()

def python.trfArgClasses.argument.isRunarg (   self)
inherited

Return runarg status.

Definition at line 134 of file trfArgClasses.py.

134  def isRunarg(self):
135  return self._runarg
136 

◆ name() [1/2]

def python.trfArgClasses.argument.name (   self)
inherited

Name getter.

Reimplemented in python.trfArgClasses.argFile.

Definition at line 139 of file trfArgClasses.py.

139  def name(self):
140  return self._name
141 

◆ name() [2/2]

def python.trfArgClasses.argument.name (   self,
  value 
)
inherited

Name setter.

Reimplemented in python.trfArgClasses.argFile.

Definition at line 144 of file trfArgClasses.py.

144  def name(self, value):
145  self._name = value
146 

◆ prodsysDescription()

def python.trfArgClasses.argSubstepList.prodsysDescription (   self)

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2044 of file trfArgClasses.py.

2044  def prodsysDescription(self):
2045  desc = {'type': 'substep', 'substeptype': 'list', 'listtype': 'str',
2046  'separator': self._separator,
2047  'default': self._defaultSubstep}
2048  return desc

◆ returnMyValue()

def python.trfArgClasses.argSubstep.returnMyValue (   self,
  name = None,
  substep = None,
  first = False,
  exe = None 
)
inherited

Return the value of this substep arg for an executor with the given parameters.

Parameters
nameExecutor name
substepExecutor substep nickname
firstBoolean flag set true if this is the first executor in the chain
exeExecutor instance, from which 'name', 'substep' and 'first' can be taken.

Definition at line 1979 of file trfArgClasses.py.

1979  def returnMyValue(self, name=None, substep=None, first=False, exe=None):
1980  if exe:
1981  name = exe.name
1982  substep = exe.substep
1983  first = exe.conf.firstExecutor
1984 
1985  name = commonExecutorStepName(name)
1986 
1987  value = None
1988 
1989  if name in self._value:
1990  value = self._value[name]
1991  elif substep in self._value:
1992  value = self._value[substep]
1993  elif first and 'first' in self._value:
1994  value = self._value['first']
1995  elif 'default' in self._value:
1996  value = self._value['default']
1997 
1998 
2006  if 'all' in self._value:
2007  if value is None:
2008  value = self._value['all']
2009  elif isinstance(value, list):
2010  value = self._value['all'] + value
2011 
2012  msg.debug('From substep argument {myvalue} picked value "{value}" for {name}, {substep}, first={first}'.format(myvalue=self._value, value=value, name=name, substep=substep, first=first))
2013 
2014  return value
2015 

◆ value() [1/2]

def python.trfArgClasses.argSubstepList.value (   self)

Return argument value.

Returns
Current value

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2040 of file trfArgClasses.py.

2040  def value(self):
2041  return self._value
2042 

◆ value() [2/2]

def python.trfArgClasses.argSubstepList.value (   self,
  value 
)

Set argument value.

Note
No conversion or coercion done

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2050 of file trfArgClasses.py.

2050  def value(self, value):
2051  msg.debug('Attempting to set argSubstep from {0!s} (type {1}'.format(value, type(value)))
2052  if value is None:
2053  self._value = {}
2054  elif isinstance(value, str):
2055  self._value = dict(self._parseStringAsSubstep(value))
2056  elif isinstance(value, (list, tuple)):
2057  # This is a list of strings to parse
2058  self._value = {}
2059  for item in value:
2060  if not isinstance(item, str):
2061  raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'), 'Failed to convert list item {0!s} to substep (should be a string)'.format(item))
2062  subStepList = self._parseStringAsSubstep(item)
2063  for subStep in subStepList:
2064  if subStep[0] in self._value:
2065  self._value[subStep[0]].extend(subStep[1])
2066  else:
2067  self._value[subStep[0]] = subStep[1]
2068  elif isinstance(value, dict):
2069  for k, v in value.items():
2070  if not isinstance(k, str):
2071  raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'), 'Dictionary key {0!s} for substep is not a string'.format(k))
2072  if not isinstance(v, list):
2073  raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'), 'Dictionary value {0!s} for substep is not a list'.format(v))
2074  self._value = value
2075  else:
2076  raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'), 'Setter value {0!s} (type {1}) for substep argument cannot be parsed'.format(value, type(value)))
2077 

Member Data Documentation

◆ _defaultSubstep

python.trfArgClasses.argSubstep._defaultSubstep
privateinherited

Definition at line 1924 of file trfArgClasses.py.

◆ _name

python.trfArgClasses.argument._name
privateinherited

Definition at line 111 of file trfArgClasses.py.

◆ _runarg

python.trfArgClasses.argument._runarg
privateinherited

Definition at line 110 of file trfArgClasses.py.

◆ _separator

python.trfArgClasses.argSubstep._separator
privateinherited

Definition at line 1925 of file trfArgClasses.py.

◆ _splitter

python.trfArgClasses.argSubstepList._splitter
private

Definition at line 2034 of file trfArgClasses.py.

◆ _value

python.trfArgClasses.argSubstepList._value
private

Definition at line 2053 of file trfArgClasses.py.

◆ value

python.trfArgClasses.argument.value
inherited
Note
We have a default of None here, but all derived classes should definitely have their own value setter and translate this value to something sensible for their underlying value type. N.B. As most argument classes use this default constructor it must call the @value .setter function!

Definition at line 118 of file trfArgClasses.py.


The documentation for this class was generated from the following file:
vtune_athena.format
format
Definition: vtune_athena.py:14
athena.value
value
Definition: athena.py:122
PyAthena::repr
std::string repr(PyObject *o)
returns the string representation of a python object equivalent of calling repr(o) in python
Definition: PyAthenaUtils.cxx:106
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
python.trfExeStepTools.commonExecutorStepName
def commonExecutorStepName(name)
Definition: trfExeStepTools.py:7
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
Trk::split
@ split
Definition: LayerMaterialProperties.h:38