From 8c8c2c830babb6d79c20dee64ad78ac643be664c Mon Sep 17 00:00:00 2001 From: gadorlhiac Date: Fri, 3 May 2024 10:17:42 -0700 Subject: [PATCH] ENH Add support for substitutions in header. Convert back to numeric values --- lute/io/config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lute/io/config.py b/lute/io/config.py index 83f965b1..84f3e87a 100644 --- a/lute/io/config.py +++ b/lute/io/config.py @@ -157,6 +157,8 @@ def substitute_variables( else: sub = f"{sub}" iterable[param] = re.sub(pattern, sub, iterable[param]) + # Reconvert back to numeric values if needed... + iterable[param] = _check_str_numeric(iterable[param]) def parse_config(task_name: str = "test", config_path: str = "") -> TaskParameters: @@ -182,6 +184,7 @@ def parse_config(task_name: str = "test", config_path: str = "") -> TaskParamete docs: Iterator[Dict[str, Any]] = yaml.load_all(stream=f, Loader=yaml.FullLoader) header: Dict[str, Any] = next(docs) config: Dict[str, Any] = next(docs) + substitute_variables(header, header) substitute_variables(header, config) LUTE_DEBUG_EXIT("LUTE_DEBUG_EXIT_AT_YAML", pprint.pformat(config)) lute_config: Dict[str, AnalysisHeader] = {"lute_config": AnalysisHeader(**header)}