From a5c32e8d59ef2ea02ded4f35aca32e732e06f33e Mon Sep 17 00:00:00 2001 From: Jean-Louis Fuchs Date: Fri, 5 Apr 2024 11:19:52 +0200 Subject: [PATCH] Revert "doc: ai update config_file.py" --- pyaptly/config_file.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/pyaptly/config_file.py b/pyaptly/config_file.py index ad67bb5..aeef53d 100644 --- a/pyaptly/config_file.py +++ b/pyaptly/config_file.py @@ -7,13 +7,9 @@ def yaml_to_toml(yaml_path: Path, toml_path: Path, *, add_defaults: bool = False): - """ - Convert pyaptly config files from YAML to TOML format. + """Convert pyaptly config files from yaml to toml. - The conversion process reads a configuration from the file located at `yaml_path`, - converts it to TOML format, and writes the result to the file specified by - `toml_path`. If `add_defaults` is set to True, common defaults are applied during - the conversion. + Setting `add_defaults=True` will set common default during conversion. """ with yaml_path.open("r", encoding="UTF-8") as yf: with toml_path.open("wb") as tf: @@ -23,14 +19,8 @@ def yaml_to_toml(yaml_path: Path, toml_path: Path, *, add_defaults: bool = False tomli_w.dump(config, tf) -def add_default_to_config(config: dict): - """ - Set common defaults in `config` if the fields are missing. - - This function checks for missing 'components' and 'distribution' fields under both - 'mirror' and 'publish' sections of the configuration. If these fields are missing, - it sets them to 'main'. - """ +def add_default_to_config(config): + """Set common default in config if the fields are missing.""" if "mirror" in config: for mirror in config["mirror"].values(): if "components" not in mirror: