Conversation
|
Another syntax could be: class MyElement(StreamElement):
"""Using constructor, '*' tells python; 'everything after this MUST be a keyword arg'
"""
def __init__(self, parameters, predecessors, pipeline_state_machine, *, foo: int, bar: str="bailey"):
# foo is a required parameter
self.foo: int = foo
# bar is a default parameter
self.bar: int = bar
# Type information for inputs
self.expected_inputs = Stream.Inputs(x: str, y: np.ndarray)
# Type information for outputs
self.expected_outputs = Stream.Outputs(z: float)
super().__init__(MyElement, parameters, predecessors, pipeline_state_machine) |
|
Thinking more I do prefer the override
Cons:
|
|
See elements/simple.py for the most up-to-date thinking Notes:
|
|
We could revise the syntax and use python |
swagcan now be used entirely in the backend. ie: not seen by the user when implementingstream_*_handlersparametersare created at run timecliexpected_parameters,expected_inputsandexpected_outputstuple for help with readabilityexpected_parameters(see example) below: