diff --git a/src/django_docutils/_internal/types.py b/src/django_docutils/_internal/types.py index 7270cdc9..c6e6b2ae 100644 --- a/src/django_docutils/_internal/types.py +++ b/src/django_docutils/_internal/types.py @@ -9,17 +9,17 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Union +import typing as t -if TYPE_CHECKING: +if t.TYPE_CHECKING: from os import PathLike from typing_extensions import TypeAlias -StrPath: TypeAlias = Union[str, "PathLike[str]"] # stable +StrPath: TypeAlias = t.Union[str, "PathLike[str]"] # stable """:class:`os.PathLike` or :class:`str`""" -StrOrBytesPath: TypeAlias = Union[ +StrOrBytesPath: TypeAlias = t.Union[ str, bytes, "PathLike[str]", diff --git a/src/django_docutils/lib/metadata/tests/test_extract.py b/src/django_docutils/lib/metadata/tests/test_extract.py index 67ff5e27..48aa0ed4 100644 --- a/src/django_docutils/lib/metadata/tests/test_extract.py +++ b/src/django_docutils/lib/metadata/tests/test_extract.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING +import typing as t from django.utils.encoding import force_bytes from docutils.core import publish_doctree @@ -14,7 +14,7 @@ ) from django_docutils.lib.settings import DJANGO_DOCUTILS_LIB_RST -if TYPE_CHECKING: +if t.TYPE_CHECKING: import pathlib diff --git a/src/django_docutils/lib/utils.py b/src/django_docutils/lib/utils.py index d98244b8..3dcec32b 100644 --- a/src/django_docutils/lib/utils.py +++ b/src/django_docutils/lib/utils.py @@ -8,11 +8,11 @@ from __future__ import annotations import re -from typing import TYPE_CHECKING +import typing as t from docutils import nodes -if TYPE_CHECKING: +if t.TYPE_CHECKING: from collections.abc import Generator # \x00 means the "<" was backslash-escaped (from sphinx)