Skip to content
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

fix mypy with default_factory=list etc. #4471

Merged
merged 3 commits into from Sep 5, 2022
Merged

Conversation

samuelcolvin
Copy link
Member

Change Summary

Fix mypy plugin when using bare types like list and dict as default_factory.

Related issue number

fix #4457

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • changes/<pull request or issue id>-<github username>.md file added describing change

Copy link
Contributor

@klaa97 klaa97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great fix, I think that it filters out completely the builtins (maybe also functions returning a generic, which I think is the easiest option) 🔝 Sorry again for the bug introduced. 🙏

tests/mypy/outputs/plugin-fail-strict.txt Show resolved Hide resolved
@samuelcolvin samuelcolvin changed the title fix mypy with default_factory=list etc. fix mypy with default_factory=list etc. Sep 2, 2022
@samuelcolvin
Copy link
Member Author

please review.

@samuelcolvin samuelcolvin merged commit 02cf7f5 into main Sep 5, 2022
@samuelcolvin samuelcolvin deleted the mypy-default_factory branch September 5, 2022 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mypy error on default_factory=list in pydantic 1.10
4 participants