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