MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / _section_contains_link

Function _section_contains_link

openkb/agent/compiler.py:859–867  ·  view source on GitHub ↗

Check whether an index entry already exists inside the named section.

(lines: list[str], heading: str, link: str)

Source from the content-addressed store, hash-verified

857
858
859def _section_contains_link(lines: list[str], heading: str, link: str) -> bool:
860 """Check whether an index entry already exists inside the named section."""
861 bounds = _get_section_bounds(lines, heading)
862 if bounds is None:
863 return False
864
865 start, end = bounds
866 entry_prefix = f"- {link}"
867 return any(line.startswith(entry_prefix) for line in lines[start:end])
868
869
870def _replace_section_entry(lines: list[str], heading: str, link: str, entry: str) -> bool:

Callers 1

_update_indexFunction · 0.85

Calls 1

_get_section_boundsFunction · 0.85

Tested by

no test coverage detected