1
0
forked from VimPlug/jedi

Fix some more await things

This commit is contained in:
Dave Halter
2018-02-28 23:30:20 +01:00
parent dfa383c744
commit 3820111d1e
4 changed files with 34 additions and 19 deletions

View File

@@ -1,17 +1,18 @@
from jedi.evaluate.filters import publish_method, BuiltinOverwrite
from jedi.evaluate.base_context import ContextSet
class AsyncBase(BuiltinOverwrite):
def __init__(self, evaluator, func_execution_context):
super(AsyncBase, self).__init__(evaluator)
self._func_execution_context = func_execution_context
self.func_execution_context = func_execution_context
@property
def name(self):
return self.get_builtin_object().py__name__()
return self.get_object().name
def __repr__(self):
return "<%s of %s>" % (type(self).__name__, self._func_execution_context)
return "<%s of %s>" % (type(self).__name__, self.func_execution_context)
class Coroutine(AsyncBase):
@@ -19,7 +20,14 @@ class Coroutine(AsyncBase):
@publish_method('__await__')
def _await(self):
return self._func_execution_context.get_return_values()
return ContextSet(CoroutineWrapper(self.evaluator, self.func_execution_context))
class CoroutineWrapper(AsyncBase):
special_object_identifier = u'COROUTINE_WRAPPER'
def py__stop_iteration_returns(self):
return self.func_execution_context.get_return_values()
class AsyncGenerator(AsyncBase):