feed.api.generic.reduce module¶
reduce.py contains functions and classes for reducing multiple streams into a single stream.
-
class
feed.api.generic.reduce.
Aggregate
(func: Callable[[List[T]], T])[source]¶ Bases:
feed.core.base.Stream
A multi-stream operator for aggregating multiple streams into a single stream.
Parameters: func (Callable[[List[Stream]], T]) – A function for aggregating the value of multiple streams. -
forward
() → T[source]¶ Generates the next value from the underlying data streams.
Returns: The next value in the stream. Return type: T
-
generic_name
= 'reduce'¶
-
-
class
feed.api.generic.reduce.
Reduce
(dtype: str = None)[source]¶ Bases:
feed.core.base.Stream
A stream for reducing multiple streams of the same type.
Parameters: dtype (str, optional) – The data type of the aggregated stream. -
agg
(func: Callable[[List[T]], T]) → feed.core.base.Stream[~T][T][source]¶ Computes the aggregation of the input streams.
Returns: An aggregated stream of the input streams. Return type: Stream[T]
-
forward
() → List[T][source]¶ Generates the next value from the underlying data streams.
Returns: The next value in the stream. Return type: T
-
has_next
() → bool[source]¶ Checks if there is another value.
Returns: If there is another value or not. Return type: bool
-
max
() → feed.core.base.Stream[~T][T][source]¶ Computes the reduced maximum of the input streams.
Returns: A reduced maximum stream. Return type: Stream[T]
-
min
() → feed.core.base.Stream[~T][T][source]¶ Computes the reduced minimum of the input streams.
Returns: A reduced minimum stream. Return type: Stream[T]
-