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)
| 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. |