forked from VimPlug/jedi
Avoid the need to import search_ancestor
This commit is contained in:
@@ -12,15 +12,12 @@ The signature here for bar should be `bar(b, c)` instead of bar(*args).
|
||||
"""
|
||||
from inspect import Parameter
|
||||
|
||||
from parso import tree
|
||||
|
||||
from jedi.inference.utils import to_list
|
||||
from jedi.inference.names import ParamNameWrapper
|
||||
from jedi.inference.helpers import is_big_annoying_library
|
||||
|
||||
|
||||
def _iter_nodes_for_param(param_name):
|
||||
from parso.python.tree import search_ancestor
|
||||
from jedi.inference.arguments import TreeArguments
|
||||
|
||||
execution_context = param_name.parent_context
|
||||
@@ -28,7 +25,7 @@ def _iter_nodes_for_param(param_name):
|
||||
# tree rather than going via the execution context so that we're agnostic of
|
||||
# the specific scope we're evaluating within (i.e: module or function,
|
||||
# etc.).
|
||||
function_node = tree.search_ancestor(param_name.tree_name, 'funcdef', 'lambdef')
|
||||
function_node = param_name.tree_name.search_ancestor('funcdef', 'lambdef')
|
||||
module_node = function_node.get_root_node()
|
||||
start = function_node.children[-1].start_pos
|
||||
end = function_node.children[-1].end_pos
|
||||
@@ -38,7 +35,7 @@ def _iter_nodes_for_param(param_name):
|
||||
argument = name.parent
|
||||
if argument.type == 'argument' \
|
||||
and argument.children[0] == '*' * param_name.star_count:
|
||||
trailer = search_ancestor(argument, 'trailer')
|
||||
trailer = argument.search_ancestor('trailer')
|
||||
if trailer is not None: # Make sure we're in a function
|
||||
context = execution_context.create_context(trailer)
|
||||
if _goes_to_param_name(param_name, context, name):
|
||||
|
||||
Reference in New Issue
Block a user