mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-18 06:19:39 +08:00
Fix getting the names for specific scopes in jedi.names.
This commit is contained in:
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user