configconfig.parser
-
class
Parser
(allow_unknown_keys=False)[source] Base class for YAML configuration parsers.
Custom parsing steps for each configuration variable can be implemented with methods in the form:
def visit_<configuration value name>( self, raw_config_vars: Dict[str, Any], ) -> Any: ...
The method must return the value to set the configuration variable to, or raise an error in the case of invalid input.
A final custom parsing step, useful when several values must be set at once, may be implemented in the
custom_parsing
method:def custom_parsing( self, raw_config_vars: Mapping[str, Any], parsed_config_vars: MutableMapping[str, Any], filename: PathPlus, ) -> MutableMapping[str, Any]: ...
This takes the mapping of raw configuration variables, the mapping of parsed variables (those set with the
visit_<configuration value name>
method), and the configuration file name. The method must return theparsed_config_vars
.Methods:
custom_parsing
(raw_config_vars, …)Custom parsing step.
run
(filename)Parse configuration from the given file.