Run python-modernize across the codebase

This commit is contained in:
Markus Unterwaditzer 2016-05-27 23:13:01 +02:00
parent 7970681289
commit 1ae6ce04dd
7 changed files with 12 additions and 10 deletions

View file

@ -349,7 +349,7 @@ class Distance(object):
# Convert distance into a negative float we can sort items in
# ascending order (for keys, when the penalty is equal) and
# still get the items with the biggest distance first.
return sorted(list_, key=lambda (key, dist): (0 - dist, key))
return sorted(list_, key=lambda key_dist: (0 - key_dist[1], key_dist[0]))
# Behave like a float.

View file

@ -559,7 +559,7 @@ class Item(LibModel):
for key in self._media_fields:
value = getattr(mediafile, key)
if isinstance(value, (int, long)):
if isinstance(value, (int, int)):
if value.bit_length() > 63:
value = 0
self[key] = value

View file

@ -280,7 +280,7 @@ def show_change(cur_artist, cur_album, match):
# Tracks.
pairs = match.mapping.items()
pairs.sort(key=lambda (_, track_info): track_info.index)
pairs.sort(key=lambda __track_info: __track_info[1].index)
# Build up LHS and RHS for track difference display. The `lines` list
# contains ``(lhs, rhs, width)`` tuples where `width` is the length (in
@ -442,7 +442,7 @@ def summarize_items(items, singleton):
else:
# Enumerate all the formats by decreasing frequencies:
for fmt, count in sorted(format_counts.items(),
key=lambda (f, c): (-c, f)):
key=lambda f_c: (-f_c[1], f_c[0])):
summary_parts.append('{0} {1}'.format(fmt, count))
if items:

View file

@ -49,7 +49,7 @@ REDACTED_TOMBSTONE = 'REDACTED'
PY3 = sys.version_info[0] == 3
STRING = str if PY3 else unicode
BASESTRING = str if PY3 else basestring
NUMERIC_TYPES = (int, float) if PY3 else (int, float, long)
NUMERIC_TYPES = (int, float) if PY3 else (int, float, int)
def iter_first(sequence):

View file

@ -72,7 +72,7 @@ def ex_literal(val):
"""
if val is None:
return ast.Name(b'None', ast.Load())
elif isinstance(val, (int, float, long)):
elif isinstance(val, (int, float, int)):
return ast.Num(val)
elif isinstance(val, bool):
return ast.Name(bytes(val), ast.Load())

View file

@ -3,6 +3,8 @@
"""A utility script for automating the beets release process.
"""
from __future__ import absolute_import
from __future__ import print_function
import click
import os
import re
@ -110,7 +112,7 @@ def bump_version(version):
out_lines.append(line)
if not found:
print("No pattern found in {}".format(filename))
print(("No pattern found in {}".format(filename)))
# Write the file back.
with open(filename, 'w') as f:
@ -212,7 +214,7 @@ def changelog_as_markdown():
def changelog():
"""Get the most recent version's changelog as Markdown.
"""
print(changelog_as_markdown())
print((changelog_as_markdown()))
def get_version(index=0):
@ -233,7 +235,7 @@ def get_version(index=0):
def version():
"""Display the current version.
"""
print(get_version())
print((get_version()))
@release.command()

View file

@ -114,7 +114,7 @@ class ThumbnailsTest(unittest.TestCase, TestHelper):
self.assertEqual(ThumbnailsPlugin().get_uri, giouri_inst.uri)
giouri_inst.available = False
self.assertEqual(ThumbnailsPlugin().get_uri.im_class, PathlibURI)
self.assertEqual(ThumbnailsPlugin().get_uri.__self__.__class__, PathlibURI)
@patch('beetsplug.thumbnails.ThumbnailsPlugin._check_local_ok')
@patch('beetsplug.thumbnails.ArtResizer')