diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py index 5c8e0e2c5..8f0a98104 100644 --- a/beets/autotag/hooks.py +++ b/beets/autotag/hooks.py @@ -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. diff --git a/beets/library.py b/beets/library.py index ed1938671..bb6873d2d 100644 --- a/beets/library.py +++ b/beets/library.py @@ -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 diff --git a/beets/ui/commands.py b/beets/ui/commands.py index a2669e688..2d9f3cdb1 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -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: diff --git a/beets/util/confit.py b/beets/util/confit.py index ac1cb7023..6d35667bc 100644 --- a/beets/util/confit.py +++ b/beets/util/confit.py @@ -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): diff --git a/beets/util/functemplate.py b/beets/util/functemplate.py index b4097baba..16d21cd58 100644 --- a/beets/util/functemplate.py +++ b/beets/util/functemplate.py @@ -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()) diff --git a/extra/release.py b/extra/release.py index 7bbc080c4..cf368c8f3 100755 --- a/extra/release.py +++ b/extra/release.py @@ -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() diff --git a/test/test_thumbnails.py b/test/test_thumbnails.py index 30c5bb234..24a1bc92d 100644 --- a/test/test_thumbnails.py +++ b/test/test_thumbnails.py @@ -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')