diff --git a/jedi/plugins/typeshed.py b/jedi/plugins/typeshed.py index f496ee93..c7a9fa6e 100644 --- a/jedi/plugins/typeshed.py +++ b/jedi/plugins/typeshed.py @@ -276,6 +276,9 @@ class StubOnlyFilter(ParserTreeFilter): if definition.type in ('import_from', 'import_name'): if name.parent.type not in ('import_as_name', 'dotted_as_name'): return False + n = name.value + if n.startswith('_') and not (n.startswith('__') and n.endswith('__')): + return False return True diff --git a/test/completion/stdlib.py b/test/completion/stdlib.py index 68987bf0..140f3dae 100644 --- a/test/completion/stdlib.py +++ b/test/completion/stdlib.py @@ -71,6 +71,11 @@ if os.path.isfile(): #? ['abspath'] fails = os.path.abspath +# The type vars and other underscored things from typeshed should not be +# findable. +#? +os._T + with open('foo') as f: for line in f.readlines():