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: str, state)
| 96 | self.namespace = namespace |
| 97 | |
| 98 | def complete(self, text: str, state) -> Optional[str]: |
| 99 | """Return the next possible completion for 'text'. |
| 100 | |
| 101 | This is called successively with state == 0, 1, 2, ... until it |
| 102 | returns None. The completion should begin with 'text'. |
| 103 | |
| 104 | """ |
| 105 | if self.use_main_ns: |
| 106 | self.namespace = __main__.__dict__ |
| 107 | |
| 108 | if not text.strip(): |
| 109 | if state == 0: |
| 110 | return '\t' |
| 111 | else: |
| 112 | return None |
| 113 | |
| 114 | if state == 0: |
| 115 | if "." in text: |
| 116 | self.matches = self.attr_matches(text) |
| 117 | else: |
| 118 | self.matches = self.global_matches(text) |
| 119 | try: |
| 120 | return self.matches[state] |
| 121 | except IndexError: |
| 122 | return None |
| 123 | |
| 124 | def _callable_postfix(self, val, word): |
| 125 | if callable(val) and not inspect.isclass(val): |
nothing calls this directly
no test coverage detected