From 822069ccfd227ca7d31353f858a38c3fe4000f32 Mon Sep 17 00:00:00 2001 From: "i.nueske" <i.nueske@indiscale.com> Date: Wed, 4 Dec 2024 14:38:12 +0100 Subject: [PATCH] ENH: Support separate connect/read timeouts and timeout None in pylinkahead.ini --- src/linkahead/configuration.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/linkahead/configuration.py b/src/linkahead/configuration.py index 017743e..c72c46e 100644 --- a/src/linkahead/configuration.py +++ b/src/linkahead/configuration.py @@ -33,9 +33,10 @@ try: # Adapted from https://github.com/python-jsonschema/jsonschema/issues/148 # Defines Validator to allow parsing of all iterables as array in jsonschema + # CustomValidator can be removed if/once jsonschema allows tuples for arrays from collections.abc import Iterable from jsonschema import validators - default = validators._LATEST_VERSION + default = validators.validator_for(True) # Returns latest supported draft t_c = (default.TYPE_CHECKER.redefine('array', lambda x, y: isinstance(y, Iterable))) CustomValidator = validators.extend(default, type_checker=t_c) except ImportError: @@ -86,7 +87,9 @@ def config_to_yaml(config: ConfigParser) -> dict[str, dict[str, Union[int, str, valobj[s] = {} for key, value in config[s].items(): # TODO: Can the type be inferred from the config object? - if key in ["timeout", "debug"]: + if key in ["debug"]: + valobj[s][key] = int(value) + if key in ["timeout"]: if str(value).lower() in ["none", "null"]: valobj[s][key] = None elif value.startswith('(') and value.endswith(')'): -- GitLab