pysatl_tsp.core.handler
Module Contents
Classes
Abstract base class for time series processing handlers. |
|
A composite handler that connects two handlers in sequence. |
Data
API
- class pysatl_tsp.core.handler.Handler(source: pysatl_tsp.core.handler.Handler[Any, pysatl_tsp.core.handler.T] | None = None)[source]
Bases:
abc.ABC,typing.Generic[pysatl_tsp.core.handler.T,pysatl_tsp.core.handler.U]Abstract base class for time series processing handlers.
This class implements a Chain of Responsibility pattern for processing time series data. Each Handler can be connected to a source handler and process its output data. Handlers can be combined using the pipe operator (|) to create processing pipelines.
- Parameters:
source – The handler to use as a data source, defaults to None
Initialization
Initialize a handler with an optional source.
- Parameters:
source – The handler to use as a data source, defaults to None
- abstractmethod __iter__() collections.abc.Iterator[pysatl_tsp.core.handler.U][source]
Create an iterator over the output data produced by this handler.
Each subclass must implement this method to define how data is processed.
- Returns:
An iterator yielding processed data items
- __or__(other: pysatl_tsp.core.handler.Handler[pysatl_tsp.core.handler.U, pysatl_tsp.core.handler.V]) pysatl_tsp.core.handler.Pipeline[pysatl_tsp.core.handler.T, pysatl_tsp.core.handler.V][source]
Combine this handler with another handler using the pipe operator.
This allows for the creation of processing pipelines using syntax like: handler1 | handler2 | handler3
- Parameters:
other – The next handler in the pipeline
- Returns:
A Pipeline object connecting this handler to the other handler
- property source: pysatl_tsp.core.handler.Handler[Any, pysatl_tsp.core.handler.T] | None
Get the source handler that provides input data to this handler.
- Returns:
The source handler or None if this is a root handler
- class pysatl_tsp.core.handler.Pipeline(first: pysatl_tsp.core.handler.Handler[pysatl_tsp.core.handler.T, pysatl_tsp.core.handler.U], second: pysatl_tsp.core.handler.Handler[pysatl_tsp.core.handler.U, pysatl_tsp.core.handler.V])[source]
Bases:
pysatl_tsp.core.handler.Handler[pysatl_tsp.core.handler.T,pysatl_tsp.core.handler.V]A composite handler that connects two handlers in sequence.
The Pipeline takes output from the first handler and feeds it as input to the second handler. This class enables the creation of data processing chains, where each handler in the chain performs a specific transformation on the data.
- Parameters:
first – The first handler in the pipeline
second – The second handler in the pipeline
- Raises:
ValueError – If the second handler already has a source configured
Initialization
Initialize a pipeline with two handlers.
- Parameters:
first – The first handler in the pipeline
second – The second handler in the pipeline
- Raises:
ValueError – If the second handler already has a source configured
- pysatl_tsp.core.handler.T = 'TypeVar(...)'
- pysatl_tsp.core.handler.U = 'TypeVar(...)'
- pysatl_tsp.core.handler.V = 'TypeVar(...)'
- pysatl_tsp.core.handler.__all__ = ['Handler', 'T', 'U', 'V']