diff --git a/beets/__main__.py b/beets/__main__.py index 81995f7af..3473c6319 100644 --- a/beets/__main__.py +++ b/beets/__main__.py @@ -16,7 +16,6 @@ `python -m beets`. """ - import sys from .ui import main diff --git a/beets/art.py b/beets/art.py index 466d40005..2ff58c309 100644 --- a/beets/art.py +++ b/beets/art.py @@ -16,7 +16,6 @@ music and items' embedded album art. """ - import os from tempfile import NamedTemporaryFile diff --git a/beets/autotag/__init__.py b/beets/autotag/__init__.py index abbc07772..a67531a69 100644 --- a/beets/autotag/__init__.py +++ b/beets/autotag/__init__.py @@ -12,8 +12,8 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Facilities for automatically determining files' correct metadata. -""" +"""Facilities for automatically determining files' correct metadata.""" + from typing import Mapping, Sequence, Union from beets import config, logging diff --git a/beets/autotag/match.py b/beets/autotag/match.py index 23f81ce92..fe391b4cf 100644 --- a/beets/autotag/match.py +++ b/beets/autotag/match.py @@ -16,7 +16,6 @@ releases and tracks. """ - from __future__ import annotations import datetime diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py index 80ac6c8ed..2ea5f7baa 100644 --- a/beets/autotag/mb.py +++ b/beets/autotag/mb.py @@ -12,8 +12,8 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Searches for albums in the MusicBrainz database. -""" +"""Searches for albums in the MusicBrainz database.""" + from __future__ import annotations import re diff --git a/beets/dbcore/db.py b/beets/dbcore/db.py index 566c11631..4645d4b09 100755 --- a/beets/dbcore/db.py +++ b/beets/dbcore/db.py @@ -1224,9 +1224,7 @@ class Database: UNIQUE(entity_id, key) ON CONFLICT REPLACE); CREATE INDEX IF NOT EXISTS {0}_by_entity ON {0} (entity_id); - """.format( - flex_table - ) + """.format(flex_table) ) # Querying. diff --git a/beets/dbcore/types.py b/beets/dbcore/types.py index 432db2b72..11d850b8b 100644 --- a/beets/dbcore/types.py +++ b/beets/dbcore/types.py @@ -12,8 +12,8 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Representation of type information for DBCore model fields. -""" +"""Representation of type information for DBCore model fields.""" + import typing from abc import ABC from typing import Any, Generic, List, TypeVar, Union, cast diff --git a/beets/importer.py b/beets/importer.py index 3a290a033..6fed3a02d 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -627,8 +627,7 @@ class ImportTask(BaseImportTask): self.save_progress() if session.config["incremental"] and not ( # Should we skip recording to incremental list? - self.skip - and session.config["incremental_skip_later"] + self.skip and session.config["incremental_skip_later"] ): self.save_history() diff --git a/beets/logging.py b/beets/logging.py index faa93d59d..34fc7bafa 100644 --- a/beets/logging.py +++ b/beets/logging.py @@ -20,7 +20,6 @@ use {}-style formatting and can interpolate keywords arguments to the logging calls (`debug`, `info`, etc). """ - import logging import threading from copy import copy diff --git a/beets/plugins.py b/beets/plugins.py index 35995c341..5df738c84 100644 --- a/beets/plugins.py +++ b/beets/plugins.py @@ -14,7 +14,6 @@ """Support for beets plugins.""" - import abc import inspect import re diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 8580bd1e8..f84ce06d0 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -17,7 +17,6 @@ interface. To invoke the CLI, just call beets.ui.main(). The actual CLI commands are implemented in the ui.commands module. """ - import errno import optparse import os.path @@ -318,7 +317,7 @@ def input_options( # Wrap the query text. # Start prompt with U+279C: Heavy Round-Tipped Rightwards Arrow - prompt = colorize("action", "\u279C ") + prompt = colorize("action", "\u279c ") line_length = 0 for i, (part, length) in enumerate( zip(prompt_parts, prompt_part_lengths) @@ -387,7 +386,7 @@ def input_yn(prompt, require=False): "yes" unless `require` is `True`, in which case there is no default. """ # Start prompt with U+279C: Heavy Round-Tipped Rightwards Arrow - yesno = colorize("action", "\u279C ") + colorize( + yesno = colorize("action", "\u279c ") + colorize( "action_description", "Enter Y or N:" ) sel = input_options(("y", "n"), require, prompt, yesno) @@ -1497,9 +1496,7 @@ class SubcommandsOptionParser(CommonOptionsParser): """ # A more helpful default usage. if "usage" not in kwargs: - kwargs[ - "usage" - ] = """ + kwargs["usage"] = """ %prog COMMAND [ARGS...] %prog help COMMAND""" kwargs["add_help_option"] = False diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 24cae1dd1..5d0ac206a 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -16,7 +16,6 @@ interface. """ - import os import re from collections import Counter @@ -1317,8 +1316,7 @@ def import_files(lib, paths, query): loghandler = logging.FileHandler(logpath, encoding="utf-8") except OSError: raise ui.UserError( - "could not open log file for writing: " - "{}".format(displayable_path(logpath)) + f"Could not open log file for writing: {displayable_path(logpath)}" ) else: loghandler = None diff --git a/beets/util/functemplate.py b/beets/util/functemplate.py index 7d7e8f01f..b0daefac2 100644 --- a/beets/util/functemplate.py +++ b/beets/util/functemplate.py @@ -26,7 +26,6 @@ This is sort of like a tiny, horrible degeneration of a real templating engine like Jinja2 or Mustache. """ - import ast import dis import functools diff --git a/beets/util/pipeline.py b/beets/util/pipeline.py index c4933ff00..d23b1bd10 100644 --- a/beets/util/pipeline.py +++ b/beets/util/pipeline.py @@ -31,7 +31,6 @@ To do so, pass an iterable of coroutines to the Pipeline constructor in place of any single coroutine. """ - import queue import sys from threading import Lock, Thread diff --git a/beetsplug/__init__.py b/beetsplug/__init__.py index 763ff3a05..ad573cdb3 100644 --- a/beetsplug/__init__.py +++ b/beetsplug/__init__.py @@ -14,7 +14,6 @@ """A namespace package for beets plugins.""" - # Make this a namespace package. from pkgutil import extend_path diff --git a/beetsplug/absubmit.py b/beetsplug/absubmit.py index fc40b85e7..bbbc14edf 100644 --- a/beetsplug/absubmit.py +++ b/beetsplug/absubmit.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Calculate acoustic information and submit to AcousticBrainz. -""" - +"""Calculate acoustic information and submit to AcousticBrainz.""" import errno import hashlib @@ -187,9 +185,9 @@ only files which would be processed", with open(filename) as tmp_file: analysis = json.load(tmp_file) # Add the hash to the output. - analysis["metadata"]["version"][ - "essentia_build_sha" - ] = self.extractor_sha + analysis["metadata"]["version"]["essentia_build_sha"] = ( + self.extractor_sha + ) return analysis finally: try: diff --git a/beetsplug/acousticbrainz.py b/beetsplug/acousticbrainz.py index a4b153fc9..899288260 100644 --- a/beetsplug/acousticbrainz.py +++ b/beetsplug/acousticbrainz.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Fetch various AcousticBrainz metadata using MBID. -""" +"""Fetch various AcousticBrainz metadata using MBID.""" from collections import defaultdict diff --git a/beetsplug/albumtypes.py b/beetsplug/albumtypes.py index 5200b5c6d..b1e143a88 100644 --- a/beetsplug/albumtypes.py +++ b/beetsplug/albumtypes.py @@ -14,7 +14,6 @@ """Adds an album template field for formatted album types.""" - from beets.autotag.mb import VARIOUS_ARTISTS_ID from beets.library import Album from beets.plugins import BeetsPlugin diff --git a/beetsplug/aura.py b/beetsplug/aura.py index 09d859200..5ddf85190 100644 --- a/beetsplug/aura.py +++ b/beetsplug/aura.py @@ -14,7 +14,6 @@ """An AURA server using Flask.""" - import os import re import sys diff --git a/beetsplug/badfiles.py b/beetsplug/badfiles.py index 056b65346..f596189ac 100644 --- a/beetsplug/badfiles.py +++ b/beetsplug/badfiles.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Use command-line tools to check for audio file corruption. -""" - +"""Use command-line tools to check for audio file corruption.""" import errno import os diff --git a/beetsplug/bareasc.py b/beetsplug/bareasc.py index 8cdcbb113..0a867dfe1 100644 --- a/beetsplug/bareasc.py +++ b/beetsplug/bareasc.py @@ -18,7 +18,6 @@ """Provides a bare-ASCII matching query.""" - from unidecode import unidecode from beets import ui diff --git a/beetsplug/beatport.py b/beetsplug/beatport.py index 6108b0399..fab720c2b 100644 --- a/beetsplug/beatport.py +++ b/beetsplug/beatport.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Adds Beatport release and track search support to the autotagger -""" +"""Adds Beatport release and track search support to the autotagger""" import json import re diff --git a/beetsplug/bench.py b/beetsplug/bench.py index 673b9b7c6..62d512ce7 100644 --- a/beetsplug/bench.py +++ b/beetsplug/bench.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Some simple performance benchmarks for beets. -""" - +"""Some simple performance benchmarks for beets.""" import cProfile import timeit diff --git a/beetsplug/bpd/__init__.py b/beetsplug/bpd/__init__.py index a4cb4d291..c78452ee8 100644 --- a/beetsplug/bpd/__init__.py +++ b/beetsplug/bpd/__init__.py @@ -17,7 +17,6 @@ Beets library. Attempts to implement a compatible protocol to allow use of the wide range of MPD clients. """ - import inspect import math import random diff --git a/beetsplug/bpd/gstplayer.py b/beetsplug/bpd/gstplayer.py index 77ddc1983..03fb179aa 100644 --- a/beetsplug/bpd/gstplayer.py +++ b/beetsplug/bpd/gstplayer.py @@ -16,7 +16,6 @@ music player. """ - import _thread import copy import os diff --git a/beetsplug/bpm.py b/beetsplug/bpm.py index 3edcbef82..10edfbfd7 100644 --- a/beetsplug/bpm.py +++ b/beetsplug/bpm.py @@ -14,7 +14,6 @@ """Determine BPM by pressing a key to the rhythm.""" - import time from beets import ui diff --git a/beetsplug/bpsync.py b/beetsplug/bpsync.py index 4f3e0e907..05be94c99 100644 --- a/beetsplug/bpsync.py +++ b/beetsplug/bpsync.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Update library's tags using Beatport. -""" +"""Update library's tags using Beatport.""" from beets import autotag, library, ui, util from beets.plugins import BeetsPlugin, apply_item_changes diff --git a/beetsplug/bucket.py b/beetsplug/bucket.py index 59ee080bb..9246539fc 100644 --- a/beetsplug/bucket.py +++ b/beetsplug/bucket.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Provides the %bucket{} function for path formatting. -""" - +"""Provides the %bucket{} function for path formatting.""" import re import string diff --git a/beetsplug/convert.py b/beetsplug/convert.py index f150b7c36..a1d068033 100644 --- a/beetsplug/convert.py +++ b/beetsplug/convert.py @@ -12,8 +12,8 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Converts tracks or albums to external directory -""" +"""Converts tracks or albums to external directory""" + import logging import os import shlex diff --git a/beetsplug/deezer.py b/beetsplug/deezer.py index 70ebe8a92..6f05474b9 100644 --- a/beetsplug/deezer.py +++ b/beetsplug/deezer.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Adds Deezer release and track search support to the autotagger -""" +"""Adds Deezer release and track search support to the autotagger""" import collections import time @@ -112,8 +111,8 @@ class DeezerPlugin(MetadataSourcePlugin, BeetsPlugin): day = None else: raise ui.UserError( - "Invalid `release_date` returned " - "by {} API: '{}'".format(self.data_source, release_date) + f"Invalid `release_date` returned by {self.data_source} API: " + f"{release_date!r}" ) tracks_obj = self.fetch_data(self.album_url + deezer_id + "/tracks") if tracks_obj is None: diff --git a/beetsplug/duplicates.py b/beetsplug/duplicates.py index ced96e403..a5f2bc815 100644 --- a/beetsplug/duplicates.py +++ b/beetsplug/duplicates.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""List duplicate tracks or albums. -""" +"""List duplicate tracks or albums.""" import os import shlex diff --git a/beetsplug/edit.py b/beetsplug/edit.py index 323dd9e41..51b36bdab 100644 --- a/beetsplug/edit.py +++ b/beetsplug/edit.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Open metadata information in a text editor to let the user edit it. -""" +"""Open metadata information in a text editor to let the user edit it.""" import codecs import os diff --git a/beetsplug/embyupdate.py b/beetsplug/embyupdate.py index 22c889473..2cda6af5e 100644 --- a/beetsplug/embyupdate.py +++ b/beetsplug/embyupdate.py @@ -1,11 +1,11 @@ """Updates the Emby Library whenever the beets library is changed. - emby: - host: localhost - port: 8096 - username: user - apikey: apikey - password: password +emby: + host: localhost + port: 8096 + username: user + apikey: apikey + password: password """ import hashlib diff --git a/beetsplug/export.py b/beetsplug/export.py index ef3ba94aa..9b8ad3580 100644 --- a/beetsplug/export.py +++ b/beetsplug/export.py @@ -11,9 +11,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Exports data from beets -""" - +"""Exports data from beets""" import codecs import csv diff --git a/beetsplug/fetchart.py b/beetsplug/fetchart.py index aab214334..0da884278 100644 --- a/beetsplug/fetchart.py +++ b/beetsplug/fetchart.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Fetches album art. -""" +"""Fetches album art.""" import os import re diff --git a/beetsplug/filefilter.py b/beetsplug/filefilter.py index 5618c1bd1..b78a3750e 100644 --- a/beetsplug/filefilter.py +++ b/beetsplug/filefilter.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Filter imported files using a regular expression. -""" - +"""Filter imported files using a regular expression.""" import re diff --git a/beetsplug/fish.py b/beetsplug/fish.py index 71ac85743..4cf9b60a1 100644 --- a/beetsplug/fish.py +++ b/beetsplug/fish.py @@ -22,7 +22,6 @@ by default but can be added via the `-e` / `--extravalues` flag. For example: `beet fish -e genre -e albumartist` """ - import os from operator import attrgetter diff --git a/beetsplug/freedesktop.py b/beetsplug/freedesktop.py index a9a25279c..50bbf18e5 100644 --- a/beetsplug/freedesktop.py +++ b/beetsplug/freedesktop.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Creates freedesktop.org-compliant .directory files on an album level. -""" - +"""Creates freedesktop.org-compliant .directory files on an album level.""" from beets import ui from beets.plugins import BeetsPlugin diff --git a/beetsplug/ftintitle.py b/beetsplug/ftintitle.py index 60d6c287b..5bc018fe1 100644 --- a/beetsplug/ftintitle.py +++ b/beetsplug/ftintitle.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Moves "featured" artists to the title from the artist field. -""" +"""Moves "featured" artists to the title from the artist field.""" import re diff --git a/beetsplug/fuzzy.py b/beetsplug/fuzzy.py index 45ada8b0b..959544ed3 100644 --- a/beetsplug/fuzzy.py +++ b/beetsplug/fuzzy.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Provides a fuzzy matching query. -""" - +"""Provides a fuzzy matching query.""" import difflib diff --git a/beetsplug/importfeeds.py b/beetsplug/importfeeds.py index 316c1c72b..0a5a6afe4 100644 --- a/beetsplug/importfeeds.py +++ b/beetsplug/importfeeds.py @@ -17,6 +17,7 @@ music player. Also allow printing the new file locations to stdout in case one wants to manually add music to a player by its path. """ + import datetime import os import re diff --git a/beetsplug/info.py b/beetsplug/info.py index 1c3b6f542..d759d6066 100644 --- a/beetsplug/info.py +++ b/beetsplug/info.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Shows file metadata. -""" - +"""Shows file metadata.""" import os diff --git a/beetsplug/inline.py b/beetsplug/inline.py index 4ca676e5f..4092c46d0 100644 --- a/beetsplug/inline.py +++ b/beetsplug/inline.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Allows inline path template customization code in the config file. -""" +"""Allows inline path template customization code in the config file.""" import itertools import traceback diff --git a/beetsplug/ipfs.py b/beetsplug/ipfs.py index 06835ba94..29d65ab78 100644 --- a/beetsplug/ipfs.py +++ b/beetsplug/ipfs.py @@ -11,9 +11,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Adds support for ipfs. Requires go-ipfs and a running ipfs daemon -""" - +"""Adds support for ipfs. Requires go-ipfs and a running ipfs daemon""" import os import shutil diff --git a/beetsplug/keyfinder.py b/beetsplug/keyfinder.py index d6605486d..87f0cc427 100644 --- a/beetsplug/keyfinder.py +++ b/beetsplug/keyfinder.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Uses the `KeyFinder` program to add the `initial_key` field. -""" - +"""Uses the `KeyFinder` program to add the `initial_key` field.""" import os.path import subprocess diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index 50be9d1b9..f86ac7bc1 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -21,6 +21,7 @@ and has been edited to remove some questionable entries. The scraper script used is available here: https://gist.github.com/1241307 """ + import codecs import os import traceback diff --git a/beetsplug/loadext.py b/beetsplug/loadext.py index 5e8b59a8f..cc673dab2 100644 --- a/beetsplug/loadext.py +++ b/beetsplug/loadext.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Load SQLite extensions. -""" - +"""Load SQLite extensions.""" import sqlite3 diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py index db29c9c6c..bf0ce96d0 100644 --- a/beetsplug/lyrics.py +++ b/beetsplug/lyrics.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Fetches, embeds, and displays lyrics. -""" - +"""Fetches, embeds, and displays lyrics.""" import difflib import errno diff --git a/beetsplug/mbsync.py b/beetsplug/mbsync.py index 0e63a6f22..283c40186 100644 --- a/beetsplug/mbsync.py +++ b/beetsplug/mbsync.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Update library's tags using MusicBrainz. -""" +"""Update library's tags using MusicBrainz.""" import re from collections import defaultdict diff --git a/beetsplug/metasync/__init__.py b/beetsplug/metasync/__init__.py index d17071b5b..2466efe54 100644 --- a/beetsplug/metasync/__init__.py +++ b/beetsplug/metasync/__init__.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Synchronize information from music player libraries -""" - +"""Synchronize information from music player libraries""" from abc import ABCMeta, abstractmethod from importlib import import_module @@ -126,8 +124,7 @@ class MetaSyncPlugin(BeetsPlugin): meta_source_instances[player] = cls(self.config, self._log) except (ImportError, ConfigValueError) as e: self._log.error( - "Failed to instantiate metadata source " - "'{}': {}".format(player, e) + f"Failed to instantiate metadata source {player!r}: {e}" ) # Avoid needlessly iterating over items diff --git a/beetsplug/metasync/amarok.py b/beetsplug/metasync/amarok.py index 195cd8787..f8dcbe3f3 100644 --- a/beetsplug/metasync/amarok.py +++ b/beetsplug/metasync/amarok.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Synchronize information from amarok's library via dbus -""" - +"""Synchronize information from amarok's library via dbus""" from datetime import datetime from os.path import basename diff --git a/beetsplug/metasync/itunes.py b/beetsplug/metasync/itunes.py index 15cbd7bb3..02f592fdc 100644 --- a/beetsplug/metasync/itunes.py +++ b/beetsplug/metasync/itunes.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Synchronize information from iTunes's library -""" - +"""Synchronize information from iTunes's library""" import os import plistlib diff --git a/beetsplug/missing.py b/beetsplug/missing.py index 2e37fde78..d5e4deda1 100644 --- a/beetsplug/missing.py +++ b/beetsplug/missing.py @@ -13,8 +13,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""List missing tracks. -""" +"""List missing tracks.""" from collections import defaultdict diff --git a/beetsplug/parentwork.py b/beetsplug/parentwork.py index 4ddef1c14..26f8f224f 100644 --- a/beetsplug/parentwork.py +++ b/beetsplug/parentwork.py @@ -16,7 +16,6 @@ and work composition date """ - import musicbrainzngs from beets import ui diff --git a/beetsplug/play.py b/beetsplug/play.py index 3476e5824..ddebd7d41 100644 --- a/beetsplug/play.py +++ b/beetsplug/play.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Send the results of a query to the configured music player as a playlist. -""" +"""Send the results of a query to the configured music player as a playlist.""" import shlex import subprocess @@ -197,7 +196,7 @@ class PlayPlugin(BeetsPlugin): filename = get_temp_filename(__name__, suffix=".m3u") with open(filename, "wb") as m3u: if utf8_bom: - m3u.write(b"\xEF\xBB\xBF") + m3u.write(b"\xef\xbb\xbf") for item in paths_list: m3u.write(item + b"\n") diff --git a/beetsplug/random.py b/beetsplug/random.py index dc94a0e3a..05f2cdf77 100644 --- a/beetsplug/random.py +++ b/beetsplug/random.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Get a random song or album from the library. -""" +"""Get a random song or album from the library.""" from beets.plugins import BeetsPlugin from beets.random import random_objs diff --git a/beetsplug/replaygain.py b/beetsplug/replaygain.py index a2753f960..578b692d1 100644 --- a/beetsplug/replaygain.py +++ b/beetsplug/replaygain.py @@ -334,9 +334,7 @@ class FfmpegBackend(Backend): task.target_level, task.peak_method, count_blocks=False, - )[ - 0 - ] # take only the gain, discarding number of gating blocks + )[0] # take only the gain, discarding number of gating blocks for item in task.items ] diff --git a/beetsplug/scrub.py b/beetsplug/scrub.py index d1e63ee31..630a4e6e6 100644 --- a/beetsplug/scrub.py +++ b/beetsplug/scrub.py @@ -16,7 +16,6 @@ automatically whenever tags are written. """ - import mediafile import mutagen diff --git a/beetsplug/smartplaylist.py b/beetsplug/smartplaylist.py index 9df2cca64..a3b24b569 100644 --- a/beetsplug/smartplaylist.py +++ b/beetsplug/smartplaylist.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Generates smart playlists based on beets queries. -""" - +"""Generates smart playlists based on beets queries.""" import json import os diff --git a/beetsplug/the.py b/beetsplug/the.py index c6fb46ddf..c820e5972 100644 --- a/beetsplug/the.py +++ b/beetsplug/the.py @@ -14,7 +14,6 @@ """Moves patterns in path formats (suitable for moving articles).""" - import re from typing import List diff --git a/beetsplug/thumbnails.py b/beetsplug/thumbnails.py index 19c19f06c..3f88248e0 100644 --- a/beetsplug/thumbnails.py +++ b/beetsplug/thumbnails.py @@ -18,7 +18,6 @@ This plugin is POSIX-only. Spec: standards.freedesktop.org/thumbnail-spec/latest/index.html """ - import ctypes import ctypes.util import os @@ -280,8 +279,7 @@ class GioURI(URIGetter): if not uri_ptr: self.libgio.g_free(uri_ptr) raise RuntimeError( - "No URI received from the gfile pointer for " - "{}".format(displayable_path(path)) + f"No URI received from the gfile pointer for {displayable_path(path)}" ) try: diff --git a/beetsplug/zero.py b/beetsplug/zero.py index 14c157ce8..bda4052ab 100644 --- a/beetsplug/zero.py +++ b/beetsplug/zero.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -""" Clears tag fields in media files.""" - +"""Clears tag fields in media files.""" import re diff --git a/extra/release.py b/extra/release.py index 2c3ffd1bf..1e90eb97b 100755 --- a/extra/release.py +++ b/extra/release.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 -"""A utility script for automating the beets release process. -""" +"""A utility script for automating the beets release process.""" + from __future__ import annotations import re diff --git a/test/plugins/test_acousticbrainz.py b/test/plugins/test_acousticbrainz.py index 77a04dafa..2c4f0d9d6 100644 --- a/test/plugins/test_acousticbrainz.py +++ b/test/plugins/test_acousticbrainz.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Tests for the 'acousticbrainz' plugin. -""" - +"""Tests for the 'acousticbrainz' plugin.""" import json import os.path diff --git a/test/plugins/test_advancedrewrite.py b/test/plugins/test_advancedrewrite.py index 6f4f8a59b..756d6d5fa 100644 --- a/test/plugins/test_advancedrewrite.py +++ b/test/plugins/test_advancedrewrite.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Test the advancedrewrite plugin for various configurations. -""" - +"""Test the advancedrewrite plugin for various configurations.""" import pytest diff --git a/test/plugins/test_albumtypes.py b/test/plugins/test_albumtypes.py index f03e94819..11c6e712b 100644 --- a/test/plugins/test_albumtypes.py +++ b/test/plugins/test_albumtypes.py @@ -14,7 +14,6 @@ """Tests for the 'albumtypes' plugin.""" - from typing import Sequence, Tuple from beets.autotag.mb import VARIOUS_ARTISTS_ID diff --git a/test/plugins/test_art.py b/test/plugins/test_art.py index ede04a300..86da97559 100644 --- a/test/plugins/test_art.py +++ b/test/plugins/test_art.py @@ -14,7 +14,6 @@ """Tests for the album art fetchers.""" - import os import shutil from unittest.mock import patch diff --git a/test/plugins/test_bareasc.py b/test/plugins/test_bareasc.py index 624392dbf..e699a3dcf 100644 --- a/test/plugins/test_bareasc.py +++ b/test/plugins/test_bareasc.py @@ -3,7 +3,6 @@ """Tests for the 'bareasc' plugin.""" - from beets import logging from beets.test.helper import PluginTestCase, capture_stdout diff --git a/test/plugins/test_bucket.py b/test/plugins/test_bucket.py index bc764038e..b075bc4f2 100644 --- a/test/plugins/test_bucket.py +++ b/test/plugins/test_bucket.py @@ -14,7 +14,6 @@ """Tests for the 'bucket' plugin.""" - import pytest from beets import config, ui diff --git a/test/plugins/test_export.py b/test/plugins/test_export.py index bd1b7458d..f37a0d2a7 100644 --- a/test/plugins/test_export.py +++ b/test/plugins/test_export.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Test the beets.export utilities associated with the export plugin. -""" - +"""Test the beets.export utilities associated with the export plugin.""" import json import re # used to test csv format diff --git a/test/plugins/test_filefilter.py b/test/plugins/test_filefilter.py index 92d19e029..7f9fa2d18 100644 --- a/test/plugins/test_filefilter.py +++ b/test/plugins/test_filefilter.py @@ -12,8 +12,8 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Tests for the `filefilter` plugin. -""" +"""Tests for the `filefilter` plugin.""" + from beets.test.helper import ImportTestCase, PluginMixin from beets.util import bytestring_path diff --git a/test/plugins/test_ftintitle.py b/test/plugins/test_ftintitle.py index 8788f7cf5..bd4094873 100644 --- a/test/plugins/test_ftintitle.py +++ b/test/plugins/test_ftintitle.py @@ -14,7 +14,6 @@ """Tests for the 'ftintitle' plugin.""" - import unittest from beets.test.helper import PluginTestCase diff --git a/test/plugins/test_limit.py b/test/plugins/test_limit.py index 9f372992b..12700295e 100644 --- a/test/plugins/test_limit.py +++ b/test/plugins/test_limit.py @@ -13,7 +13,6 @@ """Tests for the 'limit' plugin.""" - from beets.test.helper import PluginTestCase diff --git a/test/plugins/test_lyrics.py b/test/plugins/test_lyrics.py index 7cb081fc4..76c011225 100644 --- a/test/plugins/test_lyrics.py +++ b/test/plugins/test_lyrics.py @@ -14,7 +14,6 @@ """Tests for the 'lyrics' plugin.""" - import itertools import os import re @@ -509,14 +508,14 @@ class GeniusFetchTest(GeniusBaseTest): { "result": { "primary_artist": { - "name": "\u200Bblackbear", + "name": "\u200bblackbear", }, "url": "blackbear_url", } }, { "result": { - "primary_artist": {"name": "El\u002Dp"}, + "primary_artist": {"name": "El\u002dp"}, "url": "El-p_url", } }, @@ -786,10 +785,10 @@ class SlugTests(unittest.TestCase): assert lyrics.slug(text) == "cafe-au-lait-boisson" text = "Multiple spaces -- and symbols! -- merged" assert lyrics.slug(text) == "multiple-spaces-and-symbols-merged" - text = "\u200Bno-width-space" + text = "\u200bno-width-space" assert lyrics.slug(text) == "no-width-space" # variations of dashes should get standardized - dashes = ["\u200D", "\u2010"] + dashes = ["\u200d", "\u2010"] for dash1, dash2 in itertools.combinations(dashes, 2): assert lyrics.slug(dash1) == lyrics.slug(dash2) diff --git a/test/plugins/test_parentwork.py b/test/plugins/test_parentwork.py index 71b9f1fed..9ce804091 100644 --- a/test/plugins/test_parentwork.py +++ b/test/plugins/test_parentwork.py @@ -14,7 +14,6 @@ """Tests for the 'parentwork' plugin.""" - import os import unittest from unittest.mock import patch diff --git a/test/plugins/test_permissions.py b/test/plugins/test_permissions.py index 327304d82..7979cfa12 100644 --- a/test/plugins/test_permissions.py +++ b/test/plugins/test_permissions.py @@ -1,5 +1,4 @@ -"""Tests for the 'permissions' plugin. -""" +"""Tests for the 'permissions' plugin.""" import os import platform diff --git a/test/plugins/test_play.py b/test/plugins/test_play.py index 63f20aeef..712739633 100644 --- a/test/plugins/test_play.py +++ b/test/plugins/test_play.py @@ -14,7 +14,6 @@ """Tests for the play plugin""" - import os import sys import unittest diff --git a/test/plugins/test_plugin_mediafield.py b/test/plugins/test_plugin_mediafield.py index 39b5aa3d2..898e891ce 100644 --- a/test/plugins/test_plugin_mediafield.py +++ b/test/plugins/test_plugin_mediafield.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Tests the facility that lets plugins add custom field to MediaFile. -""" +"""Tests the facility that lets plugins add custom field to MediaFile.""" import os import shutil diff --git a/test/plugins/test_random.py b/test/plugins/test_random.py index 626f31779..5bff1ee5e 100644 --- a/test/plugins/test_random.py +++ b/test/plugins/test_random.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Test the beets.random utilities associated with the random plugin. -""" - +"""Test the beets.random utilities associated with the random plugin.""" import math import unittest diff --git a/test/test_art_resize.py b/test/test_art_resize.py index fb628bca7..8dd4d0e89 100644 --- a/test/test_art_resize.py +++ b/test/test_art_resize.py @@ -14,7 +14,6 @@ """Tests for image resizing based on filesize.""" - import os import unittest from unittest.mock import patch diff --git a/test/test_autotag.py b/test/test_autotag.py index 7e6e7f43e..6843a4898 100644 --- a/test/test_autotag.py +++ b/test/test_autotag.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Tests for autotagging functionality. -""" +"""Tests for autotagging functionality.""" import re import unittest diff --git a/test/test_datequery.py b/test/test_datequery.py index 31ec5f9da..e5c5f2bfd 100644 --- a/test/test_datequery.py +++ b/test/test_datequery.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Test for dbcore's date-based queries. -""" +"""Test for dbcore's date-based queries.""" import time import unittest diff --git a/test/test_dbcore.py b/test/test_dbcore.py index fc4a614f7..ba2b84ad2 100644 --- a/test/test_dbcore.py +++ b/test/test_dbcore.py @@ -239,9 +239,7 @@ class TransactionTest(unittest.TestCase): old_rev = self.db.revision with self.db.transaction() as tx: tx.mutate( - "INSERT INTO {} " - "(field_one) " - "VALUES (?);".format(ModelFixture1._table), + f"INSERT INTO {ModelFixture1._table} (field_one) VALUES (?);", (111,), ) assert self.db.revision > old_rev @@ -517,9 +515,7 @@ class QueryParseTest(unittest.TestCase): part, {"year": dbcore.query.NumericQuery}, {":": dbcore.query.RegexpQuery}, - )[ - :-1 - ] # remove the negate flag + )[:-1] # remove the negate flag def test_one_basic_term(self): q = "test" diff --git a/test/test_hidden.py b/test/test_hidden.py index e7af32133..a7e6a1a10 100644 --- a/test/test_hidden.py +++ b/test/test_hidden.py @@ -14,7 +14,6 @@ """Tests for the 'hidden' utility.""" - import ctypes import errno import subprocess diff --git a/test/test_m3ufile.py b/test/test_m3ufile.py index e9fbee644..12686d824 100644 --- a/test/test_m3ufile.py +++ b/test/test_m3ufile.py @@ -13,7 +13,6 @@ # included in all copies or substantial portions of the Software. """Testsuite for the M3UFile class.""" - import sys import unittest from os import path diff --git a/test/test_metasync.py b/test/test_metasync.py index 9e18a59ef..13c003a1c 100644 --- a/test/test_metasync.py +++ b/test/test_metasync.py @@ -69,12 +69,12 @@ class MetaSyncTest(PluginTestCase): 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" diff --git a/test/test_pipeline.py b/test/test_pipeline.py index 7b909dc27..3dd32df1c 100644 --- a/test/test_pipeline.py +++ b/test/test_pipeline.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Test the "pipeline.py" restricted parallel programming library. -""" +"""Test the "pipeline.py" restricted parallel programming library.""" import unittest diff --git a/test/test_plugins.py b/test/test_plugins.py index cb8d8e0d5..f3b9290b6 100644 --- a/test/test_plugins.py +++ b/test/test_plugins.py @@ -281,7 +281,6 @@ class ListenersTest(PluginLoaderTestCase): @patch("beets.plugins.find_plugins") def test_listener_params(self, mock_find_plugins): - class DummyPlugin(plugins.BeetsPlugin): def __init__(self): super().__init__() diff --git a/test/test_query.py b/test/test_query.py index 04170a159..61237e10e 100644 --- a/test/test_query.py +++ b/test/test_query.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Various tests for querying the library database. -""" +"""Various tests for querying the library database.""" import os import sys diff --git a/test/test_sort.py b/test/test_sort.py index 3d27f6591..f212bd654 100644 --- a/test/test_sort.py +++ b/test/test_sort.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Various tests for querying the library database. -""" - +"""Various tests for querying the library database.""" import beets.library from beets import config, dbcore diff --git a/test/test_template.py b/test/test_template.py index 23bf527a0..236bee5aa 100644 --- a/test/test_template.py +++ b/test/test_template.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Tests for template engine. -""" +"""Tests for template engine.""" import unittest diff --git a/test/test_ui.py b/test/test_ui.py index 5423083e2..c087aca7d 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Tests for the command-line interface. -""" +"""Tests for the command-line interface.""" import os import platform diff --git a/test/test_ui_commands.py b/test/test_ui_commands.py index c8a39dc69..8daf8e31a 100644 --- a/test/test_ui_commands.py +++ b/test/test_ui_commands.py @@ -12,9 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Test module for file ui/commands.py -""" - +"""Test module for file ui/commands.py""" import os import shutil diff --git a/test/test_ui_init.py b/test/test_ui_init.py index 29ce36a61..a6f06c494 100644 --- a/test/test_ui_init.py +++ b/test/test_ui_init.py @@ -12,8 +12,7 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Test module for file ui/__init__.py -""" +"""Test module for file ui/__init__.py""" import os import shutil diff --git a/test/test_util.py b/test/test_util.py index c719bafa6..85534949f 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -11,8 +11,7 @@ # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Tests for base utils from the beets.util package. -""" +"""Tests for base utils from the beets.util package.""" import os import platform diff --git a/test/test_vfs.py b/test/test_vfs.py index 41ad276f5..7f75fbd83 100644 --- a/test/test_vfs.py +++ b/test/test_vfs.py @@ -14,7 +14,6 @@ """Tests for the virtual filesystem builder..""" - from beets import vfs from beets.test import _common from beets.test.helper import BeetsTestCase