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

Function has_any_completions

IPython/core/completer.py:718–736  ·  view source on GitHub ↗

Check if any result includes any completions.

(result: MatcherResult)

Source from the content-addressed store, hash-verified

716
717
718def has_any_completions(result: MatcherResult) -> bool:
719 """Check if any result includes any completions."""
720 completions = result["completions"]
721 if _is_sizable(completions):
722 return len(completions) != 0
723 if _is_iterator(completions):
724 try:
725 old_iterator = completions
726 first = next(old_iterator)
727 result["completions"] = cast(
728 Iterator[SimpleCompletion],
729 itertools.chain([first], old_iterator),
730 )
731 return True
732 except StopIteration:
733 return False
734 raise ValueError(
735 "Completions returned by matcher need to be an Iterator or a Sizable"
736 )
737
738
739def completion_matcher(

Callers 1

_completeMethod · 0.85

Calls 2

_is_sizableFunction · 0.85
_is_iteratorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…