ATLAS Offline Software
Public Member Functions | Public Attributes | Private Attributes | List of all members
python.trfArgClasses.argList Class Reference

List of string arguments. More...

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

Public Member Functions

def __init__ (self, value=[], supressEmptyStrings=True, splitter=',', runarg=True, name=None)
 List of string arguments. More...
 
def value (self)
 Argument value getter. More...
 
def prodsysDescription (self)
 
def value (self, value)
 Argument value setter. More...
 
def append (self, addme)
 Append a value to the list. More...
 
def __str__ (self)
 String conversion. 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
 
 _supressEmptyStrings
 
 _value
 
 _runarg
 
 _name
 

Detailed Description

List of string arguments.

Definition at line 348 of file trfArgClasses.py.

Constructor & Destructor Documentation

◆ __init__()

def python.trfArgClasses.argList.__init__ (   self,
  value = [],
  supressEmptyStrings = True,
  splitter = ',',
  runarg = True,
  name = None 
)

List of string arguments.

Argument holding a list of string values

Parameters
splitterThe splitter argument determines how the string is split (default by a comma)
valueInitial value to set (note default is an empty list [])
supressEmptyStringsIf empty strings are removed from the list (Can be used to easily set an empty list from the CLI)

Definition at line 356 of file trfArgClasses.py.

356  def __init__(self, value = [], supressEmptyStrings = True, splitter=',', runarg=True, name=None):
357  self._splitter = splitter
358  self._supressEmptyStrings = supressEmptyStrings
359 
360  super(argList, self).__init__(value = value, runarg = runarg, name=name)
361 

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)

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

String conversion.

Flatten values and space separate

Warning
Values sets with spaces will be confused by this conversion

Reimplemented from python.trfArgClasses.argument.

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

Definition at line 404 of file trfArgClasses.py.

404  def __str__(self):
405  return " ".join(self._value)
406 

◆ append()

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

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

Reimplemented from python.trfArgClasses.argument.

Reimplemented in python.trfArgClasses.argFTKIPFile, python.trfArgClasses.argBZ2File, python.trfArgClasses.argNTUPFile, python.trfArgClasses.argHISTFile, python.trfArgClasses.argPOOLFile, python.trfArgClasses.argBSFile, python.trfArgClasses.argAthenaFile, python.trfArgClasses.argFile, python.trfArgClasses.argKeyFloatValueList, and python.trfArgClasses.argIntList.

Definition at line 370 of file trfArgClasses.py.

370  def prodsysDescription(self):
371  desc = {'type' : 'list', 'listtype': 'str'}
372  if self._supressEmptyStrings:
373  desc['supress Empty Strings'] = self._supressEmptyStrings
374  return desc
375 
376 

◆ value() [1/2]

def python.trfArgClasses.argList.value (   self)

Argument value getter.

Returns
Current value

Reimplemented from python.trfArgClasses.argument.

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

Definition at line 365 of file trfArgClasses.py.

365  def value(self):
366  return self._value
367 

◆ value() [2/2]

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

Argument value setter.

If we get a list then set that, otherwise we split a string on the splitter character

Reimplemented from python.trfArgClasses.argument.

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

Definition at line 380 of file trfArgClasses.py.

380  def value(self, value):
381  if isinstance(value, (list, tuple)):
382  self._value = list(value)
383  elif value is None:
384  self._value = []
385  return
386  else:
387  try:
388  if self._supressEmptyStrings:
389  self._value = [ v for v in value.split(self._splitter) if v != '' ]
390  else:
391  self._value = value.split(self._splitter)
392  except AttributeError:
393  raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'),
394  'Failed to convert %s to a list' % str(value))
395 

Member Data Documentation

◆ _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.argList._splitter
private

Definition at line 357 of file trfArgClasses.py.

◆ _supressEmptyStrings

python.trfArgClasses.argList._supressEmptyStrings
private

Definition at line 358 of file trfArgClasses.py.

◆ _value

python.trfArgClasses.argList._value
private

Definition at line 382 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:
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
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
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