MCPcopy Create free account
hub / github.com/NVIDIA/NeMo-Relay / generate

Function generate

scripts/docs/generate_rust_library_reference.py:637–651  ·  view source on GitHub ↗
(repo_root: Path, doc_root: Path, output_dir: Path, *, run_cargo_doc: bool)

Source from the content-addressed store, hash-verified

635
636
637def generate(repo_root: Path, doc_root: Path, output_dir: Path, *, run_cargo_doc: bool) -> int:
638 if run_cargo_doc:
639 _run_cargo_doc(repo_root)
640 pages_by_html = _discover_pages(doc_root, output_dir)
641 positions = _positions(pages_by_html, doc_root)
642
643 reset_output_dir(output_dir)
644 _write_index(output_dir)
645
646 for index, page in enumerate(sorted(pages_by_html.values(), key=lambda page: page.output_path.as_posix()), start=1):
647 page.output_path.parent.mkdir(parents=True, exist_ok=True)
648 position = positions.get(page.html_path, index)
649 page.output_path.write_text(_render_page(page, pages_by_html, position), encoding="utf-8")
650
651 return len(pages_by_html)
652
653
654def main() -> None:

Callers 1

mainFunction · 0.70

Calls 7

reset_output_dirFunction · 0.90
_run_cargo_docFunction · 0.85
_discover_pagesFunction · 0.85
_positionsFunction · 0.85
_render_pageFunction · 0.85
getMethod · 0.80
_write_indexFunction · 0.70

Tested by

no test coverage detected