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

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-05-03 09:29:35 +00:00 committed by Fabian Neumann
parent e75e3bd8d7
commit 0fb68d11d8

View File

@ -106,8 +106,11 @@ def get_run_path(fn, dir, rdir, shared_resources, exclude):
existing_wildcards = set(re.findall(pattern, fn)) existing_wildcards = set(re.findall(pattern, fn))
irrelevant_wildcards = {"technology", "year", "scope", "kind"} irrelevant_wildcards = {"technology", "year", "scope", "kind"}
no_relevant_wildcards = not existing_wildcards - irrelevant_wildcards no_relevant_wildcards = not existing_wildcards - irrelevant_wildcards
no_elec_rule = not fn.startswith("networks/elec") and not fn.startswith( no_elec_rule = (
"add_electricity") and not any(fn.startswith(ex) for ex in exclude) not fn.startswith("networks/elec")
and not fn.startswith("add_electricity")
and not any(fn.startswith(ex) for ex in exclude)
)
is_shared = no_relevant_wildcards and no_elec_rule is_shared = no_relevant_wildcards and no_elec_rule
rdir = "" if is_shared else rdir rdir = "" if is_shared else rdir
elif isinstance(shared_resources, str): elif isinstance(shared_resources, str):
@ -133,7 +136,13 @@ def path_provider(dir, rdir, shared_resources, exclude):
A partial function that takes a filename as input and A partial function that takes a filename as input and
returns the path to the file based on the shared_resources parameter. returns the path to the file based on the shared_resources parameter.
""" """
return partial(get_run_path, dir=dir, rdir=rdir, shared_resources=shared_resources, exclude=exclude) return partial(
get_run_path,
dir=dir,
rdir=rdir,
shared_resources=shared_resources,
exclude=exclude,
)
def get_opt(opts, expr, flags=None): def get_opt(opts, expr, flags=None):