mock_snakemake: remove dangeours empty list as default argument

This commit is contained in:
Fabian Neumann 2024-02-17 18:14:18 +01:00
parent b14d84eb39
commit db7c983950
2 changed files with 5 additions and 12 deletions

View File

@ -30,7 +30,6 @@ if run["name"]:
else: else:
RDIR = "" RDIR = ""
# for possibly shared resources
logs = path_provider("logs/", RDIR, run["shared_resources"]) logs = path_provider("logs/", RDIR, run["shared_resources"])
benchmarks = path_provider("benchmarks/", RDIR, run["shared_resources"]) benchmarks = path_provider("benchmarks/", RDIR, run["shared_resources"])
resources = path_provider("resources/", RDIR, run["shared_resources"]) resources = path_provider("resources/", RDIR, run["shared_resources"])
@ -38,14 +37,6 @@ resources = path_provider("resources/", RDIR, run["shared_resources"])
CDIR = "" if run["shared_cutouts"] else RDIR CDIR = "" if run["shared_cutouts"] else RDIR
RESULTS = "results/" + RDIR RESULTS = "results/" + RDIR
# TODO: this needs to be aligned with new scenario management
# if not (shared_resources := run.get("shared_resources")):
# RESOURCES = "resources/" + RDIR
# elif isinstance(shared_resources, str):
# RESOURCES = "resources/" + shared_resources + "/"
# else:
# RESOURCES = "resources/"
localrules: localrules:
purge, purge,

View File

@ -321,7 +321,7 @@ def progress_retrieve(url, file, disable=False):
def mock_snakemake( def mock_snakemake(
rulename, rulename,
root_dir=None, root_dir=None,
configfiles=[], configfiles=None,
submodule_dir="workflow/submodules/pypsa-eur", submodule_dir="workflow/submodules/pypsa-eur",
**wildcards, **wildcards,
): ):
@ -375,7 +375,9 @@ def mock_snakemake(
if os.path.exists(p): if os.path.exists(p):
snakefile = p snakefile = p
break break
if isinstance(configfiles, str): if configfiles is None:
configfiles = []
elif isinstance(configfiles, str):
configfiles = [configfiles] configfiles = [configfiles]
workflow = sm.Workflow( workflow = sm.Workflow(
@ -397,7 +399,7 @@ def mock_snakemake(
def make_accessable(*ios): def make_accessable(*ios):
for io in ios: for io in ios:
for i in range(len(io)): for i, _ in enumerate(io):
io[i] = os.path.abspath(io[i]) io[i] = os.path.abspath(io[i])
make_accessable(job.input, job.output, job.log) make_accessable(job.input, job.output, job.log)