diff --git a/jedi/api/classes.py b/jedi/api/classes.py index c393ca64..101414c3 100644 --- a/jedi/api/classes.py +++ b/jedi/api/classes.py @@ -399,7 +399,7 @@ class BaseDefinition(object): return [Signature(self._evaluator, s) for s in self._name.infer().get_signatures()] def execute(self): - return _contexts_to_definitions(self._name.infer().execute_evaluated()) + return _contexts_to_definitions(self._name.infer().execute_with_values()) class Completion(BaseDefinition): diff --git a/jedi/evaluate/base_context.py b/jedi/evaluate/base_context.py index 8a03248b..9214fb4e 100644 --- a/jedi/evaluate/base_context.py +++ b/jedi/evaluate/base_context.py @@ -38,13 +38,13 @@ class HelperContextMixin(object): def execute(self, arguments): return self.evaluator.execute(self, arguments=arguments) - def execute_evaluated(self, *value_list): + def execute_with_values(self, *value_list): from jedi.evaluate.arguments import ValuesArguments arguments = ValuesArguments([ContextSet([value]) for value in value_list]) return self.evaluator.execute(self, arguments) def execute_annotation(self): - return self.execute_evaluated() + return self.execute_with_values() def gather_annotation_classes(self): return ContextSet([self]) @@ -75,7 +75,7 @@ class HelperContextMixin(object): await_context_set = self.py__getattribute__(u"__await__") if not await_context_set: debug.warning('Tried to run __await__ on context %s', self) - return await_context_set.execute_evaluated() + return await_context_set.execute_with_values() def eval_node(self, node): return self.evaluator.eval_element(self, node) @@ -91,9 +91,9 @@ class HelperContextMixin(object): # TypeError: 'async for' requires an object with __aiter__ method, got int return iter([ LazyKnownContexts( - self.py__getattribute__('__aiter__').execute_evaluated() - .py__getattribute__('__anext__').execute_evaluated() - .py__getattribute__('__await__').execute_evaluated() + self.py__getattribute__('__aiter__').execute_with_values() + .py__getattribute__('__anext__').execute_with_values() + .py__getattribute__('__await__').execute_with_values() .py__stop_iteration_returns() ) # noqa ]) @@ -397,8 +397,8 @@ class ContextSet(BaseContextSet): def execute(self, arguments): return ContextSet.from_sets(c.evaluator.execute(c, arguments) for c in self._set) - def execute_evaluated(self, *args, **kwargs): - return ContextSet.from_sets(c.execute_evaluated(*args, **kwargs) for c in self._set) + def execute_with_values(self, *args, **kwargs): + return ContextSet.from_sets(c.execute_with_values(*args, **kwargs) for c in self._set) def py__getattribute__(self, *args, **kwargs): if kwargs.get('is_goto'): diff --git a/jedi/evaluate/compiled/__init__.py b/jedi/evaluate/compiled/__init__.py index cfda727b..2fb81192 100644 --- a/jedi/evaluate/compiled/__init__.py +++ b/jedi/evaluate/compiled/__init__.py @@ -29,7 +29,7 @@ class CompiledValue(LazyContextWrapper): def _get_wrapped_context(self): instance, = builtin_from_name( - self.evaluator, self._compiled_obj.name.string_name).execute_evaluated() + self.evaluator, self._compiled_obj.name.string_name).execute_with_values() return instance def __repr__(self): @@ -50,7 +50,7 @@ def create_simple_object(evaluator, obj): def get_string_context_set(evaluator): - return builtin_from_name(evaluator, u'str').execute_evaluated() + return builtin_from_name(evaluator, u'str').execute_with_values() def load_module(evaluator, dotted_name, **kwargs): diff --git a/jedi/evaluate/compiled/context.py b/jedi/evaluate/compiled/context.py index 731fce0b..f7c91b59 100644 --- a/jedi/evaluate/compiled/context.py +++ b/jedi/evaluate/compiled/context.py @@ -328,7 +328,7 @@ class SignatureParamName(ParamNameInterface, AbstractNameDefinition): contexts = ContextSet([create_from_access_path(evaluator, p.default)]) if p.has_annotation: annotation = create_from_access_path(evaluator, p.annotation) - contexts |= annotation.execute_evaluated() + contexts |= annotation.execute_with_values() return contexts diff --git a/jedi/evaluate/compiled/mixed.py b/jedi/evaluate/compiled/mixed.py index 37d9fbe2..a11aefb7 100644 --- a/jedi/evaluate/compiled/mixed.py +++ b/jedi/evaluate/compiled/mixed.py @@ -283,7 +283,7 @@ def _create(evaluator, access_handle, parent_context, *args): if tree_node.type == 'classdef': if not access_handle.is_class(): # Is an instance, not a class. - tree_contexts = tree_contexts.execute_evaluated() + tree_contexts = tree_contexts.execute_with_values() return ContextSet( MixedObject(compiled_object, tree_context=tree_context) diff --git a/jedi/evaluate/context/function.py b/jedi/evaluate/context/function.py index 203dcf0d..1cbe4fe1 100644 --- a/jedi/evaluate/context/function.py +++ b/jedi/evaluate/context/function.py @@ -65,7 +65,7 @@ class FunctionMixin(object): ) else: cls = self.py__class__() - for instance in cls.execute_evaluated(): + for instance in cls.execute_with_values(): for filter in instance.get_filters(search_global=False, origin_scope=origin_scope): yield filter diff --git a/jedi/evaluate/context/instance.py b/jedi/evaluate/context/instance.py index e00ff031..a5340e7b 100644 --- a/jedi/evaluate/context/instance.py +++ b/jedi/evaluate/context/instance.py @@ -107,7 +107,7 @@ class AbstractInstanceContext(Context): def execute_function_slots(self, names, *evaluated_args): return ContextSet.from_sets( - name.infer().execute_evaluated(*evaluated_args) + name.infer().execute_with_values(*evaluated_args) for name in names ) diff --git a/jedi/evaluate/context/iterable.py b/jedi/evaluate/context/iterable.py index bf69bde5..befcc8e8 100644 --- a/jedi/evaluate/context/iterable.py +++ b/jedi/evaluate/context/iterable.py @@ -793,7 +793,7 @@ class Slice(object): def __getattr__(self, name): if self._slice_object is None: context = compiled.builtin_from_name(self._context.evaluator, 'slice') - self._slice_object, = context.execute_evaluated() + self._slice_object, = context.execute_with_values() return getattr(self._slice_object, name) @property diff --git a/jedi/evaluate/finder.py b/jedi/evaluate/finder.py index 7b8b0015..0fd58604 100644 --- a/jedi/evaluate/finder.py +++ b/jedi/evaluate/finder.py @@ -284,7 +284,7 @@ def _check_isinstance_type(context, element, search_name): for cls_or_tup in lazy_context_cls.infer(): if isinstance(cls_or_tup, iterable.Sequence) and cls_or_tup.array_type == 'tuple': for lazy_context in cls_or_tup.py__iter__(): - context_set |= lazy_context.infer().execute_evaluated() + context_set |= lazy_context.infer().execute_with_values() else: - context_set |= cls_or_tup.execute_evaluated() + context_set |= cls_or_tup.execute_with_values() return context_set diff --git a/jedi/evaluate/gradual/conversion.py b/jedi/evaluate/gradual/conversion.py index 88f49428..32067612 100644 --- a/jedi/evaluate/gradual/conversion.py +++ b/jedi/evaluate/gradual/conversion.py @@ -28,7 +28,7 @@ def _stub_to_python_context_set(stub_context, ignore_compiled=False): contexts = _infer_from_stub(stub_module, qualified_names, ignore_compiled) if was_instance: contexts = ContextSet.from_sets( - c.execute_evaluated() + c.execute_with_values() for c in contexts if c.is_class() ) @@ -188,7 +188,7 @@ def to_stub(context): if was_instance: stub_contexts = ContextSet.from_sets( - c.execute_evaluated() + c.execute_with_values() for c in stub_contexts if c.is_class() ) diff --git a/jedi/evaluate/syntax_tree.py b/jedi/evaluate/syntax_tree.py index 89c51d34..c79026e2 100644 --- a/jedi/evaluate/syntax_tree.py +++ b/jedi/evaluate/syntax_tree.py @@ -139,7 +139,7 @@ def eval_node(context, element): # Implies that it's a yield from. element = element.children[1].children[1] generators = context.eval_node(element) \ - .py__getattribute__('__iter__').execute_evaluated() + .py__getattribute__('__iter__').execute_with_values() return generators.py__stop_iteration_returns() # Generator.send() is not implemented. @@ -391,7 +391,7 @@ def _literals_to_types(evaluator, result): # Literals are only valid as long as the operations are # correct. Otherwise add a value-free instance. cls = compiled.builtin_from_name(evaluator, typ.name.string_name) - new_result |= cls.execute_evaluated() + new_result |= cls.execute_with_values() else: new_result |= ContextSet([typ]) return new_result @@ -608,7 +608,7 @@ def tree_name_to_contexts(evaluator, context, tree_name): elif typ == 'with_stmt': context_managers = context.eval_node(node.get_test_node_from_name(tree_name)) enter_methods = context_managers.py__getattribute__(u'__enter__') - return enter_methods.execute_evaluated() + return enter_methods.execute_with_values() elif typ in ('import_from', 'import_name'): types = imports.infer_import(context, tree_name) elif typ in ('funcdef', 'classdef'): @@ -618,7 +618,7 @@ def tree_name_to_contexts(evaluator, context, tree_name): # TODO check for types that are not classes and add it to # the static analysis report. exceptions = context.eval_node(tree_name.get_previous_sibling().get_previous_sibling()) - types = exceptions.execute_evaluated() + types = exceptions.execute_with_values() elif node.type == 'param': types = NO_CONTEXTS else: diff --git a/jedi/plugins/stdlib.py b/jedi/plugins/stdlib.py index 2f2608fb..8ccb5970 100644 --- a/jedi/plugins/stdlib.py +++ b/jedi/plugins/stdlib.py @@ -211,13 +211,13 @@ def builtins_next(iterators, defaults, evaluator): # TODO theoretically we have to check here if something is an iterator. # That is probably done by checking if it's not a class. - return defaults | iterators.py__getattribute__(name).execute_evaluated() + return defaults | iterators.py__getattribute__(name).execute_with_values() @argument_clinic('iterator[, default], /') def builtins_iter(iterators_or_callables, defaults): # TODO implement this if it's a callable. - return iterators_or_callables.py__getattribute__('__iter__').execute_evaluated() + return iterators_or_callables.py__getattribute__('__iter__').execute_with_values() @argument_clinic('object, name[, default], /') @@ -253,7 +253,7 @@ class SuperInstance(LazyContextWrapper): return self._instance.py__class__().py__bases__() def _get_wrapped_context(self): - objs = self._get_bases()[0].infer().execute_evaluated() + objs = self._get_bases()[0].infer().execute_with_values() if not objs: # This is just a fallback and will only be used, if it's not # possible to find a class @@ -262,7 +262,7 @@ class SuperInstance(LazyContextWrapper): def get_filters(self, search_global=False, until_position=None, origin_scope=None): for b in self._get_bases(): - for obj in b.infer().execute_evaluated(): + for obj in b.infer().execute_with_values(): for f in obj.get_filters(): yield f @@ -312,7 +312,7 @@ def builtins_reversed(sequences, obj, arguments): # necessary, because `reversed` is a function and autocompletion # would fail in certain cases like `reversed(x).__iter__` if we # just returned the result directly. - seq, = obj.evaluator.typing_module.py__getattribute__('Iterator').execute_evaluated() + seq, = obj.evaluator.typing_module.py__getattribute__('Iterator').execute_with_values() return ContextSet([ReversedObject(seq, list(reversed(ordered)))]) @@ -813,7 +813,7 @@ class EnumInstance(LazyContextWrapper): return ContextName(self, self._name.tree_name) def _get_wrapped_context(self): - obj, = self._cls.execute_evaluated() + obj, = self._cls.execute_with_values() return obj def get_filters(self, search_global=False, position=None, origin_scope=None): diff --git a/test/test_evaluate/test_compiled.py b/test/test_evaluate/test_compiled.py index 00bda1ee..0d4bb900 100644 --- a/test/test_evaluate/test_compiled.py +++ b/test/test_evaluate/test_compiled.py @@ -14,7 +14,7 @@ from jedi.evaluate.gradual.conversion import _stub_to_python_context_set def test_simple(evaluator, environment): obj = compiled.create_simple_object(evaluator, u'_str_') upper, = obj.py__getattribute__(u'upper') - objs = list(upper.execute_evaluated()) + objs = list(upper.execute_with_values()) assert len(objs) == 1 if environment.version_info.major == 2: expected = 'unicode' diff --git a/test/test_evaluate/test_representation.py b/test/test_evaluate/test_representation.py index 61130230..236eac28 100644 --- a/test/test_evaluate/test_representation.py +++ b/test/test_evaluate/test_representation.py @@ -20,8 +20,8 @@ def test_function_execution(Script): # Now just use the internals of the result (easiest way to get a fully # usable function). # Should return the same result both times. - assert len(func.execute_evaluated()) == 1 - assert len(func.execute_evaluated()) == 1 + assert len(func.execute_with_values()) == 1 + assert len(func.execute_with_values()) == 1 def test_class_mro(Script):