streams.Stream

class streams.Stream(src: Callable[[], Optional[contents]])

The Stream class representing a stream of data.

You can read from a stream like this:

from sensors import DistanceSensor
from streams import Stream

sensor = DistanceSensor(0)
stream : Stream[float] = sensor.stream()

while True:
    for value in stream:
        if value < 1:
            print("An object is close!")
next_event() Optional[contents]

Returns the next value in the stream. Returns None if the stream is empty when called.