From 199799a9669f22248dd7fde0c51893520f4d7851 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 15 Aug 2019 00:15:38 +0200 Subject: [PATCH] Rename some functions -> evaluate_ to infer_ --- jedi/inference/docstrings.py | 6 +++--- jedi/inference/gradual/annotation.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jedi/inference/docstrings.py b/jedi/inference/docstrings.py index f5a6b7b3..26775918 100644 --- a/jedi/inference/docstrings.py +++ b/jedi/inference/docstrings.py @@ -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 diff --git a/jedi/inference/gradual/annotation.py b/jedi/inference/gradual/annotation.py index 077202dc..f99cced4 100644 --- a/jedi/inference/gradual/annotation.py +++ b/jedi/inference/gradual/annotation.py @@ -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()