Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bpython/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,12 @@ def matches(self, cursor_offset, line, **kwargs):
# TODO add open paren for methods via _callable_prefix (or decide not
# to) unless the first character is a _ filter out all attributes
# starting with a _
if not r.word.split('.')[-1].startswith('_'):
if r.word.split('.')[-1].startswith('__'):
pass
elif r.word.split('.')[-1].startswith('_'):
matches = set(match for match in matches
if not match.split('.')[-1].startswith('__'))
else:
matches = set(match for match in matches
if not match.split('.')[-1].startswith('_'))
return matches
Expand Down
6 changes: 3 additions & 3 deletions bpython/test/test_autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,12 @@ def test_att_matches_found_on_old_style_instance(self):
locals_={'a': OldStyleFoo()}),
set(['a.method', 'a.a', 'a.b']))
self.assertIn(u'a.__dict__',
self.com.matches(3, 'a._', locals_={'a': OldStyleFoo()}))
self.com.matches(4, 'a.__', locals_={'a': OldStyleFoo()}))

@skip_old_style
def test_att_matches_found_on_old_style_class_object(self):
self.assertIn(u'A.__dict__',
self.com.matches(3, 'A._', locals_={'A': OldStyleFoo}))
self.com.matches(4, 'A.__', locals_={'A': OldStyleFoo}))

@skip_old_style
def test_issue536(self):
Expand All @@ -260,7 +260,7 @@ def __getattr__(self, attr):

locals_ = {'a': OldStyleWithBrokenGetAttr()}
self.assertIn(u'a.__module__',
self.com.matches(3, 'a._', locals_=locals_))
self.com.matches(4, 'a.__', locals_=locals_))


class TestMagicMethodCompletion(unittest.TestCase):
Expand Down