Skip to content

Commit

Permalink
Forbid prexing every key when adapt_likelihood_config_for_blueice (#170)
Browse files Browse the repository at this point in the history
* forbid prexing every key

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* shorter docstr

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* type fix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* type fix

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
FaroutYLq and pre-commit-ci[bot] authored Jun 27, 2024
1 parent 13e9e8d commit 19cf822
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions alea/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,20 @@ def get_analysis_space(analysis_space: list) -> list:
return eval_analysis_space


def _prefix_file_path(config: dict, template_folder_list: list):
def _prefix_file_path(
config: dict, template_folder_list: list, ignore_keys: List[str] = ["name", "histname"]
):
"""Prefix file path with template_folder_list whenever possible.
Args:
config (dict): dictionary contains file path
template_folder_list (list): list of possible base folders. Ordered by priority.
ignore_keys (list, optional (default=["name", "histname"])):
keys to be ignored when prefixing
"""
for key in config.keys():
if isinstance(config[key], str):
if isinstance(config[key], str) and key not in ignore_keys:
try:
config[key] = get_file_path(config[key], template_folder_list)
except RuntimeError:
Expand Down

0 comments on commit 19cf822

Please sign in to comment.