src/eric7/DebugClients/Python/FlexCompleter.py

branch
eric7
changeset 9482
a2bc06a54d9d
parent 9473
3f23dbf37dbe
child 10417
c6011e501282
equal deleted inserted replaced
9481:0b936ff1bbb9 9482:a2bc06a54d9d
47 </li> 47 </li>
48 </ul> 48 </ul>
49 """ 49 """
50 50
51 import builtins 51 import builtins
52 import keyword
53 import re
52 54
53 import __main__ 55 import __main__
54 56
55 __all__ = ["Completer"] 57 __all__ = ["Completer"]
56 58
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:

eric ide

mercurial