From 83242fd7cf0ae14b6c3c12026931d9e25b37002c Mon Sep 17 00:00:00 2001 From: Serene-Arc <33189705+Serene-Arc@users.noreply.github.com> Date: Fri, 1 Mar 2024 15:12:19 +1000 Subject: [PATCH] Apply formatting --- beets/dbcore/query.py | 3 +-- beets/dbcore/types.py | 3 +-- beets/ui/commands.py | 30 +++++++++++++++++------------ beetsplug/export.py | 2 +- beetsplug/permissions.py | 1 + beetsplug/replaygain.py | 12 ++++++------ test/plugins/test_ihate.py | 1 - test/plugins/test_lyrics.py | 8 ++++++-- test/plugins/test_spotify.py | 1 - test/plugins/test_subsonicupdate.py | 1 - test/plugins/test_the.py | 1 - test/plugins/test_web.py | 1 - test/plugins/test_zero.py | 1 - test/test_metasync.py | 12 ++++++------ 14 files changed, 40 insertions(+), 37 deletions(-) diff --git a/beets/dbcore/query.py b/beets/dbcore/query.py index 9806d5226..890acbe72 100644 --- a/beets/dbcore/query.py +++ b/beets/dbcore/query.py @@ -122,8 +122,7 @@ class NamedQuery(Query): """ @abstractmethod - def __init__(self, pattern): - ... + def __init__(self, pattern): ... P = TypeVar("P") diff --git a/beets/dbcore/types.py b/beets/dbcore/types.py index 9b9c688da..5ce26ad1e 100644 --- a/beets/dbcore/types.py +++ b/beets/dbcore/types.py @@ -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... diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 26eb5320a..87fc00782 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -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) - if ( - config["import"]["singleton_album_disambig"].get() - and info.get("album") - ) - else "", + "album": ( + "[{}]".format(info.album) + if ( + config["import"]["singleton_album_disambig"].get() + and info.get("album") + ) + 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) - if (info.mediums and info.mediums > 1) - else info.media, + "media": ( + "{}x{}".format(info.mediums, info.media) + if (info.mediums and info.mediums > 1) + 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], + ( + list(duplicate.items()) + if task.is_album + else [duplicate] + ), not task.is_album, ) ) diff --git a/beetsplug/export.py b/beetsplug/export.py index 825d63be3..ef3ba94aa 100644 --- a/beetsplug/export.py +++ b/beetsplug/export.py @@ -74,7 +74,7 @@ class ExportPlugin(BeetsPlugin): "xml": { # XML module formatting options. "formatting": {} - } + }, # TODO: Use something like the edit plugin # 'item_fields': [] } diff --git a/beetsplug/permissions.py b/beetsplug/permissions.py index 191c27019..8f58f24b2 100644 --- a/beetsplug/permissions.py +++ b/beetsplug/permissions.py @@ -5,6 +5,7 @@ like the following in your config.yaml to configure: file: 644 dir: 755 """ + import os import stat diff --git a/beetsplug/replaygain.py b/beetsplug/replaygain.py index b04c40862..78640b6a8 100644 --- a/beetsplug/replaygain.py +++ b/beetsplug/replaygain.py @@ -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) diff --git a/test/plugins/test_ihate.py b/test/plugins/test_ihate.py index 5f81269b7..fdd656703 100644 --- a/test/plugins/test_ihate.py +++ b/test/plugins/test_ihate.py @@ -1,6 +1,5 @@ """Tests for the 'ihate' plugin""" - import unittest from beets import importer diff --git a/test/plugins/test_lyrics.py b/test/plugins/test_lyrics.py index 44a8edb35..108f299fb 100644 --- a/test/plugins/test_lyrics.py +++ b/test/plugins/test_lyrics.py @@ -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") diff --git a/test/plugins/test_spotify.py b/test/plugins/test_spotify.py index 832e558fa..59c604a5f 100644 --- a/test/plugins/test_spotify.py +++ b/test/plugins/test_spotify.py @@ -1,6 +1,5 @@ """Tests for the 'spotify' plugin""" - import os import unittest from urllib.parse import parse_qs, urlparse diff --git a/test/plugins/test_subsonicupdate.py b/test/plugins/test_subsonicupdate.py index 1e1f4eb43..3f84d848f 100644 --- a/test/plugins/test_subsonicupdate.py +++ b/test/plugins/test_subsonicupdate.py @@ -1,6 +1,5 @@ """Tests for the 'subsonic' plugin.""" - import unittest from urllib.parse import parse_qs, urlparse diff --git a/test/plugins/test_the.py b/test/plugins/test_the.py index 6f8b05883..e6d510774 100644 --- a/test/plugins/test_the.py +++ b/test/plugins/test_the.py @@ -1,6 +1,5 @@ """Tests for the 'the' plugin""" - import unittest from beets import config diff --git a/test/plugins/test_web.py b/test/plugins/test_web.py index 2fe35282d..afd1ed706 100644 --- a/test/plugins/test_web.py +++ b/test/plugins/test_web.py @@ -1,6 +1,5 @@ """Tests for the 'web' plugin""" - import json import os.path import platform diff --git a/test/plugins/test_zero.py b/test/plugins/test_zero.py index 7c3337e87..f48675c5c 100644 --- a/test/plugins/test_zero.py +++ b/test/plugins/test_zero.py @@ -1,6 +1,5 @@ """Tests for the 'zero' plugin""" - import unittest from mediafile import MediaFile diff --git a/test/test_metasync.py b/test/test_metasync.py index 426334670..7e9cd595c 100644 --- a/test/test_metasync.py +++ b/test/test_metasync.py @@ -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"