Apply formatting

This commit is contained in:
Serene-Arc 2024-03-01 15:12:19 +10:00
parent dae525741b
commit 83242fd7cf
14 changed files with 40 additions and 37 deletions

View file

@ -122,8 +122,7 @@ class NamedQuery(Query):
"""
@abstractmethod
def __init__(self, pattern):
...
def __init__(self, pattern): ...
P = TypeVar("P")

View file

@ -35,8 +35,7 @@ if TYPE_CHECKING and sys.version_info >= (3, 8):
given type.
"""
def __init__(self, value: Any = None):
...
def __init__(self, value: Any = None): ...
else:
# No structural subtyping in Python < 3.8...

View file

@ -216,12 +216,14 @@ def get_singleton_disambig_fields(info: hooks.TrackInfo) -> Sequence[str]:
calculated_values = {
"index": "Index {}".format(str(info.index)),
"track_alt": "Track {}".format(info.track_alt),
"album": "[{}]".format(info.album)
"album": (
"[{}]".format(info.album)
if (
config["import"]["singleton_album_disambig"].get()
and info.get("album")
)
else "",
else ""
),
}
for field in chosen_fields:
@ -240,9 +242,11 @@ def get_album_disambig_fields(info: hooks.AlbumInfo) -> Sequence[str]:
out = []
chosen_fields = config["match"]["album_disambig_fields"].as_str_seq()
calculated_values = {
"media": "{}x{}".format(info.mediums, info.media)
"media": (
"{}x{}".format(info.mediums, info.media)
if (info.mediums and info.mediums > 1)
else info.media,
else info.media
),
}
for field in chosen_fields:
@ -1160,9 +1164,11 @@ class TerminalImportSession(importer.ImportSession):
print_(
"Old: "
+ summarize_items(
(
list(duplicate.items())
if task.is_album
else [duplicate],
else [duplicate]
),
not task.is_album,
)
)

View file

@ -74,7 +74,7 @@ class ExportPlugin(BeetsPlugin):
"xml": {
# XML module formatting options.
"formatting": {}
}
},
# TODO: Use something like the edit plugin
# 'item_fields': []
}

View file

@ -5,6 +5,7 @@ like the following in your config.yaml to configure:
file: 644
dir: 755
"""
import os
import stat

View file

@ -819,9 +819,9 @@ class GStreamerBackend(Backend):
self._files = [i.path for i in items]
# FIXME: Turn this into DefaultDict[bytes, Gain]
self._file_tags: DefaultDict[
bytes, Dict[str, float]
] = collections.defaultdict(dict)
self._file_tags: DefaultDict[bytes, Dict[str, float]] = (
collections.defaultdict(dict)
)
self._rg.set_property("reference-level", target_level)
@ -930,9 +930,9 @@ class GStreamerBackend(Backend):
tag
)[1]
elif tag == self.Gst.TAG_REFERENCE_LEVEL:
self._file_tags[self._file][
"REFERENCE_LEVEL"
] = taglist.get_double(tag)[1]
self._file_tags[self._file]["REFERENCE_LEVEL"] = (
taglist.get_double(tag)[1]
)
tags.foreach(handle_tag, None)

View file

@ -1,6 +1,5 @@
"""Tests for the 'ihate' plugin"""
import unittest
from beets import importer

View file

@ -89,12 +89,16 @@ class LyricsPluginTest(unittest.TestCase):
("CHVRCHΞS", ["song"]), list(lyrics.search_pairs(item))[0]
)
item = Item(artist="横山克", title="song", artist_sort="Masaru Yokoyama")
item = Item(
artist="横山克", title="song", artist_sort="Masaru Yokoyama"
)
self.assertIn(("横山克", ["song"]), lyrics.search_pairs(item))
self.assertIn(("Masaru Yokoyama", ["song"]), lyrics.search_pairs(item))
# Make sure that the original artist name is still the first entry
self.assertEqual(("横山克", ["song"]), list(lyrics.search_pairs(item))[0])
self.assertEqual(
("横山克", ["song"]), list(lyrics.search_pairs(item))[0]
)
def test_search_pairs_multi_titles(self):
item = Item(title="1 / 2", artist="A")

View file

@ -1,6 +1,5 @@
"""Tests for the 'spotify' plugin"""
import os
import unittest
from urllib.parse import parse_qs, urlparse

View file

@ -1,6 +1,5 @@
"""Tests for the 'subsonic' plugin."""
import unittest
from urllib.parse import parse_qs, urlparse

View file

@ -1,6 +1,5 @@
"""Tests for the 'the' plugin"""
import unittest
from beets import config

View file

@ -1,6 +1,5 @@
"""Tests for the 'web' plugin"""
import json
import os.path
import platform

View file

@ -1,6 +1,5 @@
"""Tests for the 'zero' plugin"""
import unittest
from mediafile import MediaFile

View file

@ -71,12 +71,12 @@ class MetaSyncTest(_common.TestCase, TestHelper):
items[1].album = "An Awesome Wave"
if _is_windows():
items[
0
].path = "G:\\Music\\Alt-J\\An Awesome Wave\\03 Tessellate.mp3"
items[
1
].path = "G:\\Music\\Alt-J\\An Awesome Wave\\04 Breezeblocks.mp3"
items[0].path = (
"G:\\Music\\Alt-J\\An Awesome Wave\\03 Tessellate.mp3"
)
items[1].path = (
"G:\\Music\\Alt-J\\An Awesome Wave\\04 Breezeblocks.mp3"
)
else:
items[0].path = "/Music/Alt-J/An Awesome Wave/03 Tessellate.mp3"
items[1].path = "/Music/Alt-J/An Awesome Wave/04 Breezeblocks.mp3"