1
0
forked from VimPlug/jedi

Rename some functions -> evaluate_ to infer_

This commit is contained in:
Dave Halter
2019-08-15 00:15:38 +02:00
parent 3b4f292464
commit 199799a966
2 changed files with 7 additions and 7 deletions

View File

@@ -183,7 +183,7 @@ def _strip_rst_role(type_str):
return type_str
def _evaluate_for_statement_string(module_context, string):
def _infer_for_statement_string(module_context, string):
code = dedent(u("""
def pseudo_docstring_stuff():
'''
@@ -276,7 +276,7 @@ def infer_param(execution_context, param):
return ContextSet(
p
for param_str in _search_param_in_docstr(docstring, param.name.value)
for p in _evaluate_for_statement_string(module_context, param_str)
for p in _infer_for_statement_string(module_context, param_str)
)
module_context = execution_context.get_root_context()
func = param.get_parent_function()
@@ -307,5 +307,5 @@ def infer_return_types(function_context):
yield type_
for type_str in search_return_in_docstr(function_context.py__doc__()):
for type_eval in _evaluate_for_statement_string(function_context.get_root_context(), type_str):
for type_eval in _infer_for_statement_string(function_context.get_root_context(), type_str):
yield type_eval

View File

@@ -44,7 +44,7 @@ def eval_annotation(context, annotation):
return context_set
def _evaluate_annotation_string(context, string, index=None):
def _infer_annotation_string(context, string, index=None):
node = _get_forward_reference_node(context, string)
if node is None:
return NO_CONTEXTS
@@ -168,7 +168,7 @@ def _infer_param(execution_context, param):
return NO_CONTEXTS
param_comment = params_comments[index]
return _evaluate_annotation_string(
return _infer_annotation_string(
execution_context.function_context.get_default_param_context(),
param_comment
)
@@ -209,7 +209,7 @@ def infer_return_types(function_execution_context):
if not match:
return NO_CONTEXTS
return _evaluate_annotation_string(
return _infer_annotation_string(
function_execution_context.function_context.get_default_param_context(),
match.group(1).strip()
).execute_annotation()
@@ -372,7 +372,7 @@ def _find_type_from_comment_hint(context, node, varlist, name):
match = re.match(r"^#\s*type:\s*([^#]*)", comment)
if match is None:
return []
return _evaluate_annotation_string(
return _infer_annotation_string(
context, match.group(1).strip(), index
).execute_annotation()