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

Special argument class to hold steering information. More...

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

Public Member Functions

def value (self)
 Return argument value. More...
 
def dumpvalue (self)
 
def prodsysDescription (self)
 
def value (self, value)
 
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
 

Static Public Attributes

 steeringAlises
 

Private Member Functions

def _parseSetterString (self, string)
 
def _parseSteeringString (self, ivalue)
 
def _parseStringAsSubstep (self, string)
 Parse a string for substep:value format. More...
 

Private Attributes

 _value
 
 _dumpvalue
 
 _defaultSubstep
 
 _separator
 
 _runarg
 
 _name
 

Detailed Description

Special argument class to hold steering information.

Definition at line 2297 of file trfArgClasses.py.

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 

◆ _parseSetterString()

def python.trfArgClasses.argSubstepSteering._parseSetterString (   self,
  string 
)
private

Definition at line 2385 of file trfArgClasses.py.

2385  def _parseSetterString(self, string):
2386  if string in argSubstepSteering.steeringAlises:
2387  return argSubstepSteering.steeringAlises[string]
2388 

◆ _parseSteeringString()

def python.trfArgClasses.argSubstepSteering._parseSteeringString (   self,
  ivalue 
)
private

Definition at line 2389 of file trfArgClasses.py.

2389  def _parseSteeringString(self, ivalue):
2390  retvalue = []
2391  for subvalue in ivalue.split(','):
2392  matchedParts = re.match(r'(in|out)(\+|\-)([A-Z_]+)$', subvalue)
2393  if not matchedParts:
2394  raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'),
2395  'Failed to convert string {0!s} to argSubstepSteering'.format(subvalue))
2396  retvalue.append((matchedParts.group(1), matchedParts.group(2), matchedParts.group(3)))
2397  return retvalue
2398 
2399 

◆ _parseStringAsSubstep()

def python.trfArgClasses.argSubstep._parseStringAsSubstep (   self,
  string 
)
privateinherited

Parse a string for substep:value format.

If the string matches the substep specifier regexp then we return the two parts; if not then the substep is returned as self._defaultSubstep, with the entire string passed back as the value

Parameters
stringThe string which should be parsed

Reimplemented in python.trfArgClasses.argSubstepList.

Definition at line 1967 of file trfArgClasses.py.

1967  def _parseStringAsSubstep(self, string):
1968  subStepMatch = re.match(r'([a-zA-Z0-9,]+)' + self._separator + r'(.*)', string)
1969  subStepList = []
1970  if subStepMatch:
1971  subStep = subStepMatch.group(1).split(',')
1972  subStepValue = subStepMatch.group(2)
1973  else:
1974  subStep = [self._defaultSubstep]
1975  subStepValue = string
1976  msg.debug('Parsed {0} as substep {1}, argument {2}'.format(string, subStep, subStepValue))
1977  for step in subStep:
1978  subStepList.append((step, subStepValue))
1979  return subStepList
1980 
1981 

◆ dumpvalue()

def python.trfArgClasses.argSubstepSteering.dumpvalue (   self)

Definition at line 2327 of file trfArgClasses.py.

2327  def dumpvalue(self):
2328  return self._dumpvalue
2329 

◆ 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.argSubstepSteering.prodsysDescription (   self)

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2331 of file trfArgClasses.py.

2331  def prodsysDescription(self):
2332  desc = {'type': 'substep', 'substeptype': 'steering', 'listtype': 'str', 'separator': self._separator,
2333  'default': self._defaultSubstep}
2334  return desc
2335 

◆ 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 1987 of file trfArgClasses.py.

1987  def returnMyValue(self, name=None, substep=None, first=False, exe=None):
1988  if exe:
1989  name = exe.name
1990  substep = exe.substep
1991  first = exe.conf.firstExecutor
1992 
1993  name = commonExecutorStepName(name)
1994 
1995  value = None
1996 
1997  if name in self._value:
1998  value = self._value[name]
1999  elif substep in self._value:
2000  value = self._value[substep]
2001  elif first and 'first' in self._value:
2002  value = self._value['first']
2003  elif 'default' in self._value:
2004  value = self._value['default']
2005 
2006 
2014  if 'all' in self._value:
2015  if value is None:
2016  value = self._value['all']
2017  elif isinstance(value, list):
2018  value = self._value['all'] + value
2019 
2020  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))
2021 
2022  return value
2023 

◆ value() [1/2]

def python.trfArgClasses.argSubstepSteering.value (   self)

Return argument value.

Returns
Current value

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2321 of file trfArgClasses.py.

2321  def value(self):
2322  return self._value
2323 

◆ value() [2/2]

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

For strings passed to the setter we expect the format to be substep:{in/out}{+/-}DATATYPE or to be a steering alias, which is then expanded to the more complex format. This is then cast into a dictionary of tuples {substep: [('in/out', '+/-', DATATYPE), ...], ...}

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2340 of file trfArgClasses.py.

2340  def value(self, value):
2341  msg.debug('Attempting to set argSubstepSteering from {0!s} (type {1})'.format(value, type(value)))
2342  if value is None:
2343  self._value = {}
2344  self._dumpvalue = [""]
2345  elif isinstance(value, dict):
2346  # OK, this should be the direct setable dictionary - but do a check of that
2347  for k, v in value.items():
2348  if not isinstance(k, str) or not isinstance(v, list):
2349  raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'),
2350  'Failed to convert dict {0!s} to argSubstepSteering'.format(value))
2351  for subv in v:
2352  if not isinstance(subv, (list, tuple)) or len(subv) != 3 or subv[0] not in ('in', 'out') or subv[1] not in ('+', '-'):
2353  raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'),
2354  'Failed to convert dict {0!s} to argSubstepSteering'.format(value))
2355  self._value = value
2356  # Note we are a little careful here to never reset the dumpvalue - this is
2357  # because when processing the _list_ of steering arguments down to a single
2358  # multi-valued argument we re-call value() with an expanded diectionary and
2359  # one can nievely reset dumpvalue by mistake
2360  self._dumpvalue = getattr(self, "_dumpvalue", value)
2361  elif isinstance(value, (str, list, tuple)):
2362  if isinstance(value, str):
2363  value = [value,]
2364  self._dumpvalue = getattr(self, "_dumpvalue", value)
2365  # Now we have a list of strings to parse
2366  self._value = {}
2367  for item in value:
2368  if not isinstance(item, str):
2369  raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'),
2370  'Failed to convert list item {0!s} to substep (should be a string)'.format(item))
2371  if item in argSubstepSteering.steeringAlises:
2372  msg.debug("Found value {0} in steeringAlises ({1})".format(item, argSubstepSteering.steeringAlises[item]))
2373  for substep, steerlist in argSubstepSteering.steeringAlises[item].items():
2374  if substep in self._value:
2375  self._value[substep].extend(steerlist)
2376  else:
2377  self._value[substep] = steerlist
2378  else:
2379  subStepList = self._parseStringAsSubstep(item)
2380  self._value.update(dict([(subStep[0], self._parseSteeringString(subStep[1])) for subStep in subStepList]))
2381  else:
2382  raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'),
2383  'Setter value {0!s} (type {1}) for substep argument cannot be parsed'.format(value, type(value)))
2384 

Member Data Documentation

◆ _defaultSubstep

python.trfArgClasses.argSubstep._defaultSubstep
privateinherited

Definition at line 1932 of file trfArgClasses.py.

◆ _dumpvalue

python.trfArgClasses.argSubstepSteering._dumpvalue
private

Definition at line 2344 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 1933 of file trfArgClasses.py.

◆ _value

python.trfArgClasses.argSubstepSteering._value
private

Definition at line 2343 of file trfArgClasses.py.

◆ steeringAlises

python.trfArgClasses.argSubstepSteering.steeringAlises
static

Definition at line 2307 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:124
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:221
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
python.trfExeStepTools.commonExecutorStepName
def commonExecutorStepName(name)
Definition: trfExeStepTools.py:7
ActsTrk::detail::MakeDerivedVariant::extend
constexpr std::variant< Args..., T > extend(const std::variant< Args... > &, const T &)
Definition: MakeDerivedVariant.h:17
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
WriteBchToCool.update
update
Definition: WriteBchToCool.py:67
Trk::split
@ split
Definition: LayerMaterialProperties.h:38