133 |
135 |
134 @param text The text to be completed. (string) |
136 @param text The text to be completed. (string) |
135 @return A list of all keywords, built-in functions and names currently |
137 @return A list of all keywords, built-in functions and names currently |
136 defined in self.namespace that match. |
138 defined in self.namespace that match. |
137 """ |
139 """ |
138 import keyword |
|
139 |
|
140 matches = [] |
140 matches = [] |
141 seen = {"__builtins__"} |
141 seen = {"__builtins__"} |
142 n = len(text) |
142 n = len(text) |
143 for word in keyword.kwlist: |
143 for word in keyword.kwlist: |
144 if word[:n] == text: |
144 if word[:n] == text: |
176 with a __getattr__ hook is evaluated. |
176 with a __getattr__ hook is evaluated. |
177 |
177 |
178 @param text The text to be completed. (string) |
178 @param text The text to be completed. (string) |
179 @return A list of all matches. |
179 @return A list of all matches. |
180 """ |
180 """ |
181 import re |
|
182 |
|
183 m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text) |
181 m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text) |
184 if not m: |
182 if not m: |
185 return [] |
183 return [] |
186 expr, attr = m.group(1, 3) |
184 expr, attr = m.group(1, 3) |
187 try: |
185 try: |