Wait
wait
Waiter
Bases: Event
wait wrapper
Examples:
Source code in src/async_wrapper/wait.py
Completed
Completed(task_group: TaskGroup | None = None)
like asyncio.as_completed
Examples:
Source code in src/async_wrapper/wait.py
start_soon
start_soon(
task_group: TaskGroup | None,
func: Callable[..., Awaitable[Any]],
*args: Any,
name: Any = None
) -> None
Start a coroutine in a task group,
similar to anyio.abc.TaskGroup.start_soon.
If a task group is already provided, the task_group parameter should be the same object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
TaskGroup | None
|
An |
required |
|
Callable[..., Awaitable[Any]]
|
The target coroutine function. |
required |
|
Any
|
The arguments to pass to the coroutine function. |
()
|
|
Any
|
The name used in |
None
|
Source code in src/async_wrapper/wait.py
wait_for
async
wait_for(
event: Event | Iterable[Event],
func: Callable[_P, Awaitable[_T]],
*args: args,
**kwargs: kwargs
) -> _T
Wait for an event before executing an awaitable function.
like asyncio.wait_for
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Event | Iterable[Event]
|
An |
required |
|
Callable[_P, Awaitable[_T]]
|
An awaitable function to be executed. |
required |
|
args
|
The arguments to pass to the awaitable function. |
()
|
|
kwargs
|
The keyword arguments to pass to the awaitable function. |
{}
|
Returns:
| Type | Description |
|---|---|
_T
|
The result of the executed function. |
Examples: