(
iterator: Iterable[T],
)
| 49 | |
| 50 | |
| 51 | async 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 |
no outgoing calls