sgnts.decorators.transform
¶
Decorators for simplifying transform implementations.
many_to_one(method)
¶
Decorator for many-to-one transforms.
Transforms the simpler signature::
def process(
self, input_frames: dict[SinkPad, TSFrame], output_frame: TSCollectFrame
) -> None
Into the dict-based signature expected by TSTransform::
def process(
self, input_frames: dict[SinkPad, TSFrame],
output_frames: dict[SourcePad, TSCollectFrame]
) -> None
Usage::
from sgnts.decorators import transform
class MyTransform(TSTransform):
@transform.many_to_one
def process(
self, input_frames: dict[SinkPad, TSFrame], output_frame: TSCollectFrame
) -> None:
# Process multiple inputs to single output
pass
Source code in src/sgnts/decorators/transform.py
one_to_one(method)
¶
Decorator for simple one-to-one transforms.
Transforms the simpler signature::
def process(self, input_frame: TSFrame, output_frame: TSCollectFrame) -> None
Into the dict-based signature expected by TSTransform::
def process(self, input_frames: dict[SinkPad, TSFrame],
output_frames: dict[SourcePad, TSCollectFrame]) -> None
Usage::
from sgnts.decorators import transform
class MyTransform(TSTransform):
@transform.one_to_one
def process(
self, input_frame: TSFrame, output_frame: TSCollectFrame
) -> None:
for buf in input_frame:
output_frame.append(buf)