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

Method get_doctree

sphinx/environment/__init__.py:650–662  ·  view source on GitHub ↗

Read the doctree for a file from the pickle and return it.

(self, docname: str)

Source from the content-addressed store, hash-verified

648 # --------- RESOLVING REFERENCES AND TOCTREES ------------------------------
649
650 def get_doctree(self, docname: str) -> nodes.document:
651 """Read the doctree for a file from the pickle and return it."""
652 try:
653 serialised = self._pickled_doctree_cache[docname]
654 except KeyError:
655 filename = self.doctreedir / f'{docname}.doctree'
656 with open(filename, 'rb') as f:
657 serialised = self._pickled_doctree_cache[docname] = f.read()
658
659 doctree = pickle.loads(serialised)
660 doctree.settings.env = self
661 doctree.reporter = LoggingReporter(str(self.doc2path(docname)))
662 return doctree
663
664 @functools.cached_property
665 def master_doctree(self) -> nodes.document:

Callers 15

master_doctreeMethod · 0.95
write_documentsMethod · 0.80
assemble_doctreeMethod · 0.80
assemble_doctreeMethod · 0.80
write_documentsMethod · 0.80
get_contentsnameMethod · 0.80
assemble_doctreeMethod · 0.80
_resolve_numref_xrefMethod · 0.80
_walk_docMethod · 0.80
write_documentsMethod · 0.80

Calls 4

doc2pathMethod · 0.95
LoggingReporterClass · 0.90
readMethod · 0.45
loadsMethod · 0.45

Tested by 15

write_documentsMethod · 0.64
test_rst_prologFunction · 0.64
test_default_role1Function · 0.64
test_default_role2Function · 0.64
test_sectioningFunction · 0.64
test_code_block_dedentFunction · 0.64
test_move_module_targetsFunction · 0.64