We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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 does not warn missing attribute when inheriting BaseModel.
BaseModel
from pydantic import BaseModel class A: x: int class B(BaseModel): x: int A().y B(x=1).y
main.py:9: error: "A" has no attribute "y"
Can I check missing attribute for B().y?
B().y
The text was updated successfully, but these errors were encountered:
Thanks for the question.
I would guess this is because BaseModel implements __getattr__ so mypy can't easily work out whether B().y would raise an AttributeError.
__getattr__
AttributeError
Not really much we can do about this I'm afraid.
Sorry, something went wrong.
I see... Thanks for your reply!
changes to benchmarks (pydantic#95)
b39cad8
No branches or pull requests
mypy does not warn missing attribute when inheriting
BaseModel
.Can I check missing attribute for
B().y
?The text was updated successfully, but these errors were encountered: