Reformat the codebase

This commit is contained in:
Šarūnas Nejus 2024-09-17 07:35:32 +01:00
parent 06a5ecaf80
commit 85a17ee503
No known key found for this signature in database
GPG key ID: DD28F6704DBE3435
96 changed files with 94 additions and 211 deletions

View file

@ -16,7 +16,6 @@
`python -m beets`. `python -m beets`.
""" """
import sys import sys
from .ui import main from .ui import main

View file

@ -16,7 +16,6 @@
music and items' embedded album art. music and items' embedded album art.
""" """
import os import os
from tempfile import NamedTemporaryFile from tempfile import NamedTemporaryFile

View file

@ -12,8 +12,8 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 typing import Mapping, Sequence, Union
from beets import config, logging from beets import config, logging

View file

@ -16,7 +16,6 @@
releases and tracks. releases and tracks.
""" """
from __future__ import annotations from __future__ import annotations
import datetime import datetime

View file

@ -12,8 +12,8 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 from __future__ import annotations
import re import re

View file

@ -1224,9 +1224,7 @@ class Database:
UNIQUE(entity_id, key) ON CONFLICT REPLACE); UNIQUE(entity_id, key) ON CONFLICT REPLACE);
CREATE INDEX IF NOT EXISTS {0}_by_entity CREATE INDEX IF NOT EXISTS {0}_by_entity
ON {0} (entity_id); ON {0} (entity_id);
""".format( """.format(flex_table)
flex_table
)
) )
# Querying. # Querying.

View file

@ -12,8 +12,8 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 import typing
from abc import ABC from abc import ABC
from typing import Any, Generic, List, TypeVar, Union, cast from typing import Any, Generic, List, TypeVar, Union, cast

View file

@ -627,8 +627,7 @@ class ImportTask(BaseImportTask):
self.save_progress() self.save_progress()
if session.config["incremental"] and not ( if session.config["incremental"] and not (
# Should we skip recording to incremental list? # Should we skip recording to incremental list?
self.skip self.skip and session.config["incremental_skip_later"]
and session.config["incremental_skip_later"]
): ):
self.save_history() self.save_history()

View file

@ -20,7 +20,6 @@ use {}-style formatting and can interpolate keywords arguments to the logging
calls (`debug`, `info`, etc). calls (`debug`, `info`, etc).
""" """
import logging import logging
import threading import threading
from copy import copy from copy import copy

View file

@ -14,7 +14,6 @@
"""Support for beets plugins.""" """Support for beets plugins."""
import abc import abc
import inspect import inspect
import re import re

View file

@ -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. CLI commands are implemented in the ui.commands module.
""" """
import errno import errno
import optparse import optparse
import os.path import os.path
@ -318,7 +317,7 @@ def input_options(
# Wrap the query text. # Wrap the query text.
# Start prompt with U+279C: Heavy Round-Tipped Rightwards Arrow # Start prompt with U+279C: Heavy Round-Tipped Rightwards Arrow
prompt = colorize("action", "\u279C ") prompt = colorize("action", "\u279c ")
line_length = 0 line_length = 0
for i, (part, length) in enumerate( for i, (part, length) in enumerate(
zip(prompt_parts, prompt_part_lengths) 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. "yes" unless `require` is `True`, in which case there is no default.
""" """
# Start prompt with U+279C: Heavy Round-Tipped Rightwards Arrow # 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:" "action_description", "Enter Y or N:"
) )
sel = input_options(("y", "n"), require, prompt, yesno) sel = input_options(("y", "n"), require, prompt, yesno)
@ -1497,9 +1496,7 @@ class SubcommandsOptionParser(CommonOptionsParser):
""" """
# A more helpful default usage. # A more helpful default usage.
if "usage" not in kwargs: if "usage" not in kwargs:
kwargs[ kwargs["usage"] = """
"usage"
] = """
%prog COMMAND [ARGS...] %prog COMMAND [ARGS...]
%prog help COMMAND""" %prog help COMMAND"""
kwargs["add_help_option"] = False kwargs["add_help_option"] = False

View file

@ -16,7 +16,6 @@
interface. interface.
""" """
import os import os
import re import re
from collections import Counter from collections import Counter
@ -1317,8 +1316,7 @@ def import_files(lib, paths, query):
loghandler = logging.FileHandler(logpath, encoding="utf-8") loghandler = logging.FileHandler(logpath, encoding="utf-8")
except OSError: except OSError:
raise ui.UserError( raise ui.UserError(
"could not open log file for writing: " f"Could not open log file for writing: {displayable_path(logpath)}"
"{}".format(displayable_path(logpath))
) )
else: else:
loghandler = None loghandler = None

View file

@ -26,7 +26,6 @@ This is sort of like a tiny, horrible degeneration of a real templating
engine like Jinja2 or Mustache. engine like Jinja2 or Mustache.
""" """
import ast import ast
import dis import dis
import functools import functools

View file

@ -31,7 +31,6 @@ To do so, pass an iterable of coroutines to the Pipeline constructor
in place of any single coroutine. in place of any single coroutine.
""" """
import queue import queue
import sys import sys
from threading import Lock, Thread from threading import Lock, Thread

View file

@ -14,7 +14,6 @@
"""A namespace package for beets plugins.""" """A namespace package for beets plugins."""
# Make this a namespace package. # Make this a namespace package.
from pkgutil import extend_path from pkgutil import extend_path

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 errno
import hashlib import hashlib
@ -187,9 +185,9 @@ only files which would be processed",
with open(filename) as tmp_file: with open(filename) as tmp_file:
analysis = json.load(tmp_file) analysis = json.load(tmp_file)
# Add the hash to the output. # Add the hash to the output.
analysis["metadata"]["version"][ analysis["metadata"]["version"]["essentia_build_sha"] = (
"essentia_build_sha" self.extractor_sha
] = self.extractor_sha )
return analysis return analysis
finally: finally:
try: try:

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 from collections import defaultdict

View file

@ -14,7 +14,6 @@
"""Adds an album template field for formatted album types.""" """Adds an album template field for formatted album types."""
from beets.autotag.mb import VARIOUS_ARTISTS_ID from beets.autotag.mb import VARIOUS_ARTISTS_ID
from beets.library import Album from beets.library import Album
from beets.plugins import BeetsPlugin from beets.plugins import BeetsPlugin

View file

@ -14,7 +14,6 @@
"""An AURA server using Flask.""" """An AURA server using Flask."""
import os import os
import re import re
import sys import sys

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 errno
import os import os

View file

@ -18,7 +18,6 @@
"""Provides a bare-ASCII matching query.""" """Provides a bare-ASCII matching query."""
from unidecode import unidecode from unidecode import unidecode
from beets import ui from beets import ui

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 json
import re import re

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 cProfile
import timeit import timeit

View file

@ -17,7 +17,6 @@ Beets library. Attempts to implement a compatible protocol to allow
use of the wide range of MPD clients. use of the wide range of MPD clients.
""" """
import inspect import inspect
import math import math
import random import random

View file

@ -16,7 +16,6 @@
music player. music player.
""" """
import _thread import _thread
import copy import copy
import os import os

View file

@ -14,7 +14,6 @@
"""Determine BPM by pressing a key to the rhythm.""" """Determine BPM by pressing a key to the rhythm."""
import time import time
from beets import ui from beets import ui

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 import autotag, library, ui, util
from beets.plugins import BeetsPlugin, apply_item_changes from beets.plugins import BeetsPlugin, apply_item_changes

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 re
import string import string

View file

@ -12,8 +12,8 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 logging
import os import os
import shlex import shlex

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 collections
import time import time
@ -112,8 +111,8 @@ class DeezerPlugin(MetadataSourcePlugin, BeetsPlugin):
day = None day = None
else: else:
raise ui.UserError( raise ui.UserError(
"Invalid `release_date` returned " f"Invalid `release_date` returned by {self.data_source} API: "
"by {} API: '{}'".format(self.data_source, release_date) f"{release_date!r}"
) )
tracks_obj = self.fetch_data(self.album_url + deezer_id + "/tracks") tracks_obj = self.fetch_data(self.album_url + deezer_id + "/tracks")
if tracks_obj is None: if tracks_obj is None:

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""List duplicate tracks or albums. """List duplicate tracks or albums."""
"""
import os import os
import shlex import shlex

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 codecs
import os import os

View file

@ -1,11 +1,11 @@
"""Updates the Emby Library whenever the beets library is changed. """Updates the Emby Library whenever the beets library is changed.
emby: emby:
host: localhost host: localhost
port: 8096 port: 8096
username: user username: user
apikey: apikey apikey: apikey
password: password password: password
""" """
import hashlib import hashlib

View file

@ -11,9 +11,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""Exports data from beets """Exports data from beets"""
"""
import codecs import codecs
import csv import csv

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""Fetches album art. """Fetches album art."""
"""
import os import os
import re import re

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 import re

View file

@ -22,7 +22,6 @@ by default but can be added via the `-e` / `--extravalues` flag. For example:
`beet fish -e genre -e albumartist` `beet fish -e genre -e albumartist`
""" """
import os import os
from operator import attrgetter from operator import attrgetter

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 import ui
from beets.plugins import BeetsPlugin from beets.plugins import BeetsPlugin

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 import re

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""Provides a fuzzy matching query. """Provides a fuzzy matching query."""
"""
import difflib import difflib

View file

@ -17,6 +17,7 @@
music player. Also allow printing the new file locations to stdout in case 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. one wants to manually add music to a player by its path.
""" """
import datetime import datetime
import os import os
import re import re

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""Shows file metadata. """Shows file metadata."""
"""
import os import os

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 itertools
import traceback import traceback

View file

@ -11,9 +11,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 os
import shutil import shutil

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 os.path
import subprocess import subprocess

View file

@ -21,6 +21,7 @@ and has been edited to remove some questionable entries.
The scraper script used is available here: The scraper script used is available here:
https://gist.github.com/1241307 https://gist.github.com/1241307
""" """
import codecs import codecs
import os import os
import traceback import traceback

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""Load SQLite extensions. """Load SQLite extensions."""
"""
import sqlite3 import sqlite3

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""Fetches, embeds, and displays lyrics. """Fetches, embeds, and displays lyrics."""
"""
import difflib import difflib
import errno import errno

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""Update library's tags using MusicBrainz. """Update library's tags using MusicBrainz."""
"""
import re import re
from collections import defaultdict from collections import defaultdict

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 abc import ABCMeta, abstractmethod
from importlib import import_module from importlib import import_module
@ -126,8 +124,7 @@ class MetaSyncPlugin(BeetsPlugin):
meta_source_instances[player] = cls(self.config, self._log) meta_source_instances[player] = cls(self.config, self._log)
except (ImportError, ConfigValueError) as e: except (ImportError, ConfigValueError) as e:
self._log.error( self._log.error(
"Failed to instantiate metadata source " f"Failed to instantiate metadata source {player!r}: {e}"
"'{}': {}".format(player, e)
) )
# Avoid needlessly iterating over items # Avoid needlessly iterating over items

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 datetime import datetime
from os.path import basename from os.path import basename

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 os
import plistlib import plistlib

View file

@ -13,8 +13,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""List missing tracks. """List missing tracks."""
"""
from collections import defaultdict from collections import defaultdict

View file

@ -16,7 +16,6 @@
and work composition date and work composition date
""" """
import musicbrainzngs import musicbrainzngs
from beets import ui from beets import ui

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 shlex
import subprocess import subprocess
@ -197,7 +196,7 @@ class PlayPlugin(BeetsPlugin):
filename = get_temp_filename(__name__, suffix=".m3u") filename = get_temp_filename(__name__, suffix=".m3u")
with open(filename, "wb") as m3u: with open(filename, "wb") as m3u:
if utf8_bom: if utf8_bom:
m3u.write(b"\xEF\xBB\xBF") m3u.write(b"\xef\xbb\xbf")
for item in paths_list: for item in paths_list:
m3u.write(item + b"\n") m3u.write(item + b"\n")

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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.plugins import BeetsPlugin
from beets.random import random_objs from beets.random import random_objs

View file

@ -334,9 +334,7 @@ class FfmpegBackend(Backend):
task.target_level, task.target_level,
task.peak_method, task.peak_method,
count_blocks=False, 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 for item in task.items
] ]

View file

@ -16,7 +16,6 @@
automatically whenever tags are written. automatically whenever tags are written.
""" """
import mediafile import mediafile
import mutagen import mutagen

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 json
import os import os

View file

@ -14,7 +14,6 @@
"""Moves patterns in path formats (suitable for moving articles).""" """Moves patterns in path formats (suitable for moving articles)."""
import re import re
from typing import List from typing import List

View file

@ -18,7 +18,6 @@ This plugin is POSIX-only.
Spec: standards.freedesktop.org/thumbnail-spec/latest/index.html Spec: standards.freedesktop.org/thumbnail-spec/latest/index.html
""" """
import ctypes import ctypes
import ctypes.util import ctypes.util
import os import os
@ -280,8 +279,7 @@ class GioURI(URIGetter):
if not uri_ptr: if not uri_ptr:
self.libgio.g_free(uri_ptr) self.libgio.g_free(uri_ptr)
raise RuntimeError( raise RuntimeError(
"No URI received from the gfile pointer for " f"No URI received from the gfile pointer for {displayable_path(path)}"
"{}".format(displayable_path(path))
) )
try: try:

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
""" Clears tag fields in media files.""" """Clears tag fields in media files."""
import re import re

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/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 from __future__ import annotations
import re import re

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""Tests for the 'acousticbrainz' plugin. """Tests for the 'acousticbrainz' plugin."""
"""
import json import json
import os.path import os.path

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 import pytest

View file

@ -14,7 +14,6 @@
"""Tests for the 'albumtypes' plugin.""" """Tests for the 'albumtypes' plugin."""
from typing import Sequence, Tuple from typing import Sequence, Tuple
from beets.autotag.mb import VARIOUS_ARTISTS_ID from beets.autotag.mb import VARIOUS_ARTISTS_ID

View file

@ -14,7 +14,6 @@
"""Tests for the album art fetchers.""" """Tests for the album art fetchers."""
import os import os
import shutil import shutil
from unittest.mock import patch from unittest.mock import patch

View file

@ -3,7 +3,6 @@
"""Tests for the 'bareasc' plugin.""" """Tests for the 'bareasc' plugin."""
from beets import logging from beets import logging
from beets.test.helper import PluginTestCase, capture_stdout from beets.test.helper import PluginTestCase, capture_stdout

View file

@ -14,7 +14,6 @@
"""Tests for the 'bucket' plugin.""" """Tests for the 'bucket' plugin."""
import pytest import pytest
from beets import config, ui from beets import config, ui

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 json
import re # used to test csv format import re # used to test csv format

View file

@ -12,8 +12,8 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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.test.helper import ImportTestCase, PluginMixin
from beets.util import bytestring_path from beets.util import bytestring_path

View file

@ -14,7 +14,6 @@
"""Tests for the 'ftintitle' plugin.""" """Tests for the 'ftintitle' plugin."""
import unittest import unittest
from beets.test.helper import PluginTestCase from beets.test.helper import PluginTestCase

View file

@ -13,7 +13,6 @@
"""Tests for the 'limit' plugin.""" """Tests for the 'limit' plugin."""
from beets.test.helper import PluginTestCase from beets.test.helper import PluginTestCase

View file

@ -14,7 +14,6 @@
"""Tests for the 'lyrics' plugin.""" """Tests for the 'lyrics' plugin."""
import itertools import itertools
import os import os
import re import re
@ -509,14 +508,14 @@ class GeniusFetchTest(GeniusBaseTest):
{ {
"result": { "result": {
"primary_artist": { "primary_artist": {
"name": "\u200Bblackbear", "name": "\u200bblackbear",
}, },
"url": "blackbear_url", "url": "blackbear_url",
} }
}, },
{ {
"result": { "result": {
"primary_artist": {"name": "El\u002Dp"}, "primary_artist": {"name": "El\u002dp"},
"url": "El-p_url", "url": "El-p_url",
} }
}, },
@ -786,10 +785,10 @@ class SlugTests(unittest.TestCase):
assert lyrics.slug(text) == "cafe-au-lait-boisson" assert lyrics.slug(text) == "cafe-au-lait-boisson"
text = "Multiple spaces -- and symbols! -- merged" text = "Multiple spaces -- and symbols! -- merged"
assert lyrics.slug(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" assert lyrics.slug(text) == "no-width-space"
# variations of dashes should get standardized # variations of dashes should get standardized
dashes = ["\u200D", "\u2010"] dashes = ["\u200d", "\u2010"]
for dash1, dash2 in itertools.combinations(dashes, 2): for dash1, dash2 in itertools.combinations(dashes, 2):
assert lyrics.slug(dash1) == lyrics.slug(dash2) assert lyrics.slug(dash1) == lyrics.slug(dash2)

View file

@ -14,7 +14,6 @@
"""Tests for the 'parentwork' plugin.""" """Tests for the 'parentwork' plugin."""
import os import os
import unittest import unittest
from unittest.mock import patch from unittest.mock import patch

View file

@ -1,5 +1,4 @@
"""Tests for the 'permissions' plugin. """Tests for the 'permissions' plugin."""
"""
import os import os
import platform import platform

View file

@ -14,7 +14,6 @@
"""Tests for the play plugin""" """Tests for the play plugin"""
import os import os
import sys import sys
import unittest import unittest

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 os
import shutil import shutil

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 math
import unittest import unittest

View file

@ -14,7 +14,6 @@
"""Tests for image resizing based on filesize.""" """Tests for image resizing based on filesize."""
import os import os
import unittest import unittest
from unittest.mock import patch from unittest.mock import patch

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""Tests for autotagging functionality. """Tests for autotagging functionality."""
"""
import re import re
import unittest import unittest

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 time
import unittest import unittest

View file

@ -239,9 +239,7 @@ class TransactionTest(unittest.TestCase):
old_rev = self.db.revision old_rev = self.db.revision
with self.db.transaction() as tx: with self.db.transaction() as tx:
tx.mutate( tx.mutate(
"INSERT INTO {} " f"INSERT INTO {ModelFixture1._table} (field_one) VALUES (?);",
"(field_one) "
"VALUES (?);".format(ModelFixture1._table),
(111,), (111,),
) )
assert self.db.revision > old_rev assert self.db.revision > old_rev
@ -517,9 +515,7 @@ class QueryParseTest(unittest.TestCase):
part, part,
{"year": dbcore.query.NumericQuery}, {"year": dbcore.query.NumericQuery},
{":": dbcore.query.RegexpQuery}, {":": dbcore.query.RegexpQuery},
)[ )[:-1] # remove the negate flag
:-1
] # remove the negate flag
def test_one_basic_term(self): def test_one_basic_term(self):
q = "test" q = "test"

View file

@ -14,7 +14,6 @@
"""Tests for the 'hidden' utility.""" """Tests for the 'hidden' utility."""
import ctypes import ctypes
import errno import errno
import subprocess import subprocess

View file

@ -13,7 +13,6 @@
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""Testsuite for the M3UFile class.""" """Testsuite for the M3UFile class."""
import sys import sys
import unittest import unittest
from os import path from os import path

View file

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

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 import unittest

View file

@ -281,7 +281,6 @@ class ListenersTest(PluginLoaderTestCase):
@patch("beets.plugins.find_plugins") @patch("beets.plugins.find_plugins")
def test_listener_params(self, mock_find_plugins): def test_listener_params(self, mock_find_plugins):
class DummyPlugin(plugins.BeetsPlugin): class DummyPlugin(plugins.BeetsPlugin):
def __init__(self): def __init__(self):
super().__init__() super().__init__()

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 os
import sys import sys

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 import beets.library
from beets import config, dbcore from beets import config, dbcore

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""Tests for template engine. """Tests for template engine."""
"""
import unittest import unittest

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 os
import platform import platform

View file

@ -12,9 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 os
import shutil import shutil

View file

@ -12,8 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 os
import shutil import shutil

View file

@ -11,8 +11,7 @@
# #
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # 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 os
import platform import platform

View file

@ -14,7 +14,6 @@
"""Tests for the virtual filesystem builder..""" """Tests for the virtual filesystem builder.."""
from beets import vfs from beets import vfs
from beets.test import _common from beets.test import _common
from beets.test.helper import BeetsTestCase from beets.test.helper import BeetsTestCase