ezmsg.baseproc.util.asio#

Functions

run_coroutine_sync(coroutine, timeout=30)[source]#

Executes an asyncio coroutine synchronously, with enhanced error handling.

Parameters:
  • coroutine (Coroutine[Any, Any, TypeVar(T)]) – The asyncio coroutine to execute

  • timeout (float) – Maximum time in seconds to wait for coroutine completion (default: 30)

Return type:

TypeVar(T)

Returns:

The result of the coroutine execution

Raises:

Classes

class SyncToAsyncGeneratorWrapper(gen)[source]#

Bases: object

A wrapper for synchronous generators to be used in an async context.

__init__(gen)[source]#
async asend(value)[source]#
async aclose()[source]#

Exceptions

exception CoroutineExecutionError[source]#

Bases: Exception

Custom exception for coroutine execution failures

exception CoroutineExecutionError[source]#

Bases: Exception

Custom exception for coroutine execution failures

run_coroutine_sync(coroutine, timeout=30)[source]#

Executes an asyncio coroutine synchronously, with enhanced error handling.

Parameters:
  • coroutine (Coroutine[Any, Any, TypeVar(T)]) – The asyncio coroutine to execute

  • timeout (float) – Maximum time in seconds to wait for coroutine completion (default: 30)

Return type:

TypeVar(T)

Returns:

The result of the coroutine execution

Raises:
class SyncToAsyncGeneratorWrapper(gen)[source]#

Bases: object

A wrapper for synchronous generators to be used in an async context.

__init__(gen)[source]#
async asend(value)[source]#
async aclose()[source]#