|
def | __init__ (self, value={}, supressEmptyStrings=True, splitter=',', kvsplitter=":", runarg=True, name=None) |
| Dictionary of key value arguments, where the values are floats. More...
|
|
def | value (self) |
| Argument value getter. More...
|
|
def | value (self, value) |
| Argument value setter. More...
|
|
def | __str__ (self) |
| String conversion. More...
|
|
def | prodsysDescription (self) |
|
def | append (self, addme) |
| Append a value to the list. More...
|
|
def | __repr__ (self) |
| Repr conversion. More...
|
|
def | isRunarg (self) |
| Return runarg status. More...
|
|
def | name (self) |
| Name getter. More...
|
|
def | name (self, value) |
| Name setter. More...
|
|
def | __eq__ (self, other) |
| Comparison is based on value attribute. More...
|
|
def | __nq__ (self, other) |
|
def | __lt__ (self, other) |
|
def | __gt__ (self, other) |
|
Definition at line 458 of file trfArgClasses.py.
◆ __init__()
def python.trfArgClasses.argKeyFloatValueList.__init__ |
( |
|
self, |
|
|
|
value = {} , |
|
|
|
supressEmptyStrings = True , |
|
|
|
splitter = ',' , |
|
|
|
kvsplitter = ":" , |
|
|
|
runarg = True , |
|
|
|
name = None |
|
) |
| |
Dictionary of key value arguments, where the values are floats.
- Parameters
-
splitter | The splitter argument determines how the string is split (default by a comma) |
kvsplitter | The kvsplitter argument determines how the key and value are split (default by a colon) |
value | Initial value to set (note default is an empty dictionary {}) |
supressEmptyStrings | If empty strings are removed from the list (Can be used to easily set an empty list from the CLI) |
Definition at line 465 of file trfArgClasses.py.
465 def __init__(self, value = {}, supressEmptyStrings = True, splitter=',', kvsplitter=":
", runarg=True, name=None): self._splitter = splitter
466 self._kvsplitter = kvsplitter
467 self._supressEmptyStrings = supressEmptyStrings
469 super(argList, 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.argList.__repr__ |
( |
|
self | ) |
|
|
inherited |
◆ __str__()
def python.trfArgClasses.argKeyFloatValueList.__str__ |
( |
|
self | ) |
|
◆ append()
def python.trfArgClasses.argList.append |
( |
|
self, |
|
|
|
addme |
|
) |
| |
|
inherited |
◆ 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.argKeyFloatValueList.prodsysDescription |
( |
|
self | ) |
|
◆ value() [1/2]
def python.trfArgClasses.argKeyFloatValueList.value |
( |
|
self | ) |
|
◆ value() [2/2]
def python.trfArgClasses.argKeyFloatValueList.value |
( |
|
self, |
|
|
|
value |
|
) |
| |
Argument value setter.
If we get a dict then set that, otherwise we split a string on the splitter character and then on the kvsplitter into key and value, with the value being converted to float
- Exceptions
-
Reimplemented from python.trfArgClasses.argList.
Definition at line 484 of file trfArgClasses.py.
484 def value(self, value):
485 if isinstance(value, dict):
486 for k, v
in value.items():
487 if not isinstance(k, str):
488 raise trfExceptions.TransformArgException(trfExit.nameToCode(
'TRF_ARG_ERROR'),
489 'Illegal key argument type {0} in dictionary for argKeyFloatValueList'.
format(k))
490 if not isinstance(v, float):
491 raise trfExceptions.TransformArgException(trfExit.nameToCode(
'TRF_ARG_ERROR'),
492 'Illegal value argument type {0} in dictionary for argKeyFloatValueList'.
format(v))
500 if self._supressEmptyStrings:
501 kvlist = [ v
for v
in value.split(self._splitter)
if v !=
'' ]
503 kvlist = value.split(self._splitter)
505 k, v = item.split(self._kvsplitter, 1)
506 self._value[k] =
float(v)
507 except (AttributeError, ValueError):
508 raise trfExceptions.TransformArgException(trfExit.nameToCode(
'TRF_ARG_CONV_FAIL'),
509 'Failed to convert {0} to a dictionary of string:int values'.
format(value))
◆ _kvsplitter
python.trfArgClasses.argKeyFloatValueList._kvsplitter |
|
private |
◆ _name
python.trfArgClasses.argument._name |
|
privateinherited |
◆ _runarg
python.trfArgClasses.argument._runarg |
|
privateinherited |
◆ _splitter
python.trfArgClasses.argKeyFloatValueList._splitter |
|
private |
◆ _supressEmptyStrings
python.trfArgClasses.argKeyFloatValueList._supressEmptyStrings |
|
private |
◆ _value
python.trfArgClasses.argKeyFloatValueList._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: