Skip to content

files_legacy

This module handles the legacy config file format.

Functions:

read_ini_file

read_ini_file(file_path: Path) -> Dict[str, Any]

Parse an INI file and return a dictionary of sections and their options.

PARAMETER DESCRIPTION
file_path

The path to the INI file.

TYPE: Path

RETURNS DESCRIPTION
dict

A dictionary of sections and their options.

TYPE: Dict[str, Any]

update_ini_config_file

update_ini_config_file(config_file: Union[str, Path], current_version: str, new_version: str, dry_run: bool = False) -> None

Update the current_version key in the configuration file.

Instead of parsing and re-writing the config file with new information, it will use a regular expression to just replace the current_version value. The idea is it will avoid unintentional changes (like formatting) to the config file.

PARAMETER DESCRIPTION
config_file

The configuration file to explicitly use.

TYPE: Union[str, Path]

current_version

The serialized current version.

TYPE: str

new_version

The serialized new version.

TYPE: str

dry_run

True if the update should be a dry run.

TYPE: bool DEFAULT: False