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

Factory class used to generate argument class instances for argparse. More...

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

Public Member Functions

def __init__ (self, genclass, *args, **kwargs)
 
def __call__ (self, valueString=None)
 
def __str__ (self)
 

Private Attributes

 _genclass
 
 _args
 
 _kwargs
 

Detailed Description

Factory class used to generate argument class instances for argparse.

Definition at line 31 of file trfArgClasses.py.

Constructor & Destructor Documentation

◆ __init__()

def python.trfArgClasses.argFactory.__init__ (   self,
  genclass,
args,
**  kwargs 
)

Definition at line 32 of file trfArgClasses.py.

32  def __init__(self, genclass, *args, **kwargs):
33  msg.debug('Initialised class %s with args=%s; kwargs=%s', genclass, args, kwargs)
34  self._genclass = genclass
35  self._args = args
36  self._kwargs = kwargs
37 

Member Function Documentation

◆ __call__()

def python.trfArgClasses.argFactory.__call__ (   self,
  valueString = None 
)

Definition at line 38 of file trfArgClasses.py.

38  def __call__(self, valueString=None):
39  msg.debug('Called class %s with value=%s; args=%s; kwargs=%s', self._genclass, valueString, self._args, self._kwargs)
40 
41  # Wrap this step in our own try/except because if this goes wrong we want to see the exception
42  # instead of having it masked by the argparse module
43  try:
44  # Passing None suppresses the value passed to the constructor, thus the constructor's own
45  # default value is used - generally this will match the default value for the underlying
46  # python object
47  if valueString is None:
48  obj = self._genclass(*self._args, **self._kwargs)
49  else:
50  obj = self._genclass(valueString, *self._args, **self._kwargs)
51  except Exception as e:
52  msg.fatal('Got this exception raised when calling object factory: {0}'.format(e))
53  raise
54  return obj
55 

◆ __str__()

def python.trfArgClasses.argFactory.__str__ (   self)

Definition at line 56 of file trfArgClasses.py.

56  def __str__(self):
57  return 'argFactory for {0}, args {1}, kwargs {2}'.format(self._genclass, self._args, self._kwargs)
58 
59 

Member Data Documentation

◆ _args

python.trfArgClasses.argFactory._args
private

Definition at line 35 of file trfArgClasses.py.

◆ _genclass

python.trfArgClasses.argFactory._genclass
private

Definition at line 34 of file trfArgClasses.py.

◆ _kwargs

python.trfArgClasses.argFactory._kwargs
private

Definition at line 36 of file trfArgClasses.py.


The documentation for this class was generated from the following file:
vtune_athena.format
format
Definition: vtune_athena.py:14
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18