-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dynamic propery assignment #4
base: master
Are you sure you want to change the base?
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 |
swag
can now be used entirely in the backend. ie: not seen by the user when implementingstream_*_handlers
parameters
are created at run timecli
expected_parameters
,expected_inputs
andexpected_outputs
tuple for help with readabilityexpected_parameters
(see example) below: