Float substep argument.
More...
|
def | __init__ (self, value=None, min=None, max=None, runarg=True, name=None) |
| argSubstep constructor More...
|
|
def | prodsysDescription (self) |
|
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 | 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) |
|
Float substep argument.
Definition at line 2234 of file trfArgClasses.py.
◆ __init__()
def python.trfArgClasses.argSubstepFloat.__init__ |
( |
|
self, |
|
|
|
value = None , |
|
|
|
runarg = None , |
|
|
|
name = None , |
|
|
|
defaultSubstep = True , |
|
|
|
separator = None |
|
) |
| |
argSubstep constructor
- Parameters
-
defaultSubstep | Default 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 from python.trfArgClasses.argSubstep.
Definition at line 2236 of file trfArgClasses.py.
2236 def __init__(self, value=None, min=None, max=None, runarg=True, name=None):
2239 super(argSubstepFloat, self).
__init__(value = value, runarg = runarg, name=name)
◆ __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
◆ __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
◆ __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
◆ __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
◆ __repr__()
def python.trfArgClasses.argument.__repr__ |
( |
|
self | ) |
|
|
inherited |
◆ __str__()
def python.trfArgClasses.argument.__str__ |
( |
|
self | ) |
|
|
inherited |
◆ _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
-
string | The string which should be parsed |
Reimplemented in python.trfArgClasses.argSubstepList.
Definition at line 1971 of file trfArgClasses.py.
1971 def _parseStringAsSubstep(self, string):
1972 subStepMatch = re.match(
r'([a-zA-Z0-9,]+)' + self._separator +
r'(.*)', string)
1975 subStep = subStepMatch.group(1).
split(
',')
1976 subStepValue = subStepMatch.group(2)
1978 subStep = [self._defaultSubstep]
1979 subStepValue = string
1980 msg.debug(
'Parsed {0} as substep {1}, argument {2}'.
format(string, subStep, subStepValue))
1981 for step
in subStep:
1982 subStepList.append((step, subStepValue))
◆ isRunarg()
def python.trfArgClasses.argument.isRunarg |
( |
|
self | ) |
|
|
inherited |
◆ name() [1/2]
def python.trfArgClasses.argument.name |
( |
|
self | ) |
|
|
inherited |
◆ name() [2/2]
def python.trfArgClasses.argument.name |
( |
|
self, |
|
|
|
value |
|
) |
| |
|
inherited |
◆ prodsysDescription()
def python.trfArgClasses.argSubstepFloat.prodsysDescription |
( |
|
self | ) |
|
Reimplemented from python.trfArgClasses.argSubstep.
Definition at line 2242 of file trfArgClasses.py.
2242 def prodsysDescription(self):
2243 desc = {
'type':
'substep',
'substeptype':
'float',
'separator': self._separator,
2244 'default': self._defaultSubstep}
2246 desc[
'min'] = self._min
2248 desc[
'max'] = self._max
◆ 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
-
name | Executor name |
substep | Executor substep nickname |
first | Boolean flag set true if this is the first executor in the chain |
exe | Executor instance, from which 'name', 'substep' and 'first' can be taken.
|
Definition at line 1991 of file trfArgClasses.py.
1991 def returnMyValue(self, name=None, substep=None, first=False, exe=None):
1994 substep = exe.substep
1995 first = exe.conf.firstExecutor
2001 if name
in self._value:
2002 value = self._value[name]
2003 elif substep
in self._value:
2004 value = self._value[substep]
2005 elif first
and 'first' in self._value:
2006 value = self._value[
'first']
2007 elif 'default' in self._value:
2008 value = self._value[
'default']
2018 if 'all' in self._value:
2020 value = self._value[
'all']
2021 elif isinstance(value, list):
2022 value = self._value[
'all'] + value
2024 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))
◆ value() [1/2]
def python.trfArgClasses.argSubstepFloat.value |
( |
|
self | ) |
|
◆ value() [2/2]
def python.trfArgClasses.argSubstepFloat.value |
( |
|
self, |
|
|
|
value |
|
) |
| |
Set argument value.
- Note
- No conversion or coercion done
Reimplemented from python.trfArgClasses.argSubstep.
Definition at line 2258 of file trfArgClasses.py.
2258 def value(self, value):
2259 msg.debug(
'Attempting to set argSubstep from {0!s} (type {1}'.
format(value,
type(value)))
2263 elif isinstance(value, float):
2264 self._value = {self._defaultSubstep: value}
2265 elif isinstance(value, str):
2266 subStepList = self._parseStringAsSubstep(value)
2267 self._value = dict([(subStep[0],
float(subStep[1]))
for subStep
in subStepList])
2268 elif isinstance(value, (list, tuple)):
2272 if not isinstance(item, str):
2273 raise trfExceptions.TransformArgException(trfExit.nameToCode(
'TRF_ARG_CONV_FAIL'),
2274 'Failed to convert list item {0!s} to substep (should be a string)'.
format(item))
2275 subStepList = self._parseStringAsSubstep(item)
2276 for subStep
in subStepList:
2277 self._value[subStep[0]] =
float(subStep[1])
2278 elif isinstance(value, dict):
2279 for k, v
in value.items():
2280 if not isinstance(k, str):
2281 raise trfExceptions.TransformArgException(trfExit.nameToCode(
'TRF_ARG_CONV_FAIL'),
2282 'Dictionary key {0!s} for substep is not a string'.
format(k))
2283 if not isinstance(v, float):
2284 raise trfExceptions.TransformArgException(trfExit.nameToCode(
'TRF_ARG_CONV_FAIL'),
2285 'Dictionary value {0!s} for substep is not an float'.
format(v))
2288 raise trfExceptions.TransformArgException(trfExit.nameToCode(
'TRF_ARG_CONV_FAIL'),
2289 'Setter value {0!s} (type {1}) for substep argument cannot be parsed'.
format(value,
type(value)))
2291 for my_float
in self._value.
values():
2292 if (self._min
is not None and my_float < self._min)
or (self._max
is not None and my_float > self._max):
2293 raise trfExceptions.TransformArgException(trfExit.nameToCode(
'TRF_ARG_OUT_OF_RANGE'),
2294 'argFloat value out of range: {0} is not between {1} and {2}'.
format(my_float, self._min, self._max))
2295 except ValueError
as e:
2296 raise trfExceptions.TransformArgException(trfExit.nameToCode(
'TRF_ARG_CONV_FAIL'),
2297 'Failed to convert substep value {0} to float: {1}'.
format(value, e))
◆ _defaultSubstep
python.trfArgClasses.argSubstep._defaultSubstep |
|
privateinherited |
◆ _max
python.trfArgClasses.argSubstepFloat._max |
|
private |
◆ _min
python.trfArgClasses.argSubstepFloat._min |
|
private |
◆ _name
python.trfArgClasses.argument._name |
|
privateinherited |
◆ _runarg
python.trfArgClasses.argument._runarg |
|
privateinherited |
◆ _separator
python.trfArgClasses.argSubstep._separator |
|
privateinherited |
◆ _value
python.trfArgClasses.argSubstepFloat._value |
|
private |
◆ 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: