From 1e812093187a0fec7387c1345d7c8cce9c7f6ccb Mon Sep 17 00:00:00 2001 From: J0J0 Todos Date: Thu, 16 Nov 2023 13:22:19 +0100 Subject: [PATCH] Refactor lastgenre keep_allowed to list comprehension --- beetsplug/lastgenre/__init__.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index 751e687864..d2f11093f1 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -319,11 +319,7 @@ def _get_genre(self, obj): genres = obj.get("genre", with_album=False).split(", ") else: genres = obj.get("genre").split(", ") - keep_allowed = [] - for g in genres: - allowed = self._is_allowed(g) - if allowed: - keep_allowed.append(g) + keep_allowed = [g for g in genres if self._is_allowed(g)] if keep_allowed: keep_allowed = set(keep_allowed) return ", ".join(keep_allowed), "keep"