Skip to content

Commit

Permalink
Add missing types to BackendType
Browse files Browse the repository at this point in the history
  • Loading branch information
snejus committed Sep 19, 2024
1 parent c84652d commit 4d481d7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions beetsplug/lyrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from contextlib import contextmanager
from functools import cached_property
from html import unescape
from typing import Any, Iterator
from typing import Any, ClassVar, Iterator
from urllib.parse import urlparse

import requests
Expand Down Expand Up @@ -242,12 +242,13 @@ class BackendType(type):
>>> list(Backend) # ["lrclib", "musixmatch", "genius", "tekstowo", "google"]
"""

_registry: dict[str, BackendType] = {}
REQUIRES_BS: bool
_registry: ClassVar[dict[str, BackendType]] = {}
REQUIRES_BS: ClassVar[bool]

def __new__(cls, name: str, bases: tuple[type, ...], attrs) -> BackendType:
def __new__(cls, name: str, bases: tuple[type, ...], *args) -> BackendType:
"""Create a new instance of the class and add it to the registry."""
new_class = super().__new__(cls, name, bases, attrs)
new_class = super().__new__(cls, name, bases, *args)
# Skip the base / Backend class
if bases:
cls._registry[name.lower()] = new_class
return new_class
Expand Down

0 comments on commit 4d481d7

Please sign in to comment.