MCPcopy Create free account
hub / github.com/OpenBMB/ChatDev / _validate_edit_ranges

Function _validate_edit_ranges

functions/function_calling/file.py:951–957  ·  view source on GitHub ↗
(edits: Sequence[TextEdit])

Source from the content-addressed store, hash-verified

949
950
951def _validate_edit_ranges(edits: Sequence[TextEdit]) -> None:
952 previous_range_end = 0
953 for edit in edits:
954 effective_end = max(edit.end_line, edit.start_line - 1)
955 if edit.start_line <= previous_range_end and previous_range_end > 0:
956 raise ValueError("edit ranges overlap; merge them before calling apply_text_edits")
957 previous_range_end = max(previous_range_end, effective_end)
958
959
960def _apply_edits_in_place(lines: MutableSequence[str], edits: Sequence[TextEdit]) -> None:

Callers 1

_normalize_editsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected