BUG: Fix minor type hinting problems #598
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request type
Checklist
black rocketpy/ tests/
) has passed locallypytest tests -m slow --runslow
) have passed locallyCHANGELOG.md
has been updated (if relevant)Current behavior
Assume basic type checking is active in VSCode. If you try to assign a float to one of the following function parameters, you get a warning that float is not compatible with int:
The reason for the warning seems to be that the default values for those parameters is an integer, so the type checker assumes only ints are supported.
New behavior
No warning is given when a float is assigned to the listed parameters. Furthermore, no warning is given when assigning an int (just like before), because casting an int to a float does not warrant a warning for the type checker.
Breaking change
Additional information
When not using type hinting, the changes should not have any effect, as I have only added a ".0" to the end of the affected ints.
The docs/comments in the code even say that the mentioned parameters support float, but the type checker in VSCode didn't care 😅.
There are likely many more such cases; this PR only covers parameters that I came across so far (so I don't have to see those warnings in the project I work on). A proper solution would be to actually add type hints to everything in the repository.
I am aware of #444, where it was decided that type hinting will not be actively supported in this repository due to too much development overhead.