koladata

Home
Overview
Fundamentals
Glossary
Cheatsheet
API Reference
Quick Recipes
Deep Dive
Common Pitfalls and Gotchas
Persistent Storage

View the Project on GitHub google/koladata

kd.types.Stream API

Stream of values.

The stream keeps all values in memory and can be read more than once.

Note: This class supports parametrization like Stream[T]; however,
the type parameter is currently used only for documentation purposes.
This might be changed in the future.

Stream.make_reader()

Returns a new reader for the stream.

Stream.new(value_qtype, /)

Returns a new `tuple[Stream, StreamWriter]`.

Stream.read_all(*, timeout)

Waits until the stream is closed and returns all its items.

If `timeout` is not `None` and the stream is not closed within
the given time, the method raises a `TimeoutError`.

Args:
  timeout: A timeout in seconds; None means wait indefinitely.

Returns:
  A list containing the stream items.

Stream.yield_all(*, timeout)

Returns an iterator for the stream items.

If `timeout` is not `None` and the stream doesn't close within
the given time, the method raises a `TimeoutError`.

Args:
  timeout: A timeout in seconds. `None` means wait indefinitely.