Upload operator.py with huggingface_hub
Browse files56 unmodified lines575859606160616263646566676364656667706869707174727374757679777879803 unmodified lines84858689878889904 unmodified lines9596971009899100103101102103104338 unmodified lines44344444544844644744844956 unmodified lines """
class StreamSource(StreamingOperator): """A class representing a stream source operator in the streaming system.class SideEffectOperator(StreamingOperator): """Base class for operators that does not affect the stream."""
A stream source operator is a special type of `StreamingOperator` that generates a data stream without taking any input streams. It serves as the starting point in a stream processing pipeline, providing the initial data that other operators in the pipeline can process.
When called, a `StreamSource` should generate a `MultiStream`. This behavior must be implemented by any classes that inherit from `StreamSource`.
""" def __call__(self, streams: Optional[MultiStream] = None) -> MultiStream: self.process() return streams
@abstractmethod def __call__(self) -> MultiStream: def process() -> None: pass
class SourceOperator(StreamSource):class SourceOperator(StreamingOperator): """A class representing a source operator in the streaming system.
A source operator is responsible for generating the data stream from some source, such as a database or a file. This is the starting point of a stream processing pipeline. The `SourceOperator` class is a type of `StreamSource`, which is a special type of `StreamingOperator` The `SourceOperator` class is a type of `SourceOperator`, which is a special type of `StreamingOperator` that generates an output stream but does not take any input streams.
When called, a `SourceOperator` invokes its `process` method, which should be implemented by all subclasses3 unmodified lines
caching: bool = NonPositionalField(default=None)
def __call__(self) -> MultiStream: def __call__(self, multi_stream: Optional[MultiStream] = None) -> MultiStream: multi_stream = self.process() if self.caching is not None: multi_stream.set_caching(self.caching)4 unmodified lines pass
class StreamInitializerOperator(StreamSource):class StreamInitializerOperator(SourceOperator): """A class representing a stream initializer operator in the streaming system.
A stream initializer operator is a special type of `StreamSource` that is capable of taking parameters during the stream generation process. This can be useful in situations where the stream generation process needs to be customized or configured based on certain parameters. A stream initializer operator is a special type of `SourceOperator` that is capable of taking parameters during the stream generation process. This can be useful in situations where the stream generation process needs to be customized or configured based on certain parameters.
When called, a `StreamInitializerOperator` invokes its `process` method, passing any supplied arguments and keyword arguments. The `process` method should be implemented by all subclasses to generate the required `MultiStream` based on the given arguments and keyword arguments.
338 unmodified lines """A class representing a source sequential operator in the streaming system.
A source sequential operator is a type of `SequentialOperator` that starts with a source operator. The first operator in its list of steps is a `StreamSource`, which generates the initial `MultiStream` The first operator in its list of steps is a `SourceOperator`, which generates the initial `MultiStream` that the other operators then process. """
operator.py+12-14