From f5c56667295373eed8f4a7692aada45dcadebfaf Mon Sep 17 00:00:00 2001 From: Bruno Cauet Date: Sun, 4 Jan 2015 17:29:31 +0100 Subject: [PATCH] Attain pep8-cleanliness No more E12 or E501 --- beets/logging.py | 4 ++-- beets/ui/commands.py | 2 +- beets/util/artresizer.py | 2 +- beetsplug/echonest.py | 2 +- beetsplug/embedart.py | 5 +++-- beetsplug/lastimport.py | 6 ++---- beetsplug/mpdstats.py | 3 +-- beetsplug/play.py | 3 +-- beetsplug/spotify.py | 6 ++++-- 9 files changed, 16 insertions(+), 17 deletions(-) diff --git a/beets/logging.py b/beets/logging.py index b2e8bb5aa..2168c6a95 100644 --- a/beets/logging.py +++ b/beets/logging.py @@ -22,8 +22,8 @@ class StrFormatLogger(Logger): def _log(self, level, msg, args, exc_info=None, extra=None, **kwargs): """Log msg.format(*args, **kwargs)""" - msg = self._LogMessage(msg, args, kwargs) - return super(StrFormatLogger, self)._log(level, msg, (), exc_info, extra) + m = self._LogMessage(msg, args, kwargs) + return super(StrFormatLogger, self)._log(level, m, (), exc_info, extra) my_manager = copy(Logger.manager) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 14b0a6afd..5883f37a3 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1023,7 +1023,7 @@ def update_items(lib, query, album, move, pretend): item.read() except library.ReadError as exc: log.error(u'error reading {0}: {1}', - displayable_path(item.path), exc) + displayable_path(item.path), exc) continue # Special-case album artist when it matches track artist. (Hacky diff --git a/beets/util/artresizer.py b/beets/util/artresizer.py index 3bac1539f..101f5711e 100644 --- a/beets/util/artresizer.py +++ b/beets/util/artresizer.py @@ -69,7 +69,7 @@ def pil_resize(maxwidth, path_in, path_out=None): return path_out except IOError: log.error(u"PIL cannot create thumbnail for '{0}'", - util.displayable_path(path_in)) + util.displayable_path(path_in)) return path_in diff --git a/beetsplug/echonest.py b/beetsplug/echonest.py index 7ebe2c0c3..809a3fae2 100644 --- a/beetsplug/echonest.py +++ b/beetsplug/echonest.py @@ -412,7 +412,7 @@ class EchonestMetadataPlugin(plugins.BeetsPlugin): item.artist, item.title, song.get('duration'), - ) + ) return song def apply_metadata(self, item, values, write=False): diff --git a/beetsplug/embedart.py b/beetsplug/embedart.py index 72e8b17fc..a7df5a2a0 100644 --- a/beetsplug/embedart.py +++ b/beetsplug/embedart.py @@ -192,8 +192,9 @@ def check_art_similarity(item, imagepath, compare_threshold): stdout, stderr = proc.communicate() if proc.returncode: if proc.returncode != 1: - log.warn(u'embedart: IM phashes compare failed for {0}, {1}', - displayable_path(imagepath), displayable_path(art)) + log.warn(u'embedart: IM hashes compare failed for ' + u'{0}, {1}', displayable_path(imagepath), + displayable_path(art)) return phashDiff = float(stderr) else: diff --git a/beetsplug/lastimport.py b/beetsplug/lastimport.py index 138efbe1f..9f9011dc3 100644 --- a/beetsplug/lastimport.py +++ b/beetsplug/lastimport.py @@ -67,8 +67,7 @@ def import_lastfm(lib): while page_current < page_total: log.info('lastimport: Querying page #{0}{1}...', page_current + 1, - '/{}'.format(page_total) if page_total > 1 else '' - ) + '/{}'.format(page_total) if page_total > 1 else '') for retry in range(0, retry_limit): page = fetch_tracks(user, page_current + 1, per_page) @@ -172,8 +171,7 @@ def process_tracks(lib, tracks): new_count = int(tracks[num]['playcount']) log.debug(u'lastimport: match: {0} - {1} ({2}) ' u'updating: play_count {3} => {4}', - song.artist, song.title, song.album, count, new_count - ) + song.artist, song.title, song.album, count, new_count) song['play_count'] = new_count song.store() total_found += 1 diff --git a/beetsplug/mpdstats.py b/beetsplug/mpdstats.py index d8596c1a3..6c0be72c2 100644 --- a/beetsplug/mpdstats.py +++ b/beetsplug/mpdstats.py @@ -193,8 +193,7 @@ class MPDStats(object): log.debug(u'mpdstats: updated: {0} = {1} [{2}]', attribute, item[attribute], - displayable_path(item.path), - ) + displayable_path(item.path)) def update_rating(self, item, skipped): """Update the rating for a beets item. diff --git a/beetsplug/play.py b/beetsplug/play.py index 1de61261c..687760ff4 100644 --- a/beetsplug/play.py +++ b/beetsplug/play.py @@ -103,8 +103,7 @@ def play_music(lib, opts, args): if output: log.debug(u'Output of {0}: {1}', util.displayable_path(command[0]), - output.decode('utf8', 'ignore'), - ) + output.decode('utf8', 'ignore')) else: log.debug(u'play: no output') diff --git a/beetsplug/spotify.py b/beetsplug/spotify.py index 273dd432b..89b4a2d62 100644 --- a/beetsplug/spotify.py +++ b/beetsplug/spotify.py @@ -132,7 +132,8 @@ class SpotifyPlugin(BeetsPlugin): chosen_result = r_data[0] elif len(r_data) > 1: # Use the popularity filter - log.debug(u'Most popular track chosen, count: {0}', len(r_data)) + log.debug(u'Most popular track chosen, count: {0}', + len(r_data)) chosen_result = max(r_data, key=lambda x: x['popularity']) if chosen_result: @@ -144,7 +145,8 @@ class SpotifyPlugin(BeetsPlugin): failure_count = len(failures) if failure_count > 0: if self.config['show_failures'].get(): - log.info(u'{0} track(s) did not match a Spotify ID:', failure_count) + log.info(u'{0} track(s) did not match a Spotify ID:', + failure_count) for track in failures: log.info(u'track: {0}', track) log.info(u'')