Fix lint and mypy

This commit is contained in:
Brock Grassy 2026-02-04 16:25:46 -05:00
parent e257b7a82e
commit dda1e8329e
2 changed files with 19 additions and 16 deletions

View file

@ -238,10 +238,13 @@ class MusicBrainzAPI(RequestHandler):
At least one of artist, collection, or release must be provided.
Optionally filter by release_type (e.g., ["album", "ep"]).
"""
api_params: dict[str, Any] = dict(kwargs)
# MusicBrainz API uses "type" parameter for release type filtering
if release_type := kwargs.pop("release_type", None):
kwargs["type"] = "|".join(release_type)
return self._get_resource("release-group", **kwargs)["release-groups"]
if release_type := api_params.pop("release_type", None):
api_params["type"] = "|".join(release_type)
return self._get_resource("release-group", **api_params)[
"release-groups"
]
@singledispatchmethod
@classmethod

View file

@ -22,6 +22,19 @@ from typing import TYPE_CHECKING, ClassVar
import requests
from beets import config, metadata_plugins
from beets.dbcore import types
from beets.library import Item
from beets.plugins import BeetsPlugin
from beets.ui import Subcommand, print_
from ._utils.musicbrainz import MusicBrainzAPIMixin
if TYPE_CHECKING:
from collections.abc import Iterator
from beets.library import Album, Library
# Valid MusicBrainz release types for filtering release groups
VALID_RELEASE_TYPES = [
"nat",
@ -41,19 +54,6 @@ VALID_RELEASE_TYPES = [
"mixtape/street",
]
from beets import config, metadata_plugins
from beets.dbcore import types
from beets.library import Item
from beets.plugins import BeetsPlugin
from beets.ui import Subcommand, print_
from ._utils.musicbrainz import MusicBrainzAPIMixin
if TYPE_CHECKING:
from collections.abc import Iterator
from beets.library import Album, Library
MB_ARTIST_QUERY = r"mb_albumartistid::^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$"