Skip to content

Commit

Permalink
fix: allow labels function to return None (#1565)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Apr 5, 2022
1 parent 624a83d commit fef74d6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions snakemake/report/__init__.py
Expand Up @@ -229,12 +229,12 @@ def expand_report_argument(item, wildcards, job):

class Category:
def __init__(self, name, wildcards, job):
if name is not None:
name = expand_report_argument(name, wildcards, job)
if name is None:
name = "Other"
self.is_other = True
else:
self.is_other = False
name = expand_report_argument(name, wildcards, job)

self.is_other = name == "Other"
self.name = name
h = hashlib.sha256()
h.update(name.encode())
Expand Down Expand Up @@ -548,6 +548,9 @@ def expand_labels(labels, wildcards, job):
return None
labels = expand_report_argument(labels, wildcards, job)

if labels is None:
return None

if not isinstance(labels, dict) or not all(
isinstance(col, str) for col in labels.values()
):
Expand Down

0 comments on commit fef74d6

Please sign in to comment.