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)
| 138 | |
| 139 | |
| 140 | def 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") |
nothing calls this directly
no test coverage detected
searching dependent graphs…