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:
RDIR = ""
# for possibly shared resources
logs = path_provider("logs/", RDIR, run["shared_resources"])
benchmarks = path_provider("benchmarks/", 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
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:
purge,

View File

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