diff --git a/sphinx/builders/html/_assets.py b/sphinx/builders/html/_assets.py index 2fb8dcc28f8..a72c5000bbc 100644 --- a/sphinx/builders/html/_assets.py +++ b/sphinx/builders/html/_assets.py @@ -9,7 +9,7 @@ from sphinx.errors import ThemeError if TYPE_CHECKING: - from sphinx.util._pathlib import _StrPath + from pathlib import Path class _CascadingStyleSheet: @@ -124,7 +124,7 @@ def __getitem__(self, key): return os.fspath(self.filename)[key] -def _file_checksum(outdir: _StrPath, filename: str | os.PathLike[str]) -> str: +def _file_checksum(outdir: Path, filename: str | os.PathLike[str]) -> str: filename = os.fspath(filename) # Don't generate checksums for HTTP URIs if '://' in filename: diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py index a6f97ee0137..9b9e9dd306a 100644 --- a/sphinx/environment/__init__.py +++ b/sphinx/environment/__init__.py @@ -24,6 +24,7 @@ if TYPE_CHECKING: from collections.abc import Generator, Iterator + from pathlib import Path from docutils import nodes from docutils.nodes import Node @@ -34,7 +35,6 @@ from sphinx.domains import Domain from sphinx.events import EventManager from sphinx.project import Project - from sphinx.util._pathlib import _StrPath logger = logging.getLogger(__name__) @@ -148,8 +148,8 @@ class BuildEnvironment: def __init__(self, app: Sphinx): self.app: Sphinx = app - self.doctreedir: _StrPath = app.doctreedir - self.srcdir: _StrPath = app.srcdir + self.doctreedir: Path = app.doctreedir + self.srcdir: Path = app.srcdir self.config: Config = None # type: ignore[assignment] self.config_status: int = CONFIG_UNSET self.config_status_extra: str = '' diff --git a/sphinx/testing/util.py b/sphinx/testing/util.py index de8f523f95b..e76d4010c49 100644 --- a/sphinx/testing/util.py +++ b/sphinx/testing/util.py @@ -17,11 +17,10 @@ if TYPE_CHECKING: from io import StringIO + from pathlib import Path from docutils.nodes import Node - from sphinx.util._pathlib import _StrPath - __all__ = 'SphinxTestApp', 'SphinxTestAppWrapperForSkipBuilding' @@ -82,8 +81,8 @@ class SphinxTestApp(application.Sphinx): def __init__( self, buildername: str = 'html', - srcdir: _StrPath | None = None, - builddir: _StrPath | None = None, + srcdir: Path | None = None, + builddir: Path | None = None, freshenv: bool = False, confoverrides: dict | None = None, status: IO | None = None,