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
+8 -6
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 Returns a dictionary with name parts as keys and their call paths as
values. values.
""" """
if all_scopes: names = chain.from_iterable(module.used_names.values())
dct = module.used_names if not all_scopes:
else: # We have to filter all the names that don't have the module as a
raise DeprecationWarning # parent_scope. There's None as a parent, because nodes in the module
dct = module.names_dict # node have the parent module and not suite as all the others.
return chain.from_iterable(dct.values()) # 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): class FakeName(tree.Name):