Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
python.trfArgClasses.argSubstep Class Reference

Base class for substep arguments. More...

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

Public Member Functions

def __init__ (self, value=None, runarg=True, name=None, defaultSubstep='all', separator=':')
 argSubstep constructor More...
 
def value (self)
 Return argument value. More...
 
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 prodsysDescription (self)
 
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, string)
 Parse a string for substep:value format. More...
 

Private Attributes

 _defaultSubstep
 
 _separator
 
 _value
 
 _runarg
 
 _name
 

Detailed Description

Base class for substep arguments.

Sets up a dictionary with {substep1: value1, substep2: value2, ...} In this base class we don't put any restructions on the values - they will be specialised in children.

Definition at line 1931 of file trfArgClasses.py.

Constructor & Destructor Documentation

◆ __init__()

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

argSubstep constructor

Parameters
defaultSubstepDefault substep to use when no specific substep has been given - this should be set to first for arguments that apply, by default, to the first executor in the chain (e.g., maxEvents)

Reimplemented in python.trfArgClasses.argSubstepFloat.

Definition at line 1936 of file trfArgClasses.py.

1936  def __init__(self, value = None, runarg = True, name = None, defaultSubstep = 'all', separator = ':'): self._defaultSubstep = defaultSubstep
1937  self._separator = separator
1938  super(argSubstep, self).__init__(value, runarg, name)
1939 
1940 

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.argSubstep._parseStringAsSubstep (   self,
  string 
)
private

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

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

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

Reimplemented from python.trfArgClasses.argument.

Reimplemented in python.trfArgClasses.argSubstepConditions, python.trfArgClasses.argSubstepSteering, python.trfArgClasses.argSubstepFloat, python.trfArgClasses.argSubstepInt, python.trfArgClasses.argSubstepBool, python.trfArgClasses.argSubstepString, and python.trfArgClasses.argSubstepList.

Definition at line 2030 of file trfArgClasses.py.

2030  def prodsysDescription(self):
2031  desc = {'type': 'substep', 'substeptype': 'str', 'separator': self._separator,
2032  'default': self._defaultSubstep}
2033  return desc

◆ returnMyValue()

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

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

1992  def returnMyValue(self, name=None, substep=None, first=False, exe=None):
1993  if exe:
1994  name = exe.name
1995  substep = exe.substep
1996  first = exe.conf.firstExecutor
1997 
1998  name = commonExecutorStepName(name)
1999 
2000  value = None
2001 
2002  if name in self._value:
2003  value = self._value[name]
2004  elif substep in self._value:
2005  value = self._value[substep]
2006  elif first and 'first' in self._value:
2007  value = self._value['first']
2008  elif 'default' in self._value:
2009  value = self._value['default']
2010 
2011 
2019  if 'all' in self._value:
2020  if value is None:
2021  value = self._value['all']
2022  elif isinstance(value, list):
2023  value = self._value['all'] + value
2024 
2025  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))
2026 
2027  return value
2028 

◆ value() [1/2]

def python.trfArgClasses.argSubstep.value (   self)

◆ value() [2/2]

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

Set argument value.

Note
No conversion or coercion done

Reimplemented from python.trfArgClasses.argument.

Reimplemented in python.trfArgClasses.argSubstepConditions, python.trfArgClasses.argSubstepSteering, python.trfArgClasses.argSubstepFloat, python.trfArgClasses.argSubstepInt, python.trfArgClasses.argSubstepBool, python.trfArgClasses.argSubstepString, and python.trfArgClasses.argSubstepList.

Definition at line 1948 of file trfArgClasses.py.

1948  def value(self, value):
1949  msg.debug('Attempting to set argSubstep from {0!s} (type {1}'.format(value, type(value)))
1950  if value is None:
1951  self._value = {}
1952  elif isinstance(value, str):
1953  self._value = dict(self._parseStringAsSubstep(value))
1954  elif isinstance(value, (list, tuple)):
1955  # This is a list of strings to parse, so we go through them one by one
1956  self._value = {}
1957  for item in value:
1958  if not isinstance(item, str):
1959  raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'), 'Failed to convert list item {0!s} to substep (should be a string)'.format(item))
1960  self._value.update(dict(self._parseStringAsSubstep(item)))
1961  elif isinstance(value, dict):
1962  self._value = value
1963  else:
1964  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)))
1965 
1966 

Member Data Documentation

◆ _defaultSubstep

python.trfArgClasses.argSubstep._defaultSubstep
private

Definition at line 1937 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
private

Definition at line 1938 of file trfArgClasses.py.

◆ _value

python.trfArgClasses.argSubstep._value
private

Definition at line 1951 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
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
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:240
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
Trk::split
@ split
Definition: LayerMaterialProperties.h:38