1
0
forked from VimPlug/jedi

Move execute_evaluated to a helper function

This commit is contained in:
Dave Halter
2018-08-05 01:26:13 +02:00
parent faba29a42b
commit 7a48fdc5f6
10 changed files with 30 additions and 22 deletions

View File

@@ -13,7 +13,7 @@ from jedi._compatibility import Python3Method, zip_longest, unicode
from jedi.parser_utils import clean_scope_docstring, get_doc_with_call_signature
from jedi.common import BaseContextSet, BaseContext
from jedi.evaluate.helpers import EvaluatorIndexError, EvaluatorTypeError, \
EvaluatorKeyError
EvaluatorKeyError, execute_evaluated
class Context(BaseContext):
@@ -33,15 +33,6 @@ class Context(BaseContext):
# overwritten.
return self.__class__.__name__.lower()
def execute_evaluated(self, *value_list):
"""
Execute a function with already executed arguments.
"""
# TODO move this out of here to the evaluator.
from jedi.evaluate.arguments import ValuesArguments
arguments = ValuesArguments([ContextSet(value) for value in value_list])
return self.evaluator.execute(self, arguments)
def iterate(self, contextualized_node=None, is_async=False):
debug.dbg('iterate %s', self)
try:
@@ -240,6 +231,9 @@ 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(execute_evaluated(c, *args, **kwargs) for c in self._set)
NO_CONTEXTS = ContextSet()