aioplus.awaitify

aioplus.awaitify(func, /, *, executor=None)

Make func asynchronous.

Parameters:
  • func (Callable[P, R]) – Callable.

  • executor (ThreadPoolExecutor, optional) – Executor.

Returns:

Callable.

Return type:

Callable[P, Awaitable[R]]

Notes

  • If executor is None, then the default one is used (usually, a thread pool).

Examples

>>> aprint = awaitify(print)
>>> await aprint("4 -> 23")
4 -> 23