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