tethys.core.nodes.operators.python.operator_python_fn
¶
Module Contents¶
-
class
tethys.core.nodes.operators.python.operator_python_fn.
PythonFunctionOperator
(callable_obj: Callable)[source]¶ Bases:
tethys.core.nodes.operators.operator_base.OperatorBase
This operator just calls the python function. You can specify some reserved args in the function and args would be filled (like in the pytest fixtures).
- Example:
def f1(data_packet, stream): print(stream) def f2(data_packet, station, stream): print(station, stream) def f3(data_packet, stream, station, operator): print(station, stream, operator) def f4(): pass def f5(a, b, c): pass PythonFunctionOperator(f1) PythonFunctionOperator(f2) PythonFunctionOperator(f3) PythonFunctionOperator(f4) # raise TypeError PythonFunctionOperator(f5) # raise TypeError
- Parameters
callable_obj (Callable) – some callable object (function or instance with the __call__ magic method)
-
process
(self, data_packet: Any, stream: ZeroStream, **kwargs)[source]¶ Execute callable_obj with dynamic args.
- Parameters
data_packet – any data object
stream (StreamBase) – Any stream
- Returns
Result of the callable_obj execution
- Return type
Any