MCPcopy Index your code
hub / github.com/ipython/ipython / _arrange_and_extract

Method _arrange_and_extract

IPython/core/completer.py:3540–3571  ·  view source on GitHub ↗
(
        self,
        results: dict[str, MatcherResult],
        skip_matchers: set[str],
        abort_if_offset_changes: bool,
    )

Source from the content-addressed store, hash-verified

3538 )
3539
3540 def _arrange_and_extract(
3541 self,
3542 results: dict[str, MatcherResult],
3543 skip_matchers: set[str],
3544 abort_if_offset_changes: bool,
3545 ):
3546 sortable: list[AnyMatcherCompletion] = []
3547 ordered: list[AnyMatcherCompletion] = []
3548 most_recent_fragment = None
3549 for identifier, result in results.items():
3550 if identifier in skip_matchers:
3551 continue
3552 if not result["completions"]:
3553 continue
3554 if not most_recent_fragment:
3555 most_recent_fragment = result["matched_fragment"]
3556 if (
3557 abort_if_offset_changes
3558 and result["matched_fragment"] != most_recent_fragment
3559 ):
3560 break
3561 if result.get("ordered", False):
3562 ordered.extend(result["completions"])
3563 else:
3564 sortable.extend(result["completions"])
3565
3566 if not most_recent_fragment:
3567 most_recent_fragment = "" # to satisfy typechecker (and just in case)
3568
3569 return most_recent_fragment, [
3570 m.text for m in self._deduplicate(ordered + self._sort(sortable))
3571 ]
3572
3573 def _complete(self, *, cursor_line, cursor_pos, line_buffer=None, text=None,
3574 full_text=None) -> _CompleteResult:

Callers 2

completeMethod · 0.95
_completeMethod · 0.95

Calls 3

_deduplicateMethod · 0.95
_sortMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected