MCPcopy
hub / github.com/sphinx-doc/sphinx / __init__

Method __init__

sphinx/environment/__init__.py:115–240  ·  view source on GitHub ↗
(self, app: Sphinx)

Source from the content-addressed store, hash-verified

113 _builder_cls: type[Builder]
114
115 def __init__(self, app: Sphinx) -> None:
116 self._app: Sphinx = app
117 self.doctreedir = app.doctreedir
118 self.srcdir = app.srcdir
119 self.config: Config = None # type: ignore[assignment]
120 self.config_status: int = CONFIG_UNSET
121 self.config_status_extra: str = ''
122 self.events: EventManager = app.events
123 self.project: Project = app.project
124 self.version: Mapping[str, int] = _get_env_version(app.extensions)
125
126 # the method of doctree versioning; see set_versioning_method
127 self.versioning_condition: Literal[False] | Callable[[Node], bool] | None = None
128 self.versioning_compare: bool | None = None
129
130 # the docutils settings for building
131 self.settings: dict[str, Any] = default_settings.copy()
132 self.settings['env'] = self
133
134 # All "docnames" here are /-separated and relative and exclude
135 # the source suffix.
136
137 # docname -> time of reading (in integer microseconds)
138 # contains all read docnames
139 self.all_docs: dict[str, int] = {}
140 # docname -> set of dependent file
141 # names, relative to documentation root
142 self.dependencies: dict[str, set[_StrPath]] = defaultdict(set)
143 # docname -> set of included file
144 # docnames included from other documents
145 self.included: dict[str, set[str]] = defaultdict(set)
146 # docnames to re-read unconditionally on next build
147 self.reread_always: set[str] = set()
148
149 self._pickled_doctree_cache: dict[str, bytes] = {}
150 """In-memory cache for reading pickled doctrees from disk.
151 docname -> pickled doctree
152
153 This cache is used in the ``get_doctree`` method to avoid reading the
154 doctree from disk multiple times.
155 """
156
157 self._write_doc_doctree_cache: dict[str, nodes.document] = {}
158 """In-memory cache for unpickling doctrees from disk.
159 docname -> doctree
160
161 Items are added in ``Builder.write_doctree``, during the read phase,
162 then used only in the ``get_and_resolve_doctree`` method.
163 """
164
165 # File metadata
166 # docname -> dict of metadata items
167 self.metadata: dict[str, dict[str, Any]] = defaultdict(dict)
168
169 # TOC inventory
170 # docname -> title node
171 self.titles: dict[str, nodes.title] = {}
172 # docname -> title node; only different if

Callers 1

clearMethod · 0.45

Calls 7

setupMethod · 0.95
FilenameUniqDictClass · 0.90
DownloadFilesClass · 0.90
_get_env_versionFunction · 0.85
_CurrentDocumentClass · 0.85
_from_environmentMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected