AsyncGenAdapter

toloka.util.async_utils.AsyncGenAdapter | Source code

AsyncGenAdapter(self, gen: AsyncGenerator[TypeVar('YieldType'), TypeVar('SendType')])

Adapter class that enables alternative syntax for iteration over async generator.

This class is used for backwards compatibility. Please use "async for" syntax in new code.

Examples:

main syntax

async for value in AsyncGenAdapter(async_gen): ...

alternative syntax (please do not use in new code):

for value in await AsyncGenAdapter(async_gen): ...

Methods summary

MethodDescription
as_sync_genNone

Last updated: August 28, 2023

Toloka-Kit
OverviewGetting API keyQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming