MCPcopy
hub / github.com/encode/starlette / iterate_in_threadpool

Function iterate_in_threadpool

starlette/concurrency.py:51–59  ·  view source on GitHub ↗
(
    iterator: Iterable[T],
)

Source from the content-addressed store, hash-verified

49
50
51async def iterate_in_threadpool(
52 iterator: Iterable[T],
53) -> AsyncIterator[T]:
54 as_iterator = iter(iterator)
55 while True:
56 try:
57 yield await anyio.to_thread.run_sync(_next, as_iterator)
58 except _StopIteration:
59 break

Callers 2

__init__Method · 0.90

Calls

no outgoing calls

Tested by 1