From 99db34bb1df539643993c691594773094bddab0c Mon Sep 17 00:00:00 2001 From: "i.nueske" <i.nueske@indiscale.com> Date: Wed, 4 Dec 2024 17:29:50 +0100 Subject: [PATCH] MNT: More robust timeout parsing, update changelog --- CHANGELOG.md | 2 ++ src/linkahead/configuration.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03afb6a..fc48014 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `auth_token` if new value is `None` * [#119](https://gitlab.com/linkahead/linkahead-pylib/-/issues/119) The diff returned by compare_entities now uses id instead of name as key if either property does not have a name +* [#127](https://gitlab.com/linkahead/linkahead-pylib/-/issues/127) + pylinkahead.ini now supports None and tuples as values for the `timeout` keyword ### Security ### diff --git a/src/linkahead/configuration.py b/src/linkahead/configuration.py index e11749f..a87aca4 100644 --- a/src/linkahead/configuration.py +++ b/src/linkahead/configuration.py @@ -90,10 +90,12 @@ def config_to_yaml(config: ConfigParser) -> dict[str, dict[str, Union[int, str, if key in ["debug"]: valobj[s][key] = int(value) elif key in ["timeout"]: + value = "".join(value.split()) # Remove whitespace if str(value).lower() in ["none", "null"]: valobj[s][key] = None elif value.startswith('(') and value.endswith(')'): - content = [int(s) for s in value[1:-1].split(',')] + content = [None if str(s).lower() in ["none", "null"] else int(s) + for s in value[1:-1].split(',')] valobj[s][key] = tuple(content) else: valobj[s][key] = int(value) -- GitLab