portage.util.futures._sync_decorator module

class portage.util.futures._sync_decorator._ObjectAttrWrapper(obj, attr_wrapper)

Bases: portage.proxy.objectproxy.ObjectProxy

portage.util.futures._sync_decorator._sync_decorator(func, loop=None)

Decorate an asynchronous function (either a corouting function or a function that returns a Future) with a wrapper that runs the function synchronously.

portage.util.futures._sync_decorator._sync_methods(obj, loop=None)

For use with synchronous code that needs to interact with an object that has coroutine methods, this function generates a proxy which conveniently converts coroutine methods into synchronous methods. This allows coroutines to smoothly blend with synchronous code, eliminating clutter that might otherwise discourage the proliferation of coroutine usage for I/O bound tasks.