Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Allow nesting of Annotated with TypedDict special forms inside TypedDicts#18165
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
hauntsaninja merged 2 commits intopython:masterfrombrianschubert:conformance-typeddict-readonlyNov 19, 2024
Merged
Allow nesting of Annotated with TypedDict special forms inside TypedDicts#18165
hauntsaninja merged 2 commits intopython:masterfrombrianschubert:conformance-typeddict-readonlyNov 19, 2024
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
CollaboratorAuthor
brianschubert commentedNov 19, 2024
With this, mypy passes the diff --git a/conformance/results/mypy/typeddicts_readonly.toml b/conformance/results/mypy/typeddicts_readonly.tomlindex 6dc58bb..ccc3d4b 100644--- a/conformance/results/mypy/typeddicts_readonly.toml+++ b/conformance/results/mypy/typeddicts_readonly.toml@@ -7,11 +7,9 @@ typeddicts_readonly.py:24: error: ReadOnly TypedDict key "members" TypedDict is typeddicts_readonly.py:36: error: ReadOnly TypedDict key "members" TypedDict is mutated [typeddict-readonly-mutated] typeddicts_readonly.py:50: error: ReadOnly TypedDict key "title" TypedDict is mutated [typeddict-readonly-mutated] typeddicts_readonly.py:51: error: ReadOnly TypedDict key "year" TypedDict is mutated [typeddict-readonly-mutated]-typeddicts_readonly.py:56: error: NotRequired[] can be only used in a TypedDict definition [valid-type] typeddicts_readonly.py:60: error: ReadOnly TypedDict key "title" TypedDict is mutated [typeddict-readonly-mutated]+typeddicts_readonly.py:61: error: ReadOnly TypedDict key "year" TypedDict is mutated [typeddict-readonly-mutated] """-conformance_automated = "Fail"+conformance_automated = "Pass" errors_diff = """-Line 61: Expected 1 errors-Line 56: Unexpected errors ['typeddicts_readonly.py:56: error: NotRequired[] can be only used in a TypedDict definition [valid-type]'] """diff --git a/conformance/results/mypy/typeddicts_required.toml b/conformance/results/mypy/typeddicts_required.tomlindex 7cf6994..acc0431 100644--- a/conformance/results/mypy/typeddicts_required.toml+++ b/conformance/results/mypy/typeddicts_required.toml@@ -7,11 +7,7 @@ typeddicts_required.py:12: error: Required[] can be only used in a TypedDict def typeddicts_required.py:19: error: NotRequired[] can be only used in a TypedDict definition [valid-type] typeddicts_required.py:62: error: "Required[]" type cannot be nested [valid-type] typeddicts_required.py:63: error: "NotRequired[]" type cannot be nested [valid-type]-typeddicts_required.py:68: error: Required[] can be only used in a TypedDict definition [valid-type]-typeddicts_required.py:70: error: Required[] can be only used in a TypedDict definition [valid-type] """-conformance_automated = "Fail"+conformance_automated = "Pass" errors_diff = """-Line 68: Unexpected errors ['typeddicts_required.py:68: error: Required[] can be only used in a TypedDict definition [valid-type]']-Line 70: Unexpected errors ['typeddicts_required.py:70: error: Required[] can be only used in a TypedDict definition [valid-type]'] """diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.tomlindex bdefc8c..842fec5 100644--- a/conformance/results/mypy/version.toml+++ b/conformance/results/mypy/version.toml@@ -1,2 +1,2 @@-version = "mypy 1.13.0"-test_duration = 2.7+version = "mypy 1.14.0+dev.ec6dc1bc20da15dc0d8dd916d487dd3cbb7f6b69"+test_duration = 7.0 |
This comment has been minimized.
This comment has been minimized.
Contributor
According tomypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
hauntsaninja approved these changesNov 19, 2024
11c58a7 intopython:master 19 checks passed
Uh oh!
There was an error while loading.Please reload this page.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is allowed per thetyping spec.
Updates the TypeAnalyzer to remember whether TypedDict special forms are allowed when visiting
Annotatedtypes.