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)
| 69 | self.namespace = namespace |
| 70 | |
| 71 | def complete(self, text, state): |
| 72 | """Return the next possible completion for 'text'. |
| 73 | |
| 74 | This is called successively with state == 0, 1, 2, ... until it |
| 75 | returns None. The completion should begin with 'text'. |
| 76 | |
| 77 | """ |
| 78 | if self.use_main_ns: |
| 79 | self.namespace = __main__.__dict__ |
| 80 | |
| 81 | if not text.strip(): |
| 82 | if state == 0: |
| 83 | if _readline_available: |
| 84 | readline.insert_text('\t') |
| 85 | readline.redisplay() |
| 86 | return '' |
| 87 | else: |
| 88 | return '\t' |
| 89 | else: |
| 90 | return None |
| 91 | |
| 92 | if state == 0: |
| 93 | with warnings.catch_warnings(action="ignore"): |
| 94 | if "." in text: |
| 95 | self.matches = self.attr_matches(text) |
| 96 | else: |
| 97 | self.matches = self.global_matches(text) |
| 98 | try: |
| 99 | return self.matches[state] |
| 100 | except IndexError: |
| 101 | return None |
| 102 | |
| 103 | def _callable_postfix(self, val, word): |
| 104 | if callable(val): |
nothing calls this directly
no test coverage detected