Skip to content

Commit 3602242

Browse files
committed
Move regex definition
1 parent 206b0c5 commit 3602242

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

bpython/autocomplete.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,10 @@ def format(self, filename):
223223
return filename
224224

225225

226-
attr_matches_re = LazyReCompile(r"(\w+(\.\w+)*)\.(\w*)")
227-
228-
229226
class AttrCompletion(BaseCompletionType):
230227

228+
attr_matches_re = LazyReCompile(r"(\w+(\.\w+)*)\.(\w*)")
229+
231230
def matches(self, cursor_offset, line, **kwargs):
232231
if 'locals_' not in kwargs:
233232
return None
@@ -272,7 +271,7 @@ def attr_matches(self, text, namespace):
272271
# Gna, Py 2.6's rlcompleter searches for __call__ inside the
273272
# instance instead of the type, so we monkeypatch to prevent
274273
# side-effects (__getattr__/__getattribute__)
275-
m = attr_matches_re.match(text)
274+
m = self.attr_matches_re.match(text)
276275
if not m:
277276
return []
278277

0 commit comments

Comments
 (0)