Attain pep8-cleanliness

No more E12 or E501
This commit is contained in:
Bruno Cauet 2015-01-04 17:29:31 +01:00
parent d409da8753
commit f5c5666729
9 changed files with 16 additions and 17 deletions

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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):

View file

@ -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:

View file

@ -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

View file

@ -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.

View file

@ -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')

View file

@ -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'')