Upload operator.py with huggingface_hub
Browse files56 unmodified lines57585960616263646566676869707172737475767778798081823 unmodified lines868788899091924 unmodified lines979899100101102103104105106338 unmodified lines44544644744844945045156 unmodified lines"""class StreamSource(StreamingOperator):"""A class representing a stream source operator in the streaming system.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`."""@abstractmethoddef __call__(self) -> MultiStream:passclass SourceOperator(StreamSource):"""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`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 linescaching: bool = NonPositionalField(default=None)def __call__(self) -> MultiStream:multi_stream = self.process()if self.caching is not None:multi_stream.set_caching(self.caching)4 unmodified linespassclass StreamInitializerOperator(StreamSource):"""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.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`that the other operators then process."""56 unmodified lines5758596061626364656667686970717273747576777879803 unmodified lines848586878889904 unmodified lines9596979899100101102103104338 unmodified lines44344444544644744844956 unmodified lines"""class SideEffectOperator(StreamingOperator):"""Base class for operators that does not affect the stream."""def __call__(self, streams: Optional[MultiStream] = None) -> MultiStream:self.process()return streams@abstractmethoddef process() -> None:passclass 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 `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 linescaching: bool = NonPositionalField(default=None)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 linespassclass StreamInitializerOperator(SourceOperator):"""A class representing a stream initializer operator in the streaming system.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 `SourceOperator`, which generates the initial `MultiStream`that the other operators then process."""
operator.py+12-14