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 reports "Too many positional arguments" for RootModel subclass #7463
Comments
Hi, Thanks for your question. You should be able to use See the docs on how we recommend using Let us know if you have any other questions! 😄 |
@sydney-runkle An additional question about this. Let's say I have a root model based on a
|
Hi @berzi, Thanks for following up - great question! The following works for me without any from typing import Dict
from pydantic import Field, RootModel
class MyModel(RootModel):
root: Dict[str, str] = Field(default_factory=dict)
m = MyModel() # no mypy problems |
Another follow up about the original example - we can do the following with no type errors: from typing import List
from pydantic import RootModel
ListRootModel = RootModel[List[str]]
ListRootModel(['qwe', 'asd']) |
@dmontagu, I know you've been working on some |
Initial Checks
Description
RootModel
to use list as a rootroot=
e.g.
ListRootModel(['qwe', 'asd'])
instead ofListRootModel(root=['qwe', 'asd'])
I understand, that that's a minor issue, but still it would be nice to have a bit cleaner code without compromising mypy analysis
Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: