From 746e8aebd38349e68ed61e46b7efe77f0a79925c Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Tue, 2 Apr 2024 21:38:51 +0200 Subject: [PATCH] update sublocation, and honour recursive argument --- pyproject.toml | 2 +- scabha/evaluator.py | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 306a7a5..8fb29f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stimela" -version = "2.0rc17" +version = "2.0rc18" description = "Framework for system agnostic pipelines for (not just) radio interferometry" authors = ["Sphesihle Makhathini ", "Oleg Smirnov and RATT "] readme = "README.rst" diff --git a/scabha/evaluator.py b/scabha/evaluator.py index 8dde3d1..ee19cc8 100644 --- a/scabha/evaluator.py +++ b/scabha/evaluator.py @@ -580,7 +580,7 @@ def evaluate_dict(self, params: Dict[str, Any], defaults: Dict[str, Any] = {}, sublocation = [], raise_substitution_errors: bool = True, - recursive: bool = False, + recursive: bool = True, verbose: bool = False): params_out = params for name, value in list(params.items()): @@ -625,27 +625,27 @@ def evaluate_dict(self, params: Dict[str, Any], params_out[name] = new_value if corresponding_ns: corresponding_ns[name] = new_value - elif isinstance(value, (dict, DictConfig)): + elif isinstance(value, (dict, DictConfig)) and recursive: params_out[name] = self.evaluate_dict( value, corresponding_ns, defaults, - sublocation, - raise_substitution_errors, - recursive, - verbose + sublocation=sublocation + [name], + raise_substitution_errors=raise_substitution_errors, + recursive=True, + verbose=verbose ) - elif isinstance(value, (list, ListConfig)): + elif isinstance(value, (list, ListConfig)) and recursive: params_out[name] = type(value)( [ *self.evaluate_dict( {f"[{i}]": v for i, v in enumerate(value)}, corresponding_ns, defaults, - sublocation, - raise_substitution_errors, - recursive, - verbose + sublocation=sublocation + [name], + raise_substitution_errors=raise_substitution_errors, + recursive=True, + verbose=verbose ).values() ] )