Skip to content

anyio

Classes:

  • TaskFuture

    A result that will be completed in the future by a task group.

Functions:

TaskFuture

Bases: Generic[R]

A result that will be completed in the future by a task group.

Methods:

Attributes:

  • exception (BaseException | None) –

    Get the exception that caused the future to fail (if any).

  • value (R) –

    Get the result of a future.

exception property

exception: BaseException | None

Get the exception that caused the future to fail (if any).

value property

value: R

Get the result of a future.

set_exception

set_exception(exception: BaseException) -> None

Set the exception of the future.

set_value

set_value(value: R) -> None

Set the value of the future.

as_async_iterator

Create an asynchronous iterator from a synchronous iterator.

Parameters:

  • task_group

    (TaskGroup) –

    The task group to run the asynchronous tasks in.

  • sync_iter

    (Iterator[R]) –

    The synchronous iterator to convert.

  • max_buffer_size

    (int, default: 0 ) –

    The maximum buffer size for the memory object stream.

start_future

start_future(
    task_group: TaskGroup,
    func: Callable[P, Coroutine[Any, Any, R]],
    /,
    *args: args,
    **kwargs: kwargs,
) -> TaskFuture[R]

Start a future in a task group.

start_with_future

start_with_future(
    task_group: TaskGroup,
    future: TaskFuture[R],
    func: Callable[P, Coroutine[Any, Any, R]],
    /,
    *args: args,
    **kwargs: kwargs,
) -> None

Start the given future in a task group.