Skip to content

Commit

Permalink
Remove some code that is not necessary anmore, because of an improvme…
Browse files Browse the repository at this point in the history
…nt in get_parent_scope
  • Loading branch information
davidhalter committed Apr 12, 2019
1 parent 05eb06d commit 3c74b9b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
17 changes: 1 addition & 16 deletions jedi/evaluate/helpers.py
Expand Up @@ -8,7 +8,7 @@
from parso.python import tree

from jedi._compatibility import unicode
from jedi.parser_utils import get_parent_scope, is_name_of_func_or_class_def
from jedi.parser_utils import get_parent_scope


def is_stdlib_path(path):
Expand Down Expand Up @@ -175,21 +175,6 @@ def get_module_names(module, all_scopes):

def is_module_scope_name(name):
parent_scope = get_parent_scope(name)
if is_name_of_func_or_class_def(name, parent_scope):
# XXX: In syntax tree function- and class-name nodes are immediate children of
# their respective class-definition or function-definition nodes. Technically,
# get_parent_scope(...) for them should return the parent of the definition node,
# because
#
# def foo(...): pass
#
# is equivalent to
#
# foo = lambda(...): None
#
# but that would be a big change that could break type inference, whereas for now
# this discrepancy looks like only a problem for "get_module_names".
parent_scope = parent_scope.parent
# async functions have an extra wrapper. Strip it.
if parent_scope and parent_scope.type == 'async_stmt':
parent_scope = parent_scope.parent
Expand Down
8 changes: 0 additions & 8 deletions jedi/parser_utils.py
Expand Up @@ -242,14 +242,6 @@ 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.
Expand Down

0 comments on commit 3c74b9b

Please sign in to comment.