refactor: remove unused generics_in_ptype/model, put TypedGraphRef.inputs_type before outputs_type#391
refactor: remove unused generics_in_ptype/model, put TypedGraphRef.inputs_type before outputs_type#391
Conversation
| body: GraphBuilder[A, B] | TypedGraphRef, | ||
| eval_inputs: Any, | ||
| ) -> Any: | ||
| ) -> B: |
There was a problem hiding this comment.
possibly changing the type of parameter eval_inputs and the return type, both from Any, to A/B might have some impact???
There was a problem hiding this comment.
Yes but I think it is a correct change though (and the lint passes) so I'm in favour of doing this.
There was a problem hiding this comment.
Seems like a very positive change
mwpb
left a comment
There was a problem hiding this comment.
This looks like a good tidy up, thank you.
| g = GraphBuilder(TKR[int], TKR[int]) | ||
| graph = g.task(doubler_plus_graph()) | ||
| graph_ref = TypedGraphRef(graph.value_ref(), TKR[int], TKR[int]) | ||
| graph_ref = TypedGraphRef(graph.value_ref(), TKR[int]) |
There was a problem hiding this comment.
pyright gives me a graph_ref is partially unknown warning here. However we have been overlooking these in other cases so I guess that is okay.
There was a problem hiding this comment.
Restored inputs_type and put in correct order (before outputs) ;-)...we can try and solve in #381 by defining type TypedGraphRef[Inputs, Outputs] = TKR[FinishedGraph[Inputs, Outputs]]
| body: GraphBuilder[A, B] | TypedGraphRef, | ||
| eval_inputs: Any, | ||
| ) -> Any: | ||
| ) -> B: |
There was a problem hiding this comment.
Yes but I think it is a correct change though (and the lint passes) so I'm in favour of doing this.
This reverts commit 7024832.
Also remove some overloads that seem pointless (??), and tidy some imports
Removing generics_in_ptype as a preliminary to #381 because it's hard to handle parametrized FinishedGraph.
TypedGraphRef[Inputs, Outputs]was constructed viaTypedGraphRef(outputs_type, inputs_type), so reorder the latter. (Although theinputs_typefield is unused it helpspyrightfigure out theInputstype parameter when in strict mode or withreportUnknownVariableTypeso keep it for now.)