Consider to statically type functions and methods and use mypy to check types
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 365
- Avg merge
- 4h 6m
- Merged PRs (30d)
- 1
Description
### Checklist
- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D-ML/issues).
- [X] I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).
### Proposed new feature or change
Many functions in the code do not contain enough information about what kind of input and output is expected. This makes it's harder to use the methods as well as maintain the code.
For example, the run_inference method [here](https://github.com/isl-org/Open3D-ML/blob/master/ml3d/torch/pipelines/semantic_segmentation.py#L122) has an argument `data` and return a dictionary with keys `predict_labels` and `predict_scores`. It is not obvious what is `data` from reading the docstring nor from reading the function signature. It is even more implicit that the output has a specific form.
Some other methods, like [here](https://github.com/isl-org/Open3D-ML/blob/21951adc23831ee0597c4f49b47deb8f122fda07/ml3d/datasets/semantickitti.py#L175), assume the dictionary has the key `predict_labels` without explicitly stating it.
### References
https://realpython.com/python-type-checking/
https://docs.python.org/3/library/typing.html
http://mypy-lang.org/
### Additional information
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.