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

Function _sibling_positions

scripts/docs/generate_python_library_reference.py:309–321  ·  view source on GitHub ↗
(modules: list[ModuleDoc])

Source from the content-addressed store, hash-verified

307
308
309def _sibling_positions(modules: list[ModuleDoc]) -> dict[str, int]:
310 by_parent: dict[tuple[str, ...], list[ModuleDoc]] = {}
311 for module in modules:
312 nav_parts = _nav_parts(module)
313 parent = tuple(nav_parts[:-1]) if len(_module_parts(module)) > 1 else ()
314 by_parent.setdefault(parent, []).append(module)
315
316 positions: dict[str, int] = {}
317 for siblings in by_parent.values():
318 siblings.sort(key=_sibling_sort_key)
319 for position, module in enumerate(siblings, start=1):
320 positions[module.name] = position
321 return positions
322
323
324def _write_index(output_dir: Path, modules: list[ModuleDoc]) -> None:

Callers 1

generateFunction · 0.85

Calls 2

_nav_partsFunction · 0.85
_module_partsFunction · 0.85

Tested by

no test coverage detected