One run of a stream, read item by item. aclose() stops it.
Functions#
__init__#
__init__(chunks, context) -> None| Parameter | Type | Description |
|---|---|---|
chunks | StreamChannel[A_co, Any, Any] | |
context | Context |
def __init__(self, chunks: StreamChannel[A_co, Any, Any], context: Context) -> None:
self._channel = chunks
self._context = context
self._scope = CloseableScope()
self._pull: Effect[tuple[A_co, ...], Any, Any] | None = None
self._chunk: Iterator[A_co] | None = None
self._fiber: Fiber[tuple[A_co, ...], Any] | None = None
self._closing: asyncio.Task[None] | None = Noneaclose#
aclose() -> NoneInterrupt a pull in flight and close the run's scope. Closing
again does nothing; __anext__ then ends at once.
async def aclose(self) -> None:
"""Interrupt a pull in flight and close the run's scope. Closing
again does nothing; ``__anext__`` then ends at once."""
await self._close(_DONE)athrow#
athrow(error) -> NoReturnClose the run's scope with error as a defect, then raise
error.
| Parameter | Type | Description |
|---|---|---|
error | BaseException |
Returns NoReturn
async def athrow(self, error: BaseException) -> NoReturn:
"""Close the run's scope with ``error`` as a defect, then raise
``error``."""
await self._close_reporting(die(error))
raise error