Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reducing mypy bypasses #29

Open
edan-bainglass opened this issue May 5, 2023 · 4 comments
Open

Reducing mypy bypasses #29

edan-bainglass opened this issue May 5, 2023 · 4 comments
Assignees
Labels
help wanted Extra attention is needed housekeeping General cleanup/refactoring

Comments

@edan-bainglass
Copy link
Collaborator

edan-bainglass commented May 5, 2023

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 edan-bainglass added help wanted Extra attention is needed housekeeping General cleanup/refactoring labels May 5, 2023
@edan-bainglass
Copy link
Collaborator Author

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 edan-bainglass self-assigned this May 5, 2023
@edan-bainglass
Copy link
Collaborator Author

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 added a commit that referenced this issue May 8, 2023
Added mypy hook to pre-commit script and conformed codebase.

Note: some errors temporarily silenced. See issue #29.
@edan-bainglass
Copy link
Collaborator Author

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

@edan-bainglass
Copy link
Collaborator Author

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed housekeeping General cleanup/refactoring
Projects
None yet
Development

No branches or pull requests

1 participant