You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem:
Almost all of the settable properties (such as Body.mass) are dynamically defined, so mypy doesn't recognize them. The properties get inferred to be of type Any (from the mixin), which is undesirable.
Suggestion:
Rewrite most of the writable properties in normal syntax, putting their docstring in the getter function. Static type checkers can then correctly see their type.
I can make the PR.
Exception:
Some properties are of Vec2d and so their setter accepts tuples, a different type than the getter. It has been pointed out before that type checkers don't recognize this.
So, these properties will be left alone.
Note: Mypy 1.16 adds support for getters and setters with different types. See the release notes.
The text was updated successfully, but these errors were encountered:
Ah, I think there was some reason why I used the property function.. but now I dont remember. And regardless, seems like it all works as it should using the decorator nowadays so I think it would be a good improvement.
If you make a PR, great! The best is if you can do it against the pymunk7 branch ( https://github.com/viblo/pymunk/tree/pymunk7 ), since Im trying to finalize 7.0 there. Less risk of merge issues that way.
I saw they fixed it in mypy, nice! 🎉🎉 I even posted in the issue for it 5 years ago 😄 I wonder how quickly they will release. It would be nice if fixing Vec2d could happen at the same time (I mean with Pymunk 7.0), but who knows, might take a long time.. Anyway, if you do a PR for the rest I can also see when everything is set for 7.0 if this last bit can be done as well.
Problem:
Almost all of the settable properties (such as
Body.mass
) are dynamically defined, so mypy doesn't recognize them. The properties get inferred to be of typeAny
(from the mixin), which is undesirable.Suggestion:
Rewrite most of the writable properties in normal syntax, putting their docstring in the getter function. Static type checkers can then correctly see their type.
I can make the PR.
Exception:
Some properties are of
Vec2d
and so their setter accepts tuples, a different type than the getter. It has been pointed out before that type checkers don't recognize this.So, these properties will be left alone.
Note: Mypy 1.16 adds support for getters and setters with different types. See the release notes.
The text was updated successfully, but these errors were encountered: