Skip to content

Commit

Permalink
ENH Add support for substitutions in header. Convert back to numeric …
Browse files Browse the repository at this point in the history
…values
  • Loading branch information
gadorlhiac committed May 3, 2024
1 parent 0f2d04d commit 8c8c2c8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lute/io/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)}
Expand Down

0 comments on commit 8c8c2c8

Please sign in to comment.