portage.util.futures.compat_coroutine module

exception portage.util.futures.compat_coroutine._CoroutineReturnValue(result)

Bases: Exception


Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class portage.util.futures.compat_coroutine._GeneratorTask(generator, result, loop)

Bases: object

Asynchronously executes the generator to completion, waiting for the result of each Future that it yields, and sending the result to the generator.

portage.util.futures.compat_coroutine._generator_future(generator_func, *args, **kwargs)

Call generator_func with the given arguments, and return a Future that is done when the resulting generation is exhausted. If a keyword argument named ‘loop’ is given, then it is used instead of the default event loop.


Return True if func is a decorated coroutine function created with the coroutine decorator for this module.


A decorator for a generator function that behaves as coroutine function. The generator should yield a Future instance in order to wait for it, and the result becomes the result of the current yield-expression, via the PEP 342 generator send() method.

The decorated function returns a Future which is done when the generator is exhausted. The generator can return a value via the coroutine_return function.


generator_func (function) – A generator function that yields Futures, and will receive the result of each Future as the result of the corresponding yield-expression.

Return type



A function which calls the given generator function and returns a Future that is done when the generator is exhausted.


Terminate the current coroutine and set the result of the associated Future.


result – of the current coroutine’s Future

:type object