forked from VimPlug/jedi
get_executed_params_and_issues -> get_executed_param_names_and_issues
This commit is contained in:
@@ -12,7 +12,7 @@ from jedi.inference.names import ParamName, TreeNameDefinition
|
|||||||
from jedi.inference.base_value import NO_VALUES, ValueSet, ContextualizedNode
|
from jedi.inference.base_value import NO_VALUES, ValueSet, ContextualizedNode
|
||||||
from jedi.inference.value import iterable
|
from jedi.inference.value import iterable
|
||||||
from jedi.inference.cache import inference_state_as_method_param_cache
|
from jedi.inference.cache import inference_state_as_method_param_cache
|
||||||
from jedi.inference.param import get_executed_params_and_issues
|
from jedi.inference.param import get_executed_param_names_and_issues
|
||||||
|
|
||||||
|
|
||||||
def try_iter_content(types, depth=0):
|
def try_iter_content(types, depth=0):
|
||||||
@@ -144,8 +144,8 @@ class _AbstractArgumentsMixin(object):
|
|||||||
def unpack(self, funcdef=None):
|
def unpack(self, funcdef=None):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def get_executed_params_and_issues(self, execution_context):
|
def get_executed_param_names_and_issues(self, execution_context):
|
||||||
return get_executed_params_and_issues(execution_context, self)
|
return get_executed_param_names_and_issues(execution_context, self)
|
||||||
|
|
||||||
def get_calling_nodes(self):
|
def get_calling_nodes(self):
|
||||||
return []
|
return []
|
||||||
@@ -158,7 +158,7 @@ class AbstractArguments(_AbstractArgumentsMixin):
|
|||||||
|
|
||||||
|
|
||||||
class AnonymousArguments(AbstractArguments):
|
class AnonymousArguments(AbstractArguments):
|
||||||
def get_executed_params_and_issues(self, execution_context):
|
def get_executed_param_names_and_issues(self, execution_context):
|
||||||
from jedi.inference.dynamic import search_params
|
from jedi.inference.dynamic import search_params
|
||||||
return search_params(
|
return search_params(
|
||||||
execution_context.inference_state,
|
execution_context.inference_state,
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ def search_params(inference_state, execution_context, funcdef):
|
|||||||
)
|
)
|
||||||
if function_executions:
|
if function_executions:
|
||||||
zipped_params = zip(*list(
|
zipped_params = zip(*list(
|
||||||
function_execution.get_executed_params_and_issues()[0]
|
function_execution.get_executed_param_names_and_issues()[0]
|
||||||
for function_execution in function_executions
|
for function_execution in function_executions
|
||||||
))
|
))
|
||||||
params = [DynamicExecutedParams(inference_state, executed_params)
|
params = [DynamicExecutedParams(inference_state, executed_params)
|
||||||
@@ -205,7 +205,7 @@ def _check_name_for_execution(inference_state, context, compare_node, name, trai
|
|||||||
# Here we're trying to find decorators by checking the first
|
# Here we're trying to find decorators by checking the first
|
||||||
# parameter. It's not very generic though. Should find a better
|
# parameter. It's not very generic though. Should find a better
|
||||||
# solution that also applies to nested decorators.
|
# solution that also applies to nested decorators.
|
||||||
params, _ = value.parent_context.get_executed_params_and_issues()
|
params, _ = value.parent_context.get_executed_param_names_and_issues()
|
||||||
if len(params) != 1:
|
if len(params) != 1:
|
||||||
continue
|
continue
|
||||||
values = params[0].infer()
|
values = params[0].infer()
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ def infer_type_vars_for_execution(execution_context, annotation_dict):
|
|||||||
context = execution_context.function_value.get_default_param_context()
|
context = execution_context.function_value.get_default_param_context()
|
||||||
|
|
||||||
annotation_variable_results = {}
|
annotation_variable_results = {}
|
||||||
executed_params, _ = execution_context.get_executed_params_and_issues()
|
executed_params, _ = execution_context.get_executed_param_names_and_issues()
|
||||||
for executed_param in executed_params:
|
for executed_param in executed_params:
|
||||||
try:
|
try:
|
||||||
annotation_node = annotation_dict[executed_param.string_name]
|
annotation_node = annotation_dict[executed_param.string_name]
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ class ParamName(BaseTreeParamName):
|
|||||||
return self.get_param().infer()
|
return self.get_param().infer()
|
||||||
|
|
||||||
def get_param(self):
|
def get_param(self):
|
||||||
params, _ = self.parent_context.get_executed_params_and_issues()
|
params, _ = self.parent_context.get_executed_param_names_and_issues()
|
||||||
param_node = search_ancestor(self.tree_name, 'param')
|
param_node = search_ancestor(self.tree_name, 'param')
|
||||||
return params[param_node.position_index]
|
return params[param_node.position_index]
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class ExecutedParam(object):
|
|||||||
return '<%s: %s>' % (self.__class__.__name__, self.string_name)
|
return '<%s: %s>' % (self.__class__.__name__, self.string_name)
|
||||||
|
|
||||||
|
|
||||||
def get_executed_params_and_issues(execution_context, arguments):
|
def get_executed_param_names_and_issues(execution_context, arguments):
|
||||||
def too_many_args(argument):
|
def too_many_args(argument):
|
||||||
m = _error_argument_count(funcdef, len(unpacked_va))
|
m = _error_argument_count(funcdef, len(unpacked_va))
|
||||||
# Just report an error for the first param that is not needed (like
|
# Just report an error for the first param that is not needed (like
|
||||||
|
|||||||
@@ -286,11 +286,11 @@ class FunctionExecutionContext(ValueContext, TreeContextMixin):
|
|||||||
origin_scope=origin_scope)
|
origin_scope=origin_scope)
|
||||||
|
|
||||||
@inference_state_method_cache()
|
@inference_state_method_cache()
|
||||||
def get_executed_params_and_issues(self):
|
def get_executed_param_names_and_issues(self):
|
||||||
return self.var_args.get_executed_params_and_issues(self)
|
return self.var_args.get_executed_param_names_and_issues(self)
|
||||||
|
|
||||||
def matches_signature(self):
|
def matches_signature(self):
|
||||||
executed_params, issues = self.get_executed_params_and_issues()
|
executed_params, issues = self.get_executed_param_names_and_issues()
|
||||||
if issues:
|
if issues:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class AnonymousInstanceArguments(AnonymousArguments):
|
|||||||
def __init__(self, instance):
|
def __init__(self, instance):
|
||||||
self._instance = instance
|
self._instance = instance
|
||||||
|
|
||||||
def get_executed_params_and_issues(self, execution_context):
|
def get_executed_param_names_and_issues(self, execution_context):
|
||||||
from jedi.inference.dynamic import search_params
|
from jedi.inference.dynamic import search_params
|
||||||
tree_params = execution_context.tree_node.get_params()
|
tree_params = execution_context.tree_node.get_params()
|
||||||
if not tree_params:
|
if not tree_params:
|
||||||
@@ -542,8 +542,8 @@ class InstanceArguments(TreeArgumentsWrapper):
|
|||||||
for values in self._wrapped_arguments.unpack(func):
|
for values in self._wrapped_arguments.unpack(func):
|
||||||
yield values
|
yield values
|
||||||
|
|
||||||
def get_executed_params_and_issues(self, execution_context):
|
def get_executed_param_names_and_issues(self, execution_context):
|
||||||
if isinstance(self._wrapped_arguments, AnonymousInstanceArguments):
|
if isinstance(self._wrapped_arguments, AnonymousInstanceArguments):
|
||||||
return self._wrapped_arguments.get_executed_params_and_issues(execution_context)
|
return self._wrapped_arguments.get_executed_param_names_and_issues(execution_context)
|
||||||
|
|
||||||
return super(InstanceArguments, self).get_executed_params_and_issues(execution_context)
|
return super(InstanceArguments, self).get_executed_param_names_and_issues(execution_context)
|
||||||
|
|||||||
Reference in New Issue
Block a user