betty.asyncio module

Provide asynchronous programming utilities.

async betty.asyncio.gather(*coroutines: Coroutine[Any, None, betty.asyncio._T]) tuple[betty.asyncio._T, ...][source]

Gather multiple coroutines.

This is like Python’s own asyncio.gather, but with improved error handling.

Parameters:

coroutines (typing.Coroutine[typing.Any, None, typing.TypeVar(_T)])

Return type:

tuple[typing.TypeVar(_T), ...]

betty.asyncio.wait_to_thread(f: Awaitable[betty.asyncio._T]) betty.asyncio._T[source]

Wait for an awaitable in another thread.

Parameters:

f (typing.Awaitable[typing.TypeVar(_T)])

Return type:

typing.TypeVar(_T)