From fef74d6406a04e29c115a699e76ac96e4a37cf9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20K=C3=B6ster?= Date: Tue, 5 Apr 2022 10:53:40 +0200 Subject: [PATCH] fix: allow labels function to return None (#1565) --- snakemake/report/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/snakemake/report/__init__.py b/snakemake/report/__init__.py index 8c93fbda7..67ad901c8 100644 --- a/snakemake/report/__init__.py +++ b/snakemake/report/__init__.py @@ -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()) @@ -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() ):