Make configuration and metadata objects immutable
This patch changes how configuration and metadata objects are built.
Before this patch, the YAML configuration parser in `config.py` created
default metadata objects and then set their properties as it parsed the
YAML node.
Having such mutable objects means they can change at anytime once they
exist.
This patch changes this so that all configuration and metadata objects
accept all they need at construction time and do not offer setters.
`config.py` now only contains the `Config` and `ConfigOptions` classes
as well as the from_file() function. All the YAML parsing and
configuration/metadata construction is in `config_parse.py`.
In `config_parse.py`, there are mutable "pseudo" classes which
correspond to the immutable versions. They are only used during the
parsing stage and, at the end, converted to their public, immutable
equivalents.
The configuration validation is done at the YAML/pseudo level, which
means the public configuration/metadata classes do not validate anything
(narrow contract). Their constructors _should_ at least assert that
everything looks okay, but this work is not part of this patch.
No functional changes intended by this patch at the CLI level, which is
why all tests still pass without modification.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.024204 seconds and 4 git commands to generate.