Fix getting the names for specific scopes in jedi.names.

This commit is contained in:
Dave Halter
2016-12-17 17:46:21 +01:00
parent 5c52c7fb45
commit 9cbfb76eb5

View File

@@ -165,12 +165,14 @@ def get_module_names(module, all_scopes):
Returns a dictionary with name parts as keys and their call paths as
values.
"""
if all_scopes:
dct = module.used_names
else:
raise DeprecationWarning
dct = module.names_dict
return chain.from_iterable(dct.values())
names = chain.from_iterable(module.used_names.values())
if not all_scopes:
# We have to filter all the names that don't have the module as a
# parent_scope. There's None as a parent, because nodes in the module
# node have the parent module and not suite as all the others.
# Therefore it's important to catch that case.
names = [n for n in names if n.get_parent_scope().parent in (module, None)]
return names
class FakeName(tree.Name):