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

Function _item_order

scripts/docs/generate_rust_library_reference.py:590–603  ·  view source on GitHub ↗
(index_html: Path, pages_by_html: dict[Path, Page])

Source from the content-addressed store, hash-verified

588
589
590def _item_order(index_html: Path, pages_by_html: dict[Path, Page]) -> dict[Path, int]:
591 soup = BeautifulSoup(index_html.read_text(encoding="utf-8"), "html.parser")
592 positions: dict[Path, int] = {}
593 position = 1
594 for link in soup.select("#main-content dl.item-table dt a[href]"):
595 href = link.get("href", "")
596 if not isinstance(href, str):
597 continue
598 target_path = (index_html.resolve().parent / urldefrag(href)[0]).resolve()
599 if target_path not in pages_by_html:
600 continue
601 positions.setdefault(target_path, position)
602 position += 1
603 return positions
604
605
606def _positions(pages_by_html: dict[Path, Page], doc_root: Path) -> dict[Path, int]:

Callers 1

_positionsFunction · 0.85

Calls 2

getMethod · 0.80
resolveMethod · 0.80

Tested by

no test coverage detected