Skip to content

module config.parser

Configuration parser.


class ConfigParser

Configuration parser for ZARP-cli.

Args:

  • config_file: Path to ZARP-cli configuration file.

Attributes:

  • config_file: Path to ZARP-cli configuration file.
  • config: ZARP-cli configuration.

method __init__

__init__(config_file: Union[Path, str])

Class constructor.


method parse_yaml

parse_yaml(path: Path)  Dict

Serialize YAML file contents into a dictionary.

Args:

  • path: Path to YAML file.

Returns: Serialized YAML file contents.

Raises:

  • FileNotFoundError: File does not exist.
  • OSError: File could not be read.
  • ValueError: File is not valid YAML.

method set_from_file

set_from_file()  None

Set configuration based on configuration file.

Raises:

  • ValueError: Configuration file contains invalid arguments.

method update_from_mapping

update_from_mapping(config_mapping: Mapping)  None

Update ZARP-cli configuration from dictionary.

Only parameters will be updated for whom arguments are available and which are not None.

Args:

  • config_mapping: Mapping of ZARP-cli configuration items.

Raises:

  • ValueError: Configuration could not be updated because either the currently set configuration or the configuration dictionary are invalid.