diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 3ce187f02..7079db444 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -45,11 +45,11 @@ from typing import ( Union, ) -try: - # Python 3.10+ +if sys.version_info >= (3, 10): from typing import TypeAlias -except ImportError: +else: from typing_extensions import TypeAlias + from unidecode import unidecode from beets.util import hidden diff --git a/beetsplug/aura.py b/beetsplug/aura.py index b02dd85f2..09d859200 100644 --- a/beetsplug/aura.py +++ b/beetsplug/aura.py @@ -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 @@ -30,10 +31,9 @@ from flask import ( send_file, ) -try: - # Python 3.11+ +if sys.version_info >= (3, 11): from typing import Self -except ImportError: +else: from typing_extensions import Self from beets import config