flowno.utilities.asyncgen_wrapper

Async generator wrapper for Flowno’s asynchronous execution logging.

This module provides a wrapper for Python async generators that adds detailed logging for debugging purposes. The wrapper logs async generator execution events including creation, resumption, yielding, and completion.

For examples and more detailed information, see the flowno.utilities.logging module and its log_async decorator which uses this wrapper.

class flowno.utilities.asyncgen_wrapper.AsyncGeneratorWrapper(agen: AsyncGenerator[Yield, Send], func_name: str, arg_str: str)[source]

Wrapper class for async generators to add detailed debugging logs. It implements the AsyncGenerator interface and forwards calls to the underlying async generator, adding logging statements to ‘__anext__’ and ‘athrow’ methods.

async aclose() None[source]

Raise GeneratorExit inside coroutine.

async asend(value: Send) Yield[source]

Send a value into the asynchronous generator. Return next yielded value or raise StopAsyncIteration.

async athrow(typ: type[BaseException], val: BaseException | object = None, tb: TracebackType | None = None, /) Yield[source]
async athrow(typ: BaseException, val: None = None, tb: TracebackType | None = None, /) Yield

Raise an exception in the asynchronous generator. Return next yielded value or raise StopAsyncIteration.