ATLAS Offline Software
Loading...
Searching...
No Matches
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 Types

typedef HLT::TypeInformation::for_each_type_c< typenameEDMLIST::map, my_functor, my_result<>, my_arg< HLT::TypeInformation::get_cont, CONTAINER > >::type result

Public Member Functions

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

Protected Attributes

 _genclass = genclass
 _args = args
 _kwargs = kwargs

Detailed Description

Factory class used to generate argument class instances for argparse.

Definition at line 31 of file trfArgClasses.py.

Member Typedef Documentation

◆ result

Definition at line 90 of file EDM_MasterSearch.h.

Constructor & Destructor Documentation

◆ __init__()

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__()

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__()

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 = args
protected

Definition at line 35 of file trfArgClasses.py.

◆ _genclass

python.trfArgClasses.argFactory._genclass = genclass
protected

Definition at line 34 of file trfArgClasses.py.

◆ _kwargs

python.trfArgClasses.argFactory._kwargs = kwargs
protected

Definition at line 36 of file trfArgClasses.py.


The documentation for this class was generated from the following file: