DataLab icon indicating copy to clipboard operation
DataLab copied to clipboard

Typing issues

Open vld-codra opened this issue 1 year ago • 0 comments

This issue will help to track typing issues in Datalab as well as proposals.

Typing errors

  • [ ] SignalObj.get_data() returns a tuple[np.ndarray, np.ndarray] and not a single np.ndarray. The signature of the BaseObj.get_data could be modify to allow type changes for child classes
  • [ ] Many paramclass arguments/attributes are annotated with MyClass instead of type[MyClass]. eg: in ObjectProp.__init__() or BaseProcessor.init_param().
  • [ ] missing types in fitdialogs.py.
  • [ ] cdl.core.model.signal.new_signal_param() argument stype takes a string or None but is compatible with SignalTypes members.
  • [ ] BaseProcessor.compute_10 my return a typing error if parent function is typed to only return a dict of ResultProperties or ResultShape instead of a union of both. Could be fixed by using a Generic bound to both result types. Therefore, the return type of BaseProcessor.compute_10 would be definded by the return type of the function passed into it.
  • [ ] BaseDataPanel.save_to_files() does not have the right typing argument filenames is 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, the panel attribute should be a generic that is set to SignalProcessor in SignalActionHandler and vice versa in ImageActionHandler. The same principle could be applied in the BaseProcessor and other.

vld-codra avatar Apr 24 '24 08:04 vld-codra