From b4cf53cd959dc21cfd0a65cb991723bb6d482171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Thu, 19 Sep 2024 23:14:41 +0100 Subject: [PATCH] Add missing types to BackendType --- beetsplug/lyrics.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py index 2b87455b04..b8077490c9 100644 --- a/beetsplug/lyrics.py +++ b/beetsplug/lyrics.py @@ -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 @@ -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