-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
(🎁) Validate arguments to dataclasses
utility functions replace
and fields
#14215
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
Comments
Hello! I'm working with a team of CMU students and we're looking to contribute to this issue for a class project. I was wondering if anyone could give us some pointers on where to get started on this issue? |
I haven't touched the mypy code in a while but there's a dataclass plugin in the source which would be the first place I would look. Barely knowing anything my instinct is either to make dataclass generated classes inherit from some pretend class if there isn't already some marker (there probably is lol), and then... I don't know, patch mypy's typeshed? Maybe override replace calls? I'd look at the plugin API to see if that's even possible. But please take everything I said with a grain of salt! Better researched response: There's plugins in mypy's source, see |
Looks like there's a lot of interest in fixing this! We've already had two PRs filed over at mypy and one over at typeshed, so I think we probably don't need any more PRs for this one -- let's concentrate on reviewing what we've already got 😀 |
Fixed in python/typeshed#9362 |
Mypy should special case these functions to only work with dataclasses.
playground
PS: PyCharm correctly reports these
The text was updated successfully, but these errors were encountered: