mirror of
https://github.com/beetbox/beets.git
synced 2025-12-22 08:34:23 +01:00
Merge pull request #2023 from untitaker/python-modernize
Py3 compat: Run python-modernize across the codebase
This commit is contained in:
commit
5dcea9cb0f
5 changed files with 16 additions and 6 deletions
|
|
@ -349,7 +349,10 @@ 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_and_dist: (-key_and_dist[1], key_and_dist[0])
|
||||
)
|
||||
|
||||
# Behave like a float.
|
||||
|
||||
|
|
|
|||
|
|
@ -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 item_and_track_info: item_and_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
|
||||
|
|
@ -441,8 +441,10 @@ def summarize_items(items, singleton):
|
|||
summary_parts.append(items[0].format)
|
||||
else:
|
||||
# Enumerate all the formats by decreasing frequencies:
|
||||
for fmt, count in sorted(format_counts.items(),
|
||||
key=lambda (f, c): (-c, f)):
|
||||
for fmt, count in sorted(
|
||||
format_counts.items(),
|
||||
key=lambda fmt_and_count: (-fmt_and_count[1], fmt_and_count[0])
|
||||
):
|
||||
summary_parts.append('{0} {1}'.format(fmt, count))
|
||||
|
||||
if items:
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ import ast
|
|||
import dis
|
||||
import types
|
||||
|
||||
from .confit import NUMERIC_TYPES
|
||||
|
||||
SYMBOL_DELIM = u'$'
|
||||
FUNC_DELIM = u'%'
|
||||
GROUP_OPEN = u'{'
|
||||
|
|
@ -72,7 +74,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, NUMERIC_TYPES):
|
||||
return ast.Num(val)
|
||||
elif isinstance(val, bool):
|
||||
return ast.Name(bytes(val), ast.Load())
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ 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')
|
||||
|
|
|
|||
Loading…
Reference in a new issue