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

Support descriptors in dataclass transform #15006

Merged
merged 10 commits into from
Apr 5, 2023

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Apr 4, 2023

Infer __init__ argument types from the signatures of descriptor __set__ methods, if present. We can't (easily) perform full type inference in a plugin, so we cheat and use a simplified implementation that should still cover most use cases. Here we assume that __set__ is not decorated or overloaded, in particular.

Fixes #14868.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2023

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JukkaL JukkaL merged commit 16bd311 into master Apr 5, 2023
@JukkaL JukkaL deleted the dataclass-transform-descriptors branch April 5, 2023 10:04
JukkaL added a commit that referenced this pull request Apr 5, 2023
Infer `__init__` argument types from the signatures of descriptor
`__set__` methods, if present. We can't (easily) perform full type
inference in a plugin, so we cheat and use a simplified implementation
that should still cover most use cases. Here we assume that `__set__` is
not decorated or overloaded, in particular.

Fixes #14868.
@JukkaL JukkaL mentioned this pull request Apr 5, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mypy has implemented pep-681 incorrectly and does not intepret descriptors correctly
3 participants