data_provider
Abstract data provider interface.
- class pysatl_cpd.data.providers.data_provider.DataProvider[source]
Bases:
ABC,Generic[DataT,AnnotationT]Abstract source class for sequential data providers.
- abstract property annotation: AnnotationT
Annotation of the data provider.
- Returns:
Annotation instance for this provider.
- Return type:
- abstractmethod __len__()[source]
Return the number of data items in the provider.
- Returns:
Number of data items.
- Return type:
- abstractmethod cut(start, stop, *, annotation=None)[source]
Cut a slice of data from the provider.
- Parameters:
start (
int) – Start index of the slice.stop (
int) – Stop index of the slice (inclusive).annotation (
Optional[TypeVar(AnnotationT, bound=TimeseriesAnnotation, covariant=True)]) – Optional annotation for the sliced data.
- Returns:
New provider containing the sliced data.
- Return type:
DataProvider[TypeVar(DataT),TypeVar(AnnotationT, bound=TimeseriesAnnotation, covariant=True)]
- default_slice_annotation(start, stop)[source]
Default annotation for sliced data.
- Parameters:
- Returns:
Default annotation for the sliced data.
- Return type:
TypeVar(AnnotationT, bound=TimeseriesAnnotation, covariant=True)
- abstractmethod classmethod merge(providers, annotation_builder=None)[source]
Merge multiple providers into one.
- Parameters:
providers (
Sequence[Self]) – Sequence of providers to merge.annotation_builder (
Callable[[Sequence[TypeVar(AnnotationT, bound=TimeseriesAnnotation, covariant=True)]],TypeVar(AnnotationT, bound=TimeseriesAnnotation, covariant=True)] |None) – Optional callable to build merged annotation.
- Returns:
New provider containing merged data.
- Return type:
DataProvider[TypeVar(DataT),TypeVar(AnnotationT, bound=TimeseriesAnnotation, covariant=True)]
- static default_merge_annotation_builder(source=None)[source]
Build a default annotation builder for merged providers.
- Parameters:
source (
str|None) – Optional source string for the merged annotation.- Returns:
Callable that builds annotation from a sequence.
- Return type:
Callable[[Sequence[TypeVar(AnnotationT, bound=TimeseriesAnnotation, covariant=True)]],TypeVar(AnnotationT, bound=TimeseriesAnnotation, covariant=True)]
- __or__(other)[source]
Merge two providers using the | operator.
- Parameters:
other (
Self) – Other provider to merge with.- Returns:
New provider containing merged data.
- Return type:
DataProvider[TypeVar(DataT),TypeVar(AnnotationT, bound=TimeseriesAnnotation, covariant=True)]- Raises:
TypeError – If the other provider is not the same concrete type.