Factory class used to generate argument class instances for argparse.
More...
Factory class used to generate argument class instances for argparse.
Definition at line 31 of file trfArgClasses.py.
◆ __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
◆ __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
42
43 try:
44
45
46
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
◆ _args
| python.trfArgClasses.argFactory._args = args |
|
protected |
◆ _genclass
| python.trfArgClasses.argFactory._genclass = genclass |
|
protected |
◆ _kwargs
| python.trfArgClasses.argFactory._kwargs = kwargs |
|
protected |
The documentation for this class was generated from the following file: