MCPcopy Create free account
hub / github.com/ipython/traitlets / write_doc

Function write_doc

traitlets/config/sphinxdoc.py:140–164  ·  view source on GitHub ↗

Write a rst file documenting config options for a traitlets application. Parameters ---------- path : str The file to be written title : str The human-readable title of the document app : traitlets.config.Application An instance of the application class t

(path: str, title: str, app: Application, preamble: str | None = None)

Source from the content-addressed store, hash-verified

138
139
140def write_doc(path: str, title: str, app: Application, preamble: str | None = None) -> None:
141 """Write a rst file documenting config options for a traitlets application.
142
143 Parameters
144 ----------
145 path : str
146 The file to be written
147 title : str
148 The human-readable title of the document
149 app : traitlets.config.Application
150 An instance of the application class to be documented
151 preamble : str
152 Extra text to add just after the title (optional)
153 """
154 trait_aliases = reverse_aliases(app)
155 with open(path, "w") as f:
156 f.write(title + "\n")
157 f.write(("=" * len(title)) + "\n")
158 f.write("\n")
159 if preamble is not None:
160 f.write(preamble + "\n\n")
161
162 for c in app._classes_inc_parents():
163 f.write(class_config_rst_doc(c, trait_aliases))
164 f.write("\n")

Callers

nothing calls this directly

Calls 3

reverse_aliasesFunction · 0.85
class_config_rst_docFunction · 0.85
_classes_inc_parentsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…