ATLAS Offline Software
Loading...
Searching...
No Matches
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 Types

typedef HLT::TypeInformation::for_each_type_c< typenameEDMLIST::map, my_functor, my_result<>, my_arg< HLT::TypeInformation::get_cont, CONTAINER > >::type result

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

 _splitter = splitter
 _defaultSubstep = defaultSubstep
 _separator = separator
 _runarg = runarg
 _name = name
 _value = value

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 ':'.

  • If no substep (e.g. r2a) is specified, it will be parsed for 'all'.
    Note
    substep can be either the subspet property of an executor or the executor's name. Thus r2a:something is the same as RAWtoALL:something.

Definition at line 2070 of file trfArgClasses.py.

Member Typedef Documentation

◆ result

Definition at line 90 of file EDM_MasterSearch.h.

Constructor & Destructor Documentation

◆ __init__()

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

2075 def __init__(self, value = None, runarg = True, name = None, defaultSubstep = 'all', splitter = None, separator=':'):
2076 self._splitter = splitter
2077 super(argSubstepList, self).__init__(value, runarg, name, defaultSubstep, separator)
2078
2079

Member Function Documentation

◆ __eq__()

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__()

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__()

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__()

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__()

python.trfArgClasses.argument.__repr__ ( self)
inherited

Repr conversion of our value.

Definition at line 157 of file trfArgClasses.py.

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

◆ __str__()

python.trfArgClasses.argument.__str__ ( self)
inherited

String conversion of our value.

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()

python.trfArgClasses.argSubstepList._parseStringAsSubstep ( self,
value )
protected

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

2122 def _parseStringAsSubstep(self, value):
2123 subStepList = super(argSubstepList, self)._parseStringAsSubstep(value)
2124 if self._splitter:
2125 subStepList = [(s[0], s[1].split(self._splitter)) for s in subStepList]
2126 else:
2127 subStepList = [(s[0], [s[1]]) for s in subStepList]
2128 return subStepList
2129
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177

◆ isRunarg()

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]

python.trfArgClasses.argument.name ( self)
inherited

Name getter.

Reimplemented in python.trfArgClasses.argFile, and python.trfArgClasses.argFile.

Definition at line 139 of file trfArgClasses.py.

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

◆ name() [2/2]

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

Name setter.

Reimplemented in python.trfArgClasses.argFile, and python.trfArgClasses.argFile.

Definition at line 144 of file trfArgClasses.py.

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

◆ prodsysDescription()

python.trfArgClasses.argSubstepList.prodsysDescription ( self)

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2086 of file trfArgClasses.py.

2086 def prodsysDescription(self):
2087 desc = {'type': 'substep', 'substeptype': 'list', 'listtype': 'str',
2088 'separator': self._separator,
2089 'default': self._defaultSubstep}
2090 return desc

◆ returnMyValue()

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

2021 def returnMyValue(self, name=None, substep=None, first=False, exe=None):
2022 if exe:
2023 name = exe.name
2024 substep = exe.substep
2025 first = exe.conf.firstExecutor
2026
2027 name = commonExecutorStepName(name)
2028
2029 value = None
2030
2031 if name in self._value:
2032 value = self._value[name]
2033 elif substep in self._value:
2034 value = self._value[substep]
2035 elif first and 'first' in self._value:
2036 value = self._value['first']
2037 elif 'default' in self._value:
2038 value = self._value['default']
2039
2040
2048 if 'all' in self._value:
2049 if value is None:
2050 value = self._value['all']
2051 elif isinstance(value, list):
2052 value = self._value['all'] + value
2053
2054 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))
2055
2056 return value
2057

◆ value() [1/2]

python.trfArgClasses.argSubstepList.value ( self)
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!

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2082 of file trfArgClasses.py.

2082 def value(self):
2083 return self._value
2084

◆ value() [2/2]

python.trfArgClasses.argSubstepList.value ( self,
value )
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!

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2092 of file trfArgClasses.py.

2092 def value(self, value):
2093 msg.debug('Attempting to set argSubstep from {0!s} (type {1}'.format(value, type(value)))
2094 if value is None:
2095 self._value = {}
2096 elif isinstance(value, str):
2097 self._value = dict(self._parseStringAsSubstep(value))
2098 elif isinstance(value, (list, tuple)):
2099 # This is a list of strings to parse
2100 self._value = {}
2101 for item in value:
2102 if not isinstance(item, str):
2103 raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'), 'Failed to convert list item {0!s} to substep (should be a string)'.format(item))
2104 subStepList = self._parseStringAsSubstep(item)
2105 for subStep in subStepList:
2106 if subStep[0] in self._value:
2107 self._value[subStep[0]].extend(subStep[1])
2108 else:
2109 self._value[subStep[0]] = subStep[1]
2110 elif isinstance(value, dict):
2111 for k, v in value.items():
2112 if not isinstance(k, str):
2113 raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'), 'Dictionary key {0!s} for substep is not a string'.format(k))
2114 if not isinstance(v, list):
2115 raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'), 'Dictionary value {0!s} for substep is not a list'.format(v))
2116 self._value = value
2117 else:
2118 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)))
2119

Member Data Documentation

◆ _defaultSubstep

python.trfArgClasses.argSubstep._defaultSubstep = defaultSubstep
protectedinherited

Definition at line 1966 of file trfArgClasses.py.

◆ _name

python.trfArgClasses.argument._name = name
protectedinherited

Definition at line 111 of file trfArgClasses.py.

◆ _runarg

python.trfArgClasses.argument._runarg = runarg
protectedinherited

Definition at line 110 of file trfArgClasses.py.

◆ _separator

python.trfArgClasses.argSubstep._separator = separator
protectedinherited

Definition at line 1967 of file trfArgClasses.py.

◆ _splitter

python.trfArgClasses.argSubstepList._splitter = splitter
protected

Definition at line 2076 of file trfArgClasses.py.

◆ _value

python.trfArgClasses.argument._value = value
protectedinherited

Definition at line 130 of file trfArgClasses.py.


The documentation for this class was generated from the following file: