EmpaEconversion / aiidalab-aurora

AiiDAlab app for the Aurora BIG-MAP Stakeholder initiative
https://aiidalab-aurora.readthedocs.io/en/latest/
Other
2 stars 5 forks source link

Reducing mypy bypasses #29

Open edan-bainglass opened 1 year ago

edan-bainglass commented 1 year ago

I recently added a mypy hook to our pre-commit script and conformed the codebase to it (#27). However, several errors had to be silenced, as their reasons required better understanding of the code. Such issues are documented below. I'll address them over time. Assistance welcomed :)

edan-bainglass commented 1 year ago

The CyclingParameter model assigns default Nones to the value and default_value parameters. mypy raises an issue, as these are of type DataT. Solving the issue by wrapping DataT with Optional breaks the code. This is because the build_parameter_widget function in technique_widget.py runs a type check on the value parameter and raises an error if it is not str. Not yet sure of the purpose of this check.

edan-bainglass commented 1 year ago

Several models in cycling.py receive an extra inheritance. What is this? mypy does not approve of adding this, though it is a supported feature apparently.

edan-bainglass commented 1 year ago

The Optional and extra issues have been addressed in #31.

edan-bainglass commented 1 year ago

The last mypy bypass relates to the use of global variables in query.py. Discarding the global variables will require some refactoring. Will need to think about how to best approach it. Soon...