Skip to content

Commit

Permalink
Refactor lastgenre keep_allowed to list comprehension
Browse files Browse the repository at this point in the history
  • Loading branch information
JOJ0 committed Nov 16, 2023
1 parent 5e55a46 commit 1e81209
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions beetsplug/lastgenre/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1e81209

Please sign in to comment.