|
SourceXtractorPlusPlus
0.12
Please provide a description of the project.
|
Public Member Functions | |
| def | __init__ (self, kwargs) |
| def | __getattr__ (self, item) |
| def | __str__ (self) |
| def | __repr__ (self) |
Private Attributes | |
| __args | |
This helper class automatically parses the arguments received by the Python script via
sys.argv, using the set of key-value parameters received on its constructor to cast the types
and define the defaults.
Parameters
----------
kwargs
A set of key-values with the defaults, or the types of the expected values. For instance, it is valid to do
both:
key1 = 32.
key2 = float
For the first case - a value -, if no value is passed via sys.argv, this will be the default. Otherwise,
its type (float) will be used to cast the received value.
For the second case - a type -, if no value is passed via sys.argv, the parameter will default to None.
Otherwise, the type will be used to cast the received value.
Callables are also accepted. They should accept to be called with no parameters, returning the default,
or with a single string, returning the parsed value.
Values can be accessed later as attributes:
instance.key1 and instance.key2
Raises
------
ValueError
If the cast of the parameter failed (i.e. an invalid integer or float format)
KeyError
If additional unknown parameters are received
| def sourcextractor.config.argv.Arguments.__init__ | ( | self, | |
| kwargs | |||
| ) |
| def sourcextractor.config.argv.Arguments.__getattr__ | ( | self, | |
| item | |||
| ) |
Parameters
----------
item : str
Name of the parameter to retrieve
Returns
-------
The parsed value of the parameter
Raises
------
AttributeError
If item has not been defined on construction
Definition at line 88 of file argv.py.
References sourcextractor.config.argv.Arguments.__args.
| def sourcextractor.config.argv.Arguments.__repr__ | ( | self | ) |
Returns
-------
str
String representation for the object
Definition at line 118 of file argv.py.
References sourcextractor.config.argv.Arguments.__args.
| def sourcextractor.config.argv.Arguments.__str__ | ( | self | ) |
Returns
-------
str
Human readable representation for the object
Definition at line 109 of file argv.py.
References sourcextractor.config.argv.Arguments.__args.
|
private |
Definition at line 64 of file argv.py.
Referenced by sourcextractor.config.argv.Arguments.__getattr__(), sourcextractor.config.argv.Arguments.__repr__(), and sourcextractor.config.argv.Arguments.__str__().
1.8.14