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

Method complete

IPython/core/completer.py:1108–1126  ·  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

1106 super(Completer, self).__init__(**kwargs)
1107
1108 def complete(self, text, state):
1109 """Return the next possible completion for 'text'.
1110
1111 This is called successively with state == 0, 1, 2, ... until it
1112 returns None. The completion should begin with 'text'.
1113
1114 """
1115 if self.use_main_ns:
1116 self.namespace = __main__.__dict__
1117
1118 if state == 0:
1119 if "." in text:
1120 self.matches = self.attr_matches(text)
1121 else:
1122 self.matches = self.global_matches(text)
1123 try:
1124 return self.matches[state]
1125 except IndexError:
1126 return None
1127
1128 def global_matches(self, text: str, context: Optional[CompletionContext] = None):
1129 """Compute matches when text is a simple name.

Calls 2

attr_matchesMethod · 0.95
global_matchesMethod · 0.95