yera.events.stream
Event stream implementation for inter-process app communication.
Symbols
await_input
await_input(
timeout: float | None = None,
) → InputEventBlock until an input event is available and return it.
EventStream
Inter-process event stream backed by multiprocessing queues.
Methods
EventStream.push_output
push_output(
event: OutputEvent,
) → NonePut an output event onto the queue.
EventStream.push_input
push_input(
in_event: InputEvent,
) → NonePut an input event onto the queue.
EventStream.pop_output
pop_output(
timeout: float | None = None,
) → OutputEventRemove and return the next output event, blocking up to timeout.
EventStream.pop_input
pop_input(
timeout: float | None = None,
) → InputEventRemove and return the next input event, blocking up to timeout.
EventStream.has_output
has_output() → boolReturn True if there are output events queued.
EventStream.has_input
has_input() → boolReturn True if there are input events queued.
EventStream.iter_output
iter_output(
timeout: float | None = None,
) → Iterator[OutputEvent]Yield all currently queued output events without blocking.
EventStream.iter_output_blocking
iter_output_blocking(
timeout: float = 0.5,
) → Iterator[OutputEvent]Yield output events using blocking get(timeout). Reliable across processes.
Do not use iter_output() when the producer is in another process: Queue.empty() is unreliable across processes and the consumer may never see the event. This method blocks on get(timeout=...) so the exit event is received reliably.
EventStream.set_current
set_current() → NoneBind this stream to the current context variable.
EventStream.get_current
get_current() → EventStreamReturn the stream bound to the current context, raising if none is set.
EventStream.build
build() → EventStreamReturn the current stream if one exists, otherwise create and register a new one.
failure_exit_event_already_pushed
failure_exit_event_already_pushed() → boolReturn True if a nested app already pushed a failure exit event.
is_restricted_stream
is_restricted_stream() → boolReturn whether the current event stream is restricted (only certain block types allowed).
push_input
push_input(
in_event: InputEvent,
) → NonePush an input event to the current stream.
push_output
push_output(
event: OutputEvent,
) → NonePush an output event to the current stream.
push_text_input
push_text_input(
text: str,
) → NonePush a plain-text input event to the current stream.