MCPcopy Create free account
hub / github.com/Qinbf/groundmap / find_owner

Function find_owner

scripts/k.py:1705–1713  ·  view source on GitHub ↗
(start: int, end: int, self_anchor: str | None)

Source from the content-addressed store, hash-verified

1703
1704 # 给每个 block 找 owning section(包含它且 level 最深的 H 节点)
1705 def find_owner(start: int, end: int, self_anchor: str | None) -> str | None:
1706 best: tuple[int, str] | None = None # (level, anchor)
1707 for h_start, h_end, h_anchor, h_level in heading_intervals:
1708 if h_anchor == self_anchor:
1709 continue # heading 自己不当作 owner
1710 if h_start <= start < h_end:
1711 if best is None or h_level > best[0]:
1712 best = (h_level, h_anchor)
1713 return best[1] if best else None
1714
1715 out_blocks: list[dict] = []
1716 counts: dict[str, int] = {}

Callers 1

list_all_blocksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected