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

Method doc2path

sphinx/project.py:114–128  ·  view source on GitHub ↗

Return the filename for the document name. If *absolute* is True, return as an absolute path. Else, return as a relative path to the source directory.

(self, docname: str, absolute: bool)

Source from the content-addressed store, hash-verified

112 return None
113
114 def doc2path(self, docname: str, absolute: bool) -> _StrPath:
115 """Return the filename for the document name.
116
117 If *absolute* is True, return as an absolute path.
118 Else, return as a relative path to the source directory.
119 """
120 try:
121 filename = self._docname_to_path[docname]
122 except KeyError:
123 # Backwards compatibility: the document does not exist
124 filename = Path(docname + self._first_source_suffix)
125
126 if absolute:
127 return _StrPath(self.srcdir / filename)
128 return _StrPath(filename)

Callers 4

discoverMethod · 0.95
test_project_doc2pathFunction · 0.95
_doctree_for_testFunction · 0.45
process_todo_nodesFunction · 0.45

Calls 1

_StrPathClass · 0.90

Tested by 2

test_project_doc2pathFunction · 0.76
_doctree_for_testFunction · 0.36