MCPcopy Create free account
hub / github.com/Codeplain-ai/codeplain / _has_relative_order_change

Function _has_relative_order_change

change_detection.py:173–186  ·  view source on GitHub ↗

Check if content matches represent a true reorder (relative order changed). If all matches preserve relative order (sorted by old_idx gives same ordering as sorted by new_idx), it's just a positional shift from insertions/removals.

(matches: list[tuple[int, int]])

Source from the content-addressed store, hash-verified

171
172
173def _has_relative_order_change(matches: list[tuple[int, int]]) -> bool:
174 """Check if content matches represent a true reorder (relative order changed).
175
176 If all matches preserve relative order (sorted by old_idx gives same ordering
177 as sorted by new_idx), it's just a positional shift from insertions/removals.
178 """
179 if len(matches) <= 1:
180 return False
181 sorted_by_old = sorted(matches, key=lambda m: m[0])
182 new_indices = [m[1] for m in sorted_by_old]
183 for i in range(len(new_indices) - 1):
184 if new_indices[i] > new_indices[i + 1]:
185 return True
186 return False
187
188
189def _frid_from_index(index: int) -> str:

Callers 1

_classify_changesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected