-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Consolidate descriptor handling in checkmember.py #18831
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
Conversation
This comment has been minimized.
This comment has been minimized.
Hm, couple new errors in I will try this later today, just to check the possible fallout. |
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: kornia (https://github.com/kornia/kornia)
- kornia/augmentation/container/augment.py:449: error: Unsupported right operand type for in ("list[DataKey] | None") [operator]
- kornia/augmentation/container/augment.py:450: error: Item "None" of "list[DataKey] | None" has no attribute "index" [union-attr]
+ kornia/augmentation/container/augment.py:321: error: Unused "type: ignore" comment [unused-ignore]
+ kornia/augmentation/container/augment.py:323: error: Unused "type: ignore" comment [unused-ignore]
+ kornia/augmentation/container/augment.py:443: error: Unused "type: ignore" comment [unused-ignore]
+ kornia/augmentation/container/augment.py:445: error: Unused "type: ignore" comment [unused-ignore]
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/state.py:2427: error: Argument "targetid" to "AddReactionRequest" has incompatible type "int | _ReadOnlyProto[int]"; expected "int" [arg-type]
+ steam/state.py:2440: error: Argument "targetid" to "GetReactionsRequest" has incompatible type "int | _ReadOnlyProto[int]"; expected "int" [arg-type]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/wrapping/__init__.py:301: error: Unused "type: ignore" comment [unused-ignore]
|
OK, this question reminded me a discussion we had a while ago about what to do for variables annotated with I am happy with the primer, so I will be merging this today/tomorrow unless there are objections. |
This is not a pure refactoring, but almost. Right now we are in a weird situation where we have two inconsistencies: * `__set__()` is handled in `checker.py` while `__get__()` is handled in `checkmember.py` * rules for when to use binder are slightly different between descriptors and settable properties. This PR fixes these two things. As a nice bonus we should get free support for unions in `__set__()`.
This is not a pure refactoring, but almost. Right now we are in a weird situation where we have two inconsistencies:
__set__()
is handled inchecker.py
while__get__()
is handled incheckmember.py
This PR fixes these two things. As a nice bonus we should get free support for unions in
__set__()
.