Module spin_sdk.util
+Module for general-purpose utility functions
+Functions
+-
+
+async def collect(tuple: Tuple[componentize_py_async_support.streams.StreamReader[~T], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[~E]]]) ‑> List[~T] +
+-
+++
+Expand source code +
+
+async def collect(tuple: Tuple[StreamReader[T], FutureReader[Result[None, E]]]) -> List[T]: + """ + Collect all items from the StreamReader portion of the provided Tuple and return them in a List, + verifying the FutureReader result upon stream completion and, if it is error, raising it as an exception. + """ + stream = tuple[0] + future = tuple[1] + collected = [] + with stream, future: + while not stream.writer_dropped: + collected += await stream.read(128) + result = await future.read() + if isinstance(result, Err): + raise result + else: + return collected+Collect all items from the StreamReader portion of the provided Tuple and return them in a List, +verifying the FutureReader result upon stream completion and, if it is error, raising it as an exception.
+