Pipeline
Define a minimal base class for composable pipeline components.
This module provides a lightweight base class that enables pipeline-style composition through the bitwise OR operator. It is intended for workflows where objects can be chained together and invoked in a uniform way, allowing each component to pass data or itself to the next stage in the pipeline.
PipelineBaseClass
Provide a minimal interface for pipeline composition and invocation.
This base class defines operator overloads that support chaining pipeline
components with the | operator, as well as a default callable behavior
that returns the input unchanged. Subclasses can override __call__ to
implement custom pipeline logic while preserving the composition interface.
Source code in aatm\pipeline.py
__or__(other)
Apply the right-hand pipeline component to this instance.
This method enables left-to-right pipeline composition using the
| operator. The right-hand operand is expected to be callable and
able to accept this instance as input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Any
|
A callable pipeline component or compatible object to be applied to this instance. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The result of calling |
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
Source code in aatm\pipeline.py
__ror__(other)
Apply this pipeline component to the left-hand operand.
This method enables right-hand dispatch for the | operator when
this object appears on the right side of a pipeline expression. The
left-hand operand is passed as input to this instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Any
|
The input value or upstream pipeline component to be passed to this instance. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The result of calling this instance with |
Raises:
| Type | Description |
|---|---|
TypeError
|
If this instance is not callable with the provided input. |
Source code in aatm\pipeline.py
__call__(input, *args, **kwargs)
Return the input unchanged.
This default implementation acts as an identity operation, making the base class usable even before subclasses define custom behavior.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
Any
|
The value to pass through the pipeline unchanged. |
required |
*args
|
Any
|
Additional positional arguments accepted for interface compatibility. |
()
|
**kwargs
|
Any
|
Additional keyword arguments accepted for interface compatibility. |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
The original input value, unchanged. |