Skip to content

Commit

Permalink
privatise
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Nov 22, 2024
1 parent 6eca811 commit a98f18d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions sphinx/builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
CONFIG_CHANGED_REASON,
CONFIG_OK,
BuildEnvironment,
CurrentDocument,
_CurrentDocument,
)
from sphinx.environment.adapters.asset import ImageAdapter
from sphinx.errors import SphinxError
Expand Down Expand Up @@ -640,7 +640,7 @@ def read_doc(self, docname: str, *, _cache: bool = True) -> None:
self.env.all_docs[docname] = time.time_ns() // 1_000

# cleanup
self.env.current_document = CurrentDocument()
self.env.current_document = _CurrentDocument()
self.env.ref_context.clear()

self.write_doctree(docname, doctree, _cache=_cache)
Expand Down
10 changes: 5 additions & 5 deletions sphinx/environment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def __init__(self, app: Sphinx) -> None:
self.original_image_uri: dict[_StrPath, str] = {}

# temporary data storage while reading a document
self.current_document: CurrentDocument = CurrentDocument()
self.current_document: _CurrentDocument = _CurrentDocument()
# context for cross-references (e.g. current module or class)
# this is similar to ``self.current_document``,
# but will for example be copied to attributes of "any" cross references
Expand Down Expand Up @@ -560,7 +560,7 @@ def check_dependents(self, app: Sphinx, already: set[str]) -> Iterator[str]:

def prepare_settings(self, docname: str) -> None:
"""Prepare to set up environment for reading."""
self.current_document = CurrentDocument(
self.current_document = _CurrentDocument(
docname=docname,
# defaults to the global default, but can be re-set in a document
default_role=self.config.default_role,
Expand All @@ -570,7 +570,7 @@ def prepare_settings(self, docname: str) -> None:
# utilities to use while reading a document

@property
def temp_data(self) -> CurrentDocument:
def temp_data(self) -> _CurrentDocument:
"""Returns the temporary data storage for the current document.
Kept for backwards compatibility.
Expand Down Expand Up @@ -862,7 +862,7 @@ def _check_toc_parents(toctree_includes: dict[str, list[str]]) -> None:
)


class CurrentDocument:
class _CurrentDocument:
"""Temporary data storage while reading a document."""

__slots__ = (
Expand Down Expand Up @@ -1036,4 +1036,4 @@ def setdefault(self, key: str, default: Any | None = None) -> Any | None:
return self._ext_props.setdefault(key, default)

def clear(self) -> None:
CurrentDocument.__init__(self) # NoQA: PLC2801
_CurrentDocument.__init__(self) # NoQA: PLC2801

0 comments on commit a98f18d

Please sign in to comment.