|
def | __iter__ (self) |
| Iterate over fields. More...
|
|
def | keys (self) |
| Return the list of field names. More...
|
|
def | values (self) |
| Return the list of field values. More...
|
|
def | items (self) |
| Return the list of (field name, field value) pairs. More...
|
|
def | iteritems (self) |
| Iterate over (field name, field value) pairs. More...
|
|
def | itervalues (self) |
| Iterate over field values. More...
|
|
def | iterkeys (self) |
| Iterate over field names. More...
|
|
def | __contains__ (self, name) |
| Return True if the specified field exists in this config. More...
|
|
def | __new__ (cls, args, kw) |
| Allocate a new Config object. More...
|
|
def | __reduce__ (self) |
|
def | setDefaults (self) |
|
def | update (self, kw) |
| Update values specified by the keyword arguments. More...
|
|
def | load (self, filename, root="config") |
| Modify this config in place by executing the Python code in the named file. More...
|
|
def | loadFromStream (self, stream, root="config", filename=None) |
| Modify this config in place by executing the python code in the provided stream. More...
|
|
def | save (self, filename, root="config") |
| Save a python script to the named file, which, when loaded, reproduces this Config. More...
|
|
def | saveToStream (self, outfile, root="config") |
| Save a python script to a stream, which, when loaded, reproduces this Config. More...
|
|
def | freeze (self) |
| Make this Config and all sub-configs read-only. More...
|
|
def | toDict (self) |
| Return a dict of field name: value. More...
|
|
def | validate (self) |
| Validate the Config; raise an exception if invalid. More...
|
|
def | formatHistory (self, name, kwargs) |
| Format the specified config field's history to a more human-readable format. More...
|
|
def | __setattr__ (self, attr, value, at=None, label="assignment") |
| Regulate which attributes can be set. More...
|
|
def | __delattr__ (self, attr, at=None, label="deletion") |
|
def | __eq__ (self, other) |
|
def | __ne__ (self, other) |
|
def | __str__ (self) |
|
def | __repr__ (self) |
|
def | compare (self, other, shortcut=True, rtol=1E-8, atol=1E-8, output=None) |
| Compare two Configs for equality; return True if equal. More...
|
|
def | __setattr__ (self, name, value) |
|
Base class for control objects.
A Config object will usually have several Field instances as class
attributes; these are used to define most of the base class behavior.
Simple derived class should be able to be defined simply by setting those
attributes.
Config also emulates a dict of field name: field value
Definition at line 420 of file config.py.
def lsst.pex.config.config.Config.__new__ |
( |
|
cls, |
|
|
|
args, |
|
|
|
kw |
|
) |
| |
Allocate a new Config object.
In order to ensure that all Config object are always in a proper state when handed to users or to derived Config classes, some attributes are handled at allocation time rather than at initialization
This ensures that even if a derived Config class implements init, the author does not need to be concerned about when or even if he should call the base Config.__init__
Definition at line 473 of file config.py.
def lsst.pex.config.config.Config.__setattr__ |
( |
|
self, |
|
|
|
attr, |
|
|
|
value, |
|
|
|
at = None , |
|
|
|
label = "assignment" |
|
) |
| |
Regulate which attributes can be set.
Unlike normal python objects, Config objects are locked such that no additional attributes nor properties may be added to them dynamically.
Although this is not the standard Python behavior, it helps to protect users from accidentally mispelling a field name, or trying to set a non-existent field.
Definition at line 707 of file config.py.
def lsst.pex.config.config.Config.compare |
( |
|
self, |
|
|
|
other, |
|
|
|
shortcut = True , |
|
|
|
rtol = 1E-8 , |
|
|
|
atol = 1E-8 , |
|
|
|
output = None |
|
) |
| |
Compare two Configs for equality; return True if equal.
If the Configs contain RegistryFields or ConfigChoiceFields, unselected Configs will not be compared.
- Parameters
-
[in] | other | Config object to compare with self. |
[in] | shortcut | If True, return as soon as an inequality is found. |
[in] | rtol | Relative tolerance for floating point comparisons. |
[in] | atol | Absolute tolerance for floating point comparisons. |
[in] | output | If not None, a callable that takes a string, used (possibly repeatedly) to report inequalities. |
Floating point comparisons are performed by numpy.allclose; refer to that for details.
Definition at line 766 of file config.py.
def lsst.pex.config.config.Config.validate |
( |
|
self | ) |
|
Validate the Config; raise an exception if invalid.
The base class implementation performs type checks on all fields by calling Field.validate().
Complex single-field validation can be defined by deriving new Field types. As syntactic sugar, some derived Field types are defined in this module which handle recursing into sub-configs (ConfigField, ConfigChoiceField)
Inter-field relationships should only be checked in derived Config classes after calling this method, and base validation is complete
Definition at line 675 of file config.py.