-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 error "Unexpected keyword argument" on pydantic dataclass InitVar field #5161
Comments
whoops, pasted the wrong link, thanks |
@brianmedigate what is your mypy config? In particular, are you using the pydantic mypy plugin? |
yes [mypy]
follow_imports = silent
ignore_missing_imports = True
warn_unused_ignores = True
check_untyped_defs = True
disallow_untyped_defs = True
strict_equality = True
warn_redundant_casts = True
python_version = 3.8
platform = linux
plugins = pydantic.mypy
[pydantic-mypy]
init_forbid_extra = True
init_typed = True
warn_required_dynamic_aliases = True
warn_untyped_fields = True |
Okay, considering you are using the mypy plugin I think it should be readily within our power to fix this (and is probably our fault, to be honest 😅). I will try to take a look at this today or tomorrow. |
great, thank you! |
Possible fix: #5162 In fact, doing it twice results in the |
thank you @cdce8p @dmontagu and @samuelcolvin, you're awesome! 🥇 |
Initial Checks
Description
Since upgrading to pydantic 1.10.6, mypy started complaining about a kwarg being passed to the constructor of a dataclass if the field is an
InitVar
.I'm guessing it might be related to #5111
Example Code
Python, Pydantic & OS Version
Affected Components
.dict()
and.json()
construct()
, pickling, private attributes, ORM modeThe text was updated successfully, but these errors were encountered: