Skip to content

mopipe.core.segments.seg

seg.py

Base segment class for all pipeline steps.

Segment Objects

class Segment(metaclass=SegmentMeta)

Base class for all pipeline steps.

__init__

def __init__(name: str, segment_id: t.Optional[str] = None) -> None

Initialize a Segment.

name

@property
def name() -> str

The name of the segment.

segment_id

@property
def segment_id() -> str

The id of the segment.

validate_input

@abstractmethod
def validate_input(**kwargs) -> bool

Validate the input.

validate_output

@abstractmethod
def validate_output(output: t.Any) -> bool

Validate the output.

process

@abstractmethod
def process(x: t.Any, **kwargs) -> t.Any

Process the inputs and return the output.

input_type

@property
@abstractmethod
def input_type() -> IOType

The type of the input.

output_type

@property
@abstractmethod
def output_type() -> IOType

The type of the output.

segment_type

@property
@abstractmethod
def segment_type() -> SegmentType

The type of the segment.

__call__

def __call__(**kwargs) -> t.Any

Process the inputs and return the output.