mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-09 18:08:00 +00:00
use typing_extensions module for python < 3.11
This commit is contained in:
parent
6e914fb50c
commit
2bb44d8e37
|
@ -2,3 +2,5 @@ flake8 == 7.0.0
|
||||||
mypy == 1.9.0
|
mypy == 1.9.0
|
||||||
pyinstaller == 6.3.0
|
pyinstaller == 6.3.0
|
||||||
watchdog == 4.0.0
|
watchdog == 4.0.0
|
||||||
|
|
||||||
|
typing_extensions >= 4.10.0; python_version < '3.11.0'
|
||||||
|
|
|
@ -13,7 +13,13 @@ from platformdirs import user_config_dir
|
||||||
from .misc import IS_DOCKER
|
from .misc import IS_DOCKER
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from typing import Any, Self
|
from typing import Any
|
||||||
|
|
||||||
|
try:
|
||||||
|
from typing import Self
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
|
|
|
@ -10,7 +10,13 @@ from ..misc import boolean
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from bsql import Row
|
from bsql import Row
|
||||||
from collections.abc import Callable, Sequence
|
from collections.abc import Callable, Sequence
|
||||||
from typing import Any, Self
|
from typing import Any
|
||||||
|
|
||||||
|
try:
|
||||||
|
from typing import Self
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
|
||||||
THEMES = {
|
THEMES = {
|
||||||
|
|
|
@ -9,7 +9,13 @@ from pathlib import Path
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from typing import Any, Self
|
from typing import Any
|
||||||
|
|
||||||
|
try:
|
||||||
|
from typing import Self
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
|
||||||
class LogLevel(IntEnum):
|
class LogLevel(IntEnum):
|
||||||
|
|
|
@ -18,9 +18,15 @@ except ImportError:
|
||||||
from importlib_resources import files as pkgfiles # type: ignore
|
from importlib_resources import files as pkgfiles # type: ignore
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from typing import Any, Self
|
from typing import Any
|
||||||
from .application import Application
|
from .application import Application
|
||||||
|
|
||||||
|
try:
|
||||||
|
from typing import Self
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
|
||||||
T = typing.TypeVar('T')
|
T = typing.TypeVar('T')
|
||||||
ResponseType = typing.TypedDict('ResponseType', {
|
ResponseType = typing.TypedDict('ResponseType', {
|
||||||
|
|
|
@ -16,13 +16,19 @@ if typing.TYPE_CHECKING:
|
||||||
from aiohttp.web import Request
|
from aiohttp.web import Request
|
||||||
from collections.abc import Callable, Generator, Sequence, Mapping
|
from collections.abc import Callable, Generator, Sequence, Mapping
|
||||||
from bsql import Database
|
from bsql import Database
|
||||||
from typing import Any, Self
|
from typing import Any
|
||||||
from ..application import Application
|
from ..application import Application
|
||||||
from ..cache import Cache
|
from ..cache import Cache
|
||||||
from ..config import Config
|
from ..config import Config
|
||||||
from ..http_client import HttpClient
|
from ..http_client import HttpClient
|
||||||
from ..template import Template
|
from ..template import Template
|
||||||
|
|
||||||
|
try:
|
||||||
|
from typing import Self
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
|
||||||
VIEWS: list[tuple[str, type[View]]] = []
|
VIEWS: list[tuple[str, type[View]]] = []
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue