mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Remove Coroutine classes again, they may not be needed after all
This commit is contained in:
@@ -353,7 +353,6 @@ class FunctionExecutionContext(TreeContext):
|
|||||||
else:
|
else:
|
||||||
if evaluator.environment.version_info < (3, 5):
|
if evaluator.environment.version_info < (3, 5):
|
||||||
return NO_CONTEXTS
|
return NO_CONTEXTS
|
||||||
#return ContextSet({CoroutineObject(evaluator, self)})
|
|
||||||
async_classes = evaluator.typing_module.py__getattribute__('Coroutine')
|
async_classes = evaluator.typing_module.py__getattribute__('Coroutine')
|
||||||
return_contexts = self.get_return_values()
|
return_contexts = self.get_return_values()
|
||||||
# Only the first generic is relevant.
|
# Only the first generic is relevant.
|
||||||
@@ -368,34 +367,6 @@ class FunctionExecutionContext(TreeContext):
|
|||||||
return self.get_return_values()
|
return self.get_return_values()
|
||||||
|
|
||||||
|
|
||||||
class CoroutineObject(LazyContextWrapper):
|
|
||||||
def __init__(self, evaluator, function_execution):
|
|
||||||
self.evaluator = evaluator
|
|
||||||
self._function_execution = function_execution
|
|
||||||
|
|
||||||
def _get_wrapped_context(self):
|
|
||||||
c, = self.evaluator.typing_module.py__getattribute__('Coroutine') \
|
|
||||||
.execute_annotation()
|
|
||||||
return c
|
|
||||||
|
|
||||||
def py__await__(self):
|
|
||||||
return ContextSet({CoroutineWrapper(self.evaluator, self._function_execution)})
|
|
||||||
|
|
||||||
|
|
||||||
class CoroutineWrapper(LazyContextWrapper):
|
|
||||||
def __init__(self, evaluator, function_execution):
|
|
||||||
self.evaluator = evaluator
|
|
||||||
self._function_execution = function_execution
|
|
||||||
|
|
||||||
def _get_wrapped_context(self):
|
|
||||||
c, = self.evaluator.typing_module.py__getattribute__('Generator') \
|
|
||||||
.execute_annotation()
|
|
||||||
return c
|
|
||||||
|
|
||||||
def py__stop_iteration_returns(self):
|
|
||||||
return self._function_execution.get_return_values()
|
|
||||||
|
|
||||||
|
|
||||||
class OverloadedFunctionContext(FunctionMixin, ContextWrapper):
|
class OverloadedFunctionContext(FunctionMixin, ContextWrapper):
|
||||||
def __init__(self, function, overloaded_functions):
|
def __init__(self, function, overloaded_functions):
|
||||||
super(OverloadedFunctionContext, self).__init__(function)
|
super(OverloadedFunctionContext, self).__init__(function)
|
||||||
|
|||||||
Reference in New Issue
Block a user