X Tutup
Skip to content

Commit 9a58db4

Browse files
committed
Filter matches before check for no matches.
1 parent 3eb10eb commit 9a58db4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

bpython/repl.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,17 +513,17 @@ def complete(self, tab=False):
513513
matches.extend(name + '=' for name in self.argspec[1][4]
514514
if name.startswith(cw))
515515

516+
# unless the first character is a _ filter out all attributes starting with a _
517+
if not e and not cw.split('.')[-1].startswith('_'):
518+
matches = [match for match in matches
519+
if not match.split('.')[-1].startswith('_')]
520+
516521
if e or not matches:
517522
self.matches = []
518523
self.matches_iter.update()
519524
if not self.argspec:
520525
return False
521526
else:
522-
# unless the first character is a _ filter out all attributes starting with a _
523-
if not cw.split('.')[-1].startswith('_'):
524-
matches = [match for match in matches if not
525-
match.split('.')[-1].startswith('_')]
526-
527527
# remove duplicates and restore order
528528
self.matches = sorted(set(matches), self.cmp_matches,
529529
self.key_matches)

0 commit comments

Comments
 (0)
X Tutup