1
0
forked from VimPlug/jedi

get_module_names: fix "all_scopes=False" handling

Previously, names defined within the scope of first-level classes or functions
were returned.
This commit is contained in:
immerrr
2018-10-18 13:53:47 +03:00
parent a8401f6923
commit 1e8674b51c
2 changed files with 31 additions and 3 deletions

View File

@@ -234,6 +234,14 @@ def is_scope(node):
return node.type in ('file_input', 'classdef', 'funcdef', 'lambdef', 'comp_for')
def is_name_of_func_or_class_def(name_node, func_or_class_def_node):
"""Return True if name_node is the name of the func_or_class_def_node."""
return (
name_node.parent is func_or_class_def_node and
name_node.type == 'name' and
func_or_class_def_node.type in ('classdef', 'funcdef'))
def get_parent_scope(node, include_flows=False):
"""
Returns the underlying scope.