Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forbid prexing every key when adapt_likelihood_config_for_blueice #170

Merged
merged 8 commits into from
Jun 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading