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

Add ReadOnly support for TypedDicts #17644

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Aug 5, 2024

Refs #17264

I will add docs in a separate PR.

@sobolevn sobolevn mentioned this pull request Aug 5, 2024
8 tasks

This comment has been minimized.

This comment has been minimized.

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good, I have few questions and suggestions.

mypy/checkexpr.py Outdated Show resolved Hide resolved
mypy/errors.py Outdated Show resolved Hide resolved
mypy/join.py Outdated Show resolved Hide resolved
mypy/plugins/default.py Show resolved Hide resolved
mypy/typeshed/stdlib/turtle.pyi Outdated Show resolved Hide resolved
test-data/unit/check-typeddict.test Outdated Show resolved Hide resolved
test-data/unit/check-typeddict.test Show resolved Hide resolved
@sobolevn
Copy link
Member Author

sobolevn commented Aug 14, 2024

I ended up with to_be_mutated property for an extra check from .update plugin to check_typeddict_call_with_kwargs (the only place where we can really do this check). It is not the nicest solution, but it seems good enough.

@ilevkivskyi thanks a lot for your review! You found several bugs that I've missed. Please, take a look again, once you have the time :)

Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@EwoutH
Copy link

EwoutH commented Aug 26, 2024

Thanks a lot for this effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants