-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Added [prop-decorator] code for unsupported property decorators (#14461) #16571
Added [prop-decorator] code for unsupported property decorators (#14461) #16571
Conversation
for more information, see https://pre-commit.ci
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I wrote this a while ago but never submitted a review.
@@ -1241,6 +1241,10 @@ class A: | |||
@property # OK | |||
@dec | |||
def g(self) -> int: pass | |||
@dec # type: ignore[misc] | |||
def h(self) -> int: pass | |||
@dec # type: ignore[prop-decorator] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused ignores aren't caught here. You're missing @property
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doh!
….com/analog-cbarber/mypy into 14461-unsupported-property-decorator
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/series.py:798: error: Unused "type: ignore" comment, use narrower [prop-decorator] instead of [misc] code [unused-ignore]
|
Using a decorator before a @Property now results in the narrower
prop-decorator
code, which is a subcode ofmisc
for backward compatibility.I would have preferred to add a more general Unsupported error code and have this be a subcode of that, but this has to be a subcode of misc for backward compatibility.
Fixes #14461