Use typing_extensions only when needed (#5331)

This commit is contained in:
Serene 2024-06-24 14:33:11 +10:00 committed by GitHub
commit f1c643d573
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 4 deletions

View file

@ -45,7 +45,11 @@ from typing import (
Union,
)
from typing_extensions import TypeAlias
if sys.version_info >= (3, 10):
from typing import TypeAlias
else:
from typing_extensions import TypeAlias
from unidecode import unidecode
from beets.util import hidden

View file

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

View file

@ -15,6 +15,7 @@ For packagers:
* The minimum supported Python version is now 3.8.
* The `beet` script has been removed from the repository.
* The `typing_extensions` is required for Python 3.10 and below.
Other changes:

2
poetry.lock generated
View file

@ -2720,4 +2720,4 @@ web = ["flask", "flask-cors"]
[metadata]
lock-version = "2.0"
python-versions = ">=3.8,<4"
content-hash = "740281ee3ddba4c6015eab9cfc24bb947e8816e3b7f5a6bebeb39ff2413d7ac3"
content-hash = "48fba7c7149c8cb7824f96329bd469a9e9c84b13d233f957889b8b1d7076392f"

View file

@ -41,7 +41,7 @@ mediafile = ">=0.12.0"
munkres = ">=1.0.0"
musicbrainzngs = ">=0.4"
pyyaml = "*"
typing_extensions = "*"
typing_extensions = { version = "*", python = "<=3.10" }
unidecode = ">=1.3.6"
beautifulsoup4 = { version = "*", optional = true }
dbus-python = { version = "*", optional = true }