diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py index d0e3d9c75..92a7b8e29 100644 --- a/beets/autotag/hooks.py +++ b/beets/autotag/hooks.py @@ -547,7 +547,7 @@ def albums_for_id(album_id): for a in plugin_albums: plugins.send(u'albuminfo_received', info=a) candidates.extend(plugin_albums) - return filter(None, candidates) + return [a for a in candidates if a] def tracks_for_id(track_id): @@ -557,7 +557,7 @@ def tracks_for_id(track_id): for t in plugin_tracks: plugins.send(u'trackinfo_received', info=t) candidates.extend(plugin_tracks) - return filter(None, candidates) + return [t for t in candidates if t] def album_candidates(items, artist, album, va_likely): diff --git a/beetsplug/missing.py b/beetsplug/missing.py index 8fff659fe..b99a70d9e 100644 --- a/beetsplug/missing.py +++ b/beetsplug/missing.py @@ -133,7 +133,7 @@ class MissingPlugin(BeetsPlugin): def _missing(self, album): """Query MusicBrainz to determine items missing from `album`. """ - item_mbids = map(lambda x: x.mb_trackid, album.items()) + item_mbids = [x.mb_trackid for x in album.items()] if len([i for i in album.items()]) < album.albumtotal: # fetch missing items # TODO: Implement caching that without breaking other stuff diff --git a/beetsplug/spotify.py b/beetsplug/spotify.py index 081a027f2..77df15790 100644 --- a/beetsplug/spotify.py +++ b/beetsplug/spotify.py @@ -124,9 +124,8 @@ class SpotifyPlugin(BeetsPlugin): # Apply market filter if requested region_filter = self.config['region_filter'].get() if region_filter: - r_data = filter( - lambda x: region_filter in x['available_markets'], r_data - ) + r_data = [x for x in r_data if region_filter + in x['available_markets']] # Simplest, take the first result chosen_result = None @@ -163,7 +162,7 @@ class SpotifyPlugin(BeetsPlugin): def output_results(self, results): if results: - ids = map(lambda x: x['id'], results) + ids = [x['id'] for x in results] if self.config['mode'].get() == "open": self._log.info(u'Attempting to open Spotify with playlist') spotify_url = self.playlist_partial + ",".join(ids) diff --git a/test/test_query.py b/test/test_query.py index 79bc11743..7f45b1c68 100644 --- a/test/test_query.py +++ b/test/test_query.py @@ -37,11 +37,11 @@ from beets import util class TestHelper(helper.TestHelper): def assertInResult(self, item, results): # noqa - result_ids = map(lambda i: i.id, results) + result_ids = [i.id for i in results] self.assertIn(item.id, result_ids) def assertNotInResult(self, item, results): # noqa - result_ids = map(lambda i: i.id, results) + result_ids = [i.id for i in results] self.assertNotIn(item.id, result_ids)