ATLAS Offline Software
Public Member Functions | Public Attributes | Private Attributes | List of all members
python.trfArgClasses.argKeyFloatValueList Class Reference
Inheritance diagram for python.trfArgClasses.argKeyFloatValueList:
Collaboration diagram for python.trfArgClasses.argKeyFloatValueList:

Public Member Functions

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)
 

Public Attributes

 value
 

Private Attributes

 _splitter
 
 _kvsplitter
 
 _supressEmptyStrings
 
 _value
 
 _runarg
 
 _name
 

Detailed Description

Definition at line 458 of file trfArgClasses.py.

Constructor & Destructor Documentation

◆ __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
splitterThe splitter argument determines how the string is split (default by a comma)
kvsplitterThe kvsplitter argument determines how the key and value are split (default by a colon)
valueInitial value to set (note default is an empty dictionary {})
supressEmptyStringsIf 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
468 
469  super(argList, self).__init__(value = value, runarg = runarg, name=name)
470 
471 

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.argList.__repr__ (   self)
inherited

Repr conversion.

Return a python parsable string

Reimplemented from python.trfArgClasses.argument.

Definition at line 409 of file trfArgClasses.py.

409  def __repr__(self):
410  return '[' + ','.join([ repr(s) for s in self._value ]) + ']'
411 
412 

◆ __str__()

def python.trfArgClasses.argKeyFloatValueList.__str__ (   self)

String conversion.

Flatten values and space separate

Warning
Values sets with spaces will be confused by this conversion

Reimplemented from python.trfArgClasses.argList.

Definition at line 511 of file trfArgClasses.py.

511  def __str__(self):
512  return str(self._value)
513 

◆ append()

def python.trfArgClasses.argList.append (   self,
  addme 
)
inherited

Append a value to the list.

Parameters
addmeItem to add

Definition at line 398 of file trfArgClasses.py.

398  def append(self, addme):
399  self._value.append(addme)
400 

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

Reimplemented from python.trfArgClasses.argList.

Definition at line 515 of file trfArgClasses.py.

515  def prodsysDescription(self):
516  desc = {'type' : 'list', 'listtype' : 'str:float'}
517  return desc
518 
519 

◆ value() [1/2]

def python.trfArgClasses.argKeyFloatValueList.value (   self)

Argument value getter.

Returns
Current value

Reimplemented from python.trfArgClasses.argList.

Definition at line 475 of file trfArgClasses.py.

475  def value(self):
476  return self._value
477 

◆ 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
trfExceptions.TransformArgExceptionException thrown if any dictionary key:value member is not string:int
trfExceptions.TransformArgExceptionException thrown if any int() conversion fails of the kvsplitter is not found

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))
493  self._value = value
494  elif value is None:
495  self._value = {}
496  return
497  else:
498  self._value = {}
499  try:
500  if self._supressEmptyStrings:
501  kvlist = [ v for v in value.split(self._splitter) if v != '' ]
502  else:
503  kvlist = value.split(self._splitter)
504  for item in kvlist:
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))
510 

Member Data Documentation

◆ _kvsplitter

python.trfArgClasses.argKeyFloatValueList._kvsplitter
private

Definition at line 467 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.

◆ _splitter

python.trfArgClasses.argKeyFloatValueList._splitter
private

Definition at line 466 of file trfArgClasses.py.

◆ _supressEmptyStrings

python.trfArgClasses.argKeyFloatValueList._supressEmptyStrings
private

Definition at line 468 of file trfArgClasses.py.

◆ _value

python.trfArgClasses.argKeyFloatValueList._value
private

Definition at line 493 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
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
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
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
str
Definition: BTagTrackIpAccessor.cxx:11
readCCLHist.float
float
Definition: readCCLHist.py:83