From fa3a7265a216a76aaf1bf849b41fe1d71da67853 Mon Sep 17 00:00:00 2001 From: bswck Date: Fri, 2 Feb 2024 11:36:43 +0100 Subject: [PATCH] First strip, then filter assigned topics It was possible to get empty strings as topics. --- jaraco/develop/git.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jaraco/develop/git.py b/jaraco/develop/git.py index e539c7c..fd1a2ba 100644 --- a/jaraco/develop/git.py +++ b/jaraco/develop/git.py @@ -128,8 +128,8 @@ def parse(cls, line): match = types.SimpleNamespace(**cls.pattern.match(line).groupdict()) tags = list(re.findall(r'\[(.*?)\]', rest := match.rest.rstrip())) topics_assigned = re.match(r'[^\(\)]*\((.+)\)$', rest) - topics = topics_assigned and filter(None, topics_assigned.group(1).split(',')) - return cls(match.name, tags=tags, topics=list(map(str.strip, topics or ()))) + topics = topics_assigned and map(str.strip, topics_assigned.group(1).split(',')) + return cls(match.name, tags=tags, topics=list(filter(None, topics or ()))) @property def rtd_slug(self):