Compute matches when text is a simple name. Return a list of all keywords, built-in functions and names currently defined in self.namespace that match.
(self, text)
| 111 | return word |
| 112 | |
| 113 | def global_matches(self, text): |
| 114 | """Compute matches when text is a simple name. |
| 115 | |
| 116 | Return a list of all keywords, built-in functions and names currently |
| 117 | defined in self.namespace that match. |
| 118 | |
| 119 | """ |
| 120 | matches = [] |
| 121 | seen = {"__builtins__"} |
| 122 | n = len(text) |
| 123 | for word in keyword.kwlist + keyword.softkwlist: |
| 124 | if word[:n] == text: |
| 125 | seen.add(word) |
| 126 | if word in {'finally', 'try'}: |
| 127 | word = word + ':' |
| 128 | elif word not in {'False', 'None', 'True', |
| 129 | 'break', 'continue', 'pass', |
| 130 | 'else', '_'}: |
| 131 | word = word + ' ' |
| 132 | matches.append(word) |
| 133 | for nspace in [self.namespace, builtins.__dict__]: |
| 134 | for word, val in nspace.items(): |
| 135 | if word[:n] == text and word not in seen: |
| 136 | seen.add(word) |
| 137 | matches.append(self._callable_postfix(val, word)) |
| 138 | return matches |
| 139 | |
| 140 | def attr_matches(self, text): |
| 141 | """Compute matches when text contains a dot. |