Added typing_extensions to all python version. Removed sys.version checks

This commit is contained in:
Sebastian Mohr 2025-07-16 16:33:43 +02:00
parent 5beb3d1c81
commit dc6f07d705
7 changed files with 9 additions and 28 deletions

View file

@ -26,8 +26,9 @@ from abc import ABC
from collections import defaultdict
from collections.abc import Generator, Iterable, Iterator, Mapping, Sequence
from sqlite3 import Connection
from typing import TYPE_CHECKING, Any, AnyStr, Callable, Generic, TypeVar
from typing import TYPE_CHECKING, Any, AnyStr, Callable, Generic
from typing_extensions import TypeVar # default value support
from unidecode import unidecode
import beets
@ -50,9 +51,6 @@ if TYPE_CHECKING:
from .query import SQLiteType
D = TypeVar("D", bound="Database", default=Any)
else:
D = TypeVar("D", bound="Database")
FlexAttrs = dict[str, str]

View file

@ -10,20 +10,16 @@ from __future__ import annotations
import abc
import inspect
import re
import sys
import warnings
from typing import TYPE_CHECKING, Generic, Literal, Sequence, TypedDict, TypeVar
from typing_extensions import NotRequired
from beets.util import cached_classproperty
from beets.util.id_extractors import extract_release_id
from .plugins import BeetsPlugin, find_plugins, notify_info_yielded, send
if sys.version_info >= (3, 11):
from typing import NotRequired
else:
from typing_extensions import NotRequired
if TYPE_CHECKING:
from collections.abc import Iterable

View file

@ -19,7 +19,6 @@ from __future__ import annotations
import abc
import inspect
import re
import sys
import traceback
from collections import defaultdict
from functools import wraps
@ -27,6 +26,7 @@ from types import GenericAlias
from typing import TYPE_CHECKING, Any, Callable, Sequence, TypeVar
import mediafile
from typing_extensions import ParamSpec
import beets
from beets import logging
@ -34,11 +34,6 @@ from beets import logging
if TYPE_CHECKING:
from beets.event_types import EventType
if sys.version_info >= (3, 10):
from typing import ParamSpec
else:
from typing_extensions import ParamSpec
if TYPE_CHECKING:
from collections.abc import Iterable

View file

@ -38,10 +38,7 @@ import sys
from threading import Lock, Thread
from typing import Callable, Generator, TypeVar
if sys.version_info >= (3, 11):
from typing import TypeVarTuple, Unpack
else:
from typing_extensions import TypeVarTuple, Unpack
from typing_extensions import TypeVarTuple, Unpack
BUBBLE = "__PIPELINE_BUBBLE__"
POISON = "__PIPELINE_POISON__"

View file

@ -16,7 +16,6 @@
import os
import re
import sys
from collections.abc import Mapping
from dataclasses import dataclass
from mimetypes import guess_type
@ -30,11 +29,7 @@ from flask import (
request,
send_file,
)
if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self
from typing_extensions import Self
from beets import config
from beets.dbcore.query import (

2
poetry.lock generated
View file

@ -3292,4 +3292,4 @@ web = ["flask", "flask-cors"]
[metadata]
lock-version = "2.0"
python-versions = ">=3.9,<4"
content-hash = "b3f2746a43227fe639d17eb22d7924e30c9d83eef53dce2c10388c602f0c6665"
content-hash = "c98049afba33c3cb22359ae75bb73bcc5d74b27c5a45802292a56f8d3c547f1e"

View file

@ -52,7 +52,7 @@ musicbrainzngs = ">=0.4"
numpy = ">=1.24.4"
platformdirs = ">=3.5.0"
pyyaml = "*"
typing_extensions = { version = "*", python = "<=3.10" }
typing_extensions = "*"
unidecode = ">=1.3.6"
beautifulsoup4 = { version = "*", optional = true }