Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
mypy plugin support for dataclasses #966
mypy plugin support for dataclasses #966
Changes from 11 commits
fb109d0
1898087
192187a
19d49ec
92eada1
7e97368
4652387
9576bd0
35302bd
5068657
05ca1ca
d036cf0
e39b8f9
ff1f630
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Should this use a TypeVar?
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.
Did you expect this?
Also, Did you want to replace other
-> 'DataclassType'
like__init__
?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.
Yeah, that's what I meant, I think it would be better (assuming that is the right signature, which I think it is?).
I don't think the
__init__
signature needs to change, but maybe the_validate_dataclass
one should.(Any other places where
'DataclassType'
is currently used probably should; I believe this is what is done for factory classmethods forBaseModel
-- I don't see why it shouldn't be that way for the dataclasses.)Also, I would recommend using something like
DataclassT
as the name of theTypeVar
, to make it slightly more obvious what's happening, and give itbound=DataclassType
. (The TypeVar forBaseModel
inpydantic.main
is calledModel
; I think that's nice.)