Skip to content

sgnts.sinks.null

NullSeriesSink dataclass

Bases: TSSink


              flowchart TD
              sgnts.sinks.null.NullSeriesSink[NullSeriesSink]
              sgnts.base.base.TSSink[TSSink]
              sgnts.base.base.TimeSeriesMixin[TimeSeriesMixin]

                              sgnts.base.base.TSSink --> sgnts.sinks.null.NullSeriesSink
                                sgnts.base.base.TimeSeriesMixin --> sgnts.base.base.TSSink
                



              click sgnts.sinks.null.NullSeriesSink href "" "sgnts.sinks.null.NullSeriesSink"
              click sgnts.base.base.TSSink href "" "sgnts.base.base.TSSink"
              click sgnts.base.base.TimeSeriesMixin href "" "sgnts.base.base.TimeSeriesMixin"
            

A series sink that does precisely nothing.

Parameters:

Name Type Description Default
verbose bool

bool, print frames as they pass through the internal pad

False
Notes

Thread safety: Marked thread_safe = True. Pad layout: N sink pads (no source pads). The N sink pads' pull callbacks CAN run concurrently in the same wave; internal runs alone.

``pull`` (inherited ``TimeSeriesMixin.pull``):
per-pad-keyed dict writes; safe across pads. ``process``
(called from ``internal``, runs alone): calls
``self.mark_eos(pad)`` per pad (writes the per-pad-keyed
``self._at_eos[pad]``) and optionally prints. ``print`` is
line-buffered and atomic per call.

**Future editors MUST preserve thread safety**: do not
add element-level state mutated from ``pull`` outside of
per-pad-keyed containers.
Source code in src/sgnts/sinks/null.py
@dataclass
class NullSeriesSink(TSSink):
    """A series sink that does precisely nothing.

    Args:
        verbose:
            bool, print frames as they pass through the internal pad

    Notes:
        Thread safety:
            Marked ``thread_safe = True``. Pad layout: N sink pads
            (no source pads). The N sink pads' ``pull`` callbacks CAN
            run concurrently in the same wave; ``internal`` runs alone.

            ``pull`` (inherited ``TimeSeriesMixin.pull``):
            per-pad-keyed dict writes; safe across pads. ``process``
            (called from ``internal``, runs alone): calls
            ``self.mark_eos(pad)`` per pad (writes the per-pad-keyed
            ``self._at_eos[pad]``) and optionally prints. ``print`` is
            line-buffered and atomic per call.

            **Future editors MUST preserve thread safety**: do not
            add element-level state mutated from ``pull`` outside of
            per-pad-keyed containers.

    """

    thread_safe = True

    verbose: bool = False

    def process(self, input_frames: dict[SinkPad, TSFrame]) -> None:
        """Print frames if verbose."""
        for sink_pad, frame in input_frames.items():
            if frame.EOS:
                self.mark_eos(sink_pad)
            if self.verbose:
                print(f"{sink_pad.name}:")
                print(f"  {frame}")
                print(f"  latency: {frame.latency()} s")

process(input_frames)

Print frames if verbose.

Source code in src/sgnts/sinks/null.py
def process(self, input_frames: dict[SinkPad, TSFrame]) -> None:
    """Print frames if verbose."""
    for sink_pad, frame in input_frames.items():
        if frame.EOS:
            self.mark_eos(sink_pad)
        if self.verbose:
            print(f"{sink_pad.name}:")
            print(f"  {frame}")
            print(f"  latency: {frame.latency()} s")