move Self imports to typing block

This commit is contained in:
Izalia Mae 2024-06-25 16:54:04 -04:00
parent 5765753b59
commit 5217516c8a
5 changed files with 32 additions and 25 deletions

View file

@ -1,3 +1,5 @@
from __future__ import annotations
import getpass
import os
import platform
@ -6,15 +8,16 @@ import yaml
from dataclasses import asdict, dataclass, fields
from pathlib import Path
from platformdirs import user_config_dir
from typing import Any
from typing import TYPE_CHECKING, Any
from .misc import IS_DOCKER
try:
from typing import Self
if TYPE_CHECKING:
try:
from typing import Self
except ImportError:
from typing_extensions import Self
except ImportError:
from typing_extensions import Self
if platform.system() == 'Windows':

View file

@ -5,16 +5,17 @@ from __future__ import annotations
from bsql import Row
from collections.abc import Callable, Sequence
from dataclasses import Field, asdict, dataclass, fields
from typing import Any
from typing import TYPE_CHECKING, Any
from .. import logger as logging
from ..misc import boolean
try:
from typing import Self
if TYPE_CHECKING:
try:
from typing import Self
except ImportError:
from typing_extensions import Self
except ImportError:
from typing_extensions import Self
THEMES = {

View file

@ -1,15 +1,18 @@
from __future__ import annotations
import logging
import os
from enum import IntEnum
from pathlib import Path
from typing import Any, Protocol
from typing import TYPE_CHECKING, Any, Protocol
try:
from typing import Self
if TYPE_CHECKING:
try:
from typing import Self
except ImportError:
from typing_extensions import Self
except ImportError:
from typing_extensions import Self
class LoggingMethod(Protocol):

View file

@ -19,15 +19,15 @@ try:
except ImportError:
from importlib_resources import files as pkgfiles # type: ignore
try:
from typing import Self
except ImportError:
from typing_extensions import Self
if TYPE_CHECKING:
from .application import Application
try:
from typing import Self
except ImportError:
from typing_extensions import Self
T = TypeVar('T')
ResponseType = TypedDict('ResponseType', {

View file

@ -21,11 +21,11 @@ if TYPE_CHECKING:
from ..application import Application
from ..template import Template
try:
from typing import Self
try:
from typing import Self
except ImportError:
from typing_extensions import Self
except ImportError:
from typing_extensions import Self
HandlerCallback = Callable[[Request], Awaitable[Response]]