devops.config.config_file

Module to parse file configuration values.

Functions

parse_changelog_path(table)

Parse the changelog paths from a configuration table.

parse_default_changelog_path(table)

Parse the default changelog path from a configuration table.

parse_encoding(table)

Parse the encoding from a configuration table.

parse_file_config(raw_config)

Parse file configuration from a raw dictionary.

Classes

FileConfig([encoding, changelog_paths, ...])

Dataclass to hold file configuration values.

class devops.config.config_file.FileConfig(encoding='utf-8', changelog_paths=<factory>, _default_changelog_path=None)[source]

Bases: object

Dataclass to hold file configuration values.

Parameters:
  • encoding (str)

  • changelog_paths (list[Path])

  • _default_changelog_path (Path | None)

encoding: str = 'utf-8'
changelog_paths: list[Path]
property default_changelog_path: Path

Get the default changelog path.

Returns:

Path – The default changelog path.

to_toml_lines()[source]

Convert the FileConfig to TOML lines.

Returns:

list[str] – The list of TOML lines representing the configuration.

Return type:

list[str]

devops.config.config_file.parse_file_config(raw_config)[source]

Parse file configuration from a raw dictionary.

Parameters:

raw_config (dict) – The raw file configuration dictionary.

Returns:

FileConfig – The parsed FileConfig dataclass instance.

Raises:

ConfigError – If the specified encoding is invalid.

Return type:

FileConfig

devops.config.config_file.parse_encoding(table)[source]

Parse the encoding from a configuration table.

Parameters:

table (dict) – The configuration table.

Returns:

str – The parsed encoding.

Raises:

ConfigError – If the specified encoding is invalid.

Return type:

str

devops.config.config_file.parse_changelog_path(table)[source]

Parse the changelog paths from a configuration table.

Parameters:

table (dict) – The configuration table.

Returns:

list[Path] – The parsed list of changelog paths.

Return type:

list[Path]

devops.config.config_file.parse_default_changelog_path(table)[source]

Parse the default changelog path from a configuration table.

Parameters:

table (dict) – The configuration table.

Returns:

Path | None – The parsed default changelog path, or None if not specified.

Return type:

Path | None