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

Class Completion

IPython/core/completer.py:478–549  ·  view source on GitHub ↗

Completion object used and returned by IPython completers. .. warning:: Unstable This function is unstable, API may change without warning. It will also raise unless use in proper context manager. This act as a middle ground :any:`Completion` object between t

Source from the content-addressed store, hash-verified

476
477
478class Completion:
479 """
480 Completion object used and returned by IPython completers.
481
482 .. warning::
483
484 Unstable
485
486 This function is unstable, API may change without warning.
487 It will also raise unless use in proper context manager.
488
489 This act as a middle ground :any:`Completion` object between the
490 :class:`jedi.api.classes.Completion` object and the Prompt Toolkit completion
491 object. While Jedi need a lot of information about evaluator and how the
492 code should be ran/inspected, PromptToolkit (and other frontend) mostly
493 need user facing information.
494
495 - Which range should be replaced replaced by what.
496 - Some metadata (like completion type), or meta information to displayed to
497 the use user.
498
499 For debugging purpose we can also store the origin of the completion (``jedi``,
500 ``IPython.python_matches``, ``IPython.magics_matches``...).
501 """
502
503 __slots__ = ['start', 'end', 'text', 'type', 'signature', '_origin']
504
505 def __init__(
506 self,
507 start: int,
508 end: int,
509 text: str,
510 *,
511 type: Optional[str] = None,
512 _origin="",
513 signature="",
514 ) -> None:
515 warnings.warn(
516 "``Completion`` is a provisional API (as of IPython 6.0). "
517 "It may change without warnings. "
518 "Use in corresponding context manager.",
519 category=ProvisionalCompleterWarning,
520 stacklevel=2,
521 )
522
523 self.start = start
524 self.end = end
525 self.text = text
526 self.type = type
527 self.signature = signature
528 self._origin = _origin
529
530 def __repr__(self):
531 return '<Completion start=%s end=%s text=%r type=%r, signature=%r,>' % \
532 (self.start, self.end, self.text, self.type or '?', self.signature or '?')
533
534 def __eq__(self, other) -> bool:
535 """

Callers 6

_test_completeMethod · 0.90
_test_not_completeMethod · 0.90
_get_completionsMethod · 0.85
rectify_completionsFunction · 0.85
_completionsMethod · 0.85

Calls

no outgoing calls

Tested by 3

_test_completeMethod · 0.72
_test_not_completeMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…