DataLab
DataLab copied to clipboard
Typing issues
This issue will help to track typing issues in Datalab as well as proposals.
Typing errors
- [ ]
SignalObj.get_data()returns atuple[np.ndarray, np.ndarray]and not a singlenp.ndarray. The signature of the BaseObj.get_data could be modify to allow type changes for child classes - [ ] Many
paramclassarguments/attributes are annotated withMyClassinstead oftype[MyClass]. eg: inObjectProp.__init__()orBaseProcessor.init_param(). - [ ] missing types in
fitdialogs.py. - [ ]
cdl.core.model.signal.new_signal_param()argumentstypetakes a string or None but is compatible with SignalTypes members. - [ ]
BaseProcessor.compute_10my return a typing error if parent function is typed to only return a dict ofResultPropertiesorResultShapeinstead of a union of both. Could be fixed by using a Generic bound to both result types. Therefore, the return type ofBaseProcessor.compute_10would be definded by the return type of the function passed into it. - [ ]
BaseDataPanel.save_to_files()does not have the right typing argumentfilenamesis hinted as str but type not supported inside the method.
Proposals
- [ ] Use generics in base classes that are derived into signal and image classes. eg: in
BaseActionHandler, thepanelattribute should be a generic that is set toSignalProcessorinSignalActionHandlerand vice versa inImageActionHandler. The same principle could be applied in theBaseProcessorand other.