MCPcopy Create free account
hub / github.com/ipython/ipython / complete

Method complete

IPython/core/completer.py:633–651  ·  view source on GitHub ↗

Return the next possible completion for 'text'. This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with 'text'.

(self, text, state)

Source from the content-addressed store, hash-verified

631 super(Completer, self).__init__(**kwargs)
632
633 def complete(self, text, state):
634 """Return the next possible completion for 'text'.
635
636 This is called successively with state == 0, 1, 2, ... until it
637 returns None. The completion should begin with 'text'.
638
639 """
640 if self.use_main_ns:
641 self.namespace = __main__.__dict__
642
643 if state == 0:
644 if "." in text:
645 self.matches = self.attr_matches(text)
646 else:
647 self.matches = self.global_matches(text)
648 try:
649 return self.matches[state]
650 except IndexError:
651 return None
652
653 def global_matches(self, text):
654 """Compute matches when text is a simple name.

Calls 2

attr_matchesMethod · 0.95
global_matchesMethod · 0.95