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

Function _replace_section_entry

openkb/agent/compiler.py:870–882  ·  view source on GitHub ↗

Replace the first matching entry within a specific section.

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

Source from the content-addressed store, hash-verified

868
869
870def _replace_section_entry(lines: list[str], heading: str, link: str, entry: str) -> bool:
871 """Replace the first matching entry within a specific section."""
872 bounds = _get_section_bounds(lines, heading)
873 if bounds is None:
874 return False
875
876 start, end = bounds
877 entry_prefix = f"- {link}"
878 for i in range(start, end):
879 if lines[i].startswith(entry_prefix):
880 lines[i] = entry
881 return True
882 return False
883
884
885def _insert_section_entry(lines: list[str], heading: str, entry: str) -> bool:

Callers 1

_update_indexFunction · 0.85

Calls 1

_get_section_boundsFunction · 0.85

Tested by

no test coverage detected