[ty] Preserve qualifiers in functional TypedDicts#24176
[ty] Preserve qualifiers in functional TypedDicts#24176charliermarsh merged 1 commit intocharlie/typed-dict-1from
Conversation
9ea4c9b to
219fe84
Compare
b44685f to
b6b5569
Compare
Typing conformance results improved 🎉The percentage of diagnostics emitted that were expected errors increased from 86.50% to 86.60%. The percentage of expected errors that received a diagnostic increased from 81.37% to 81.47%. The number of fully passing files improved from 67/132 to 69/132. SummaryHow are test cases classified?Each test case represents one expected error annotation or a group of annotations sharing a tag. Counts are per test case, not per diagnostic — multiple diagnostics on the same line count as one. Required annotations (
Test file breakdown2 files altered
True positives added (1)1 diagnostic
False positives removed (1)1 diagnostic
|
Memory usage reportSummary
Significant changesClick to expand detailed breakdownprefect
sphinx
trio
flake8
|
219fe84 to
f911635
Compare
b6b5569 to
1f59e42
Compare
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-await |
0 | 40 | 0 |
missing-typed-dict-key |
2 | 10 | 0 |
invalid-argument-type |
2 | 2 | 0 |
invalid-return-type |
0 | 2 | 0 |
| Total | 4 | 54 | 0 |
Changes in flaky projects detected. Raw diff output excludes flaky projects; see the HTML report for details.
Raw diff (17 changes)
archinstall (https://github.com/archlinux/archinstall)
- archinstall/lib/models/users.py:176:10 error[missing-typed-dict-key] Missing required key '!password' in TypedDict `UserSerialization` constructor
- archinstall/lib/models/users.py:176:10 error[invalid-return-type] Return type does not match returned value: expected `UserSerialization`, found `dict[str, str | Unknown | None | bool | list[str]]`
meson (https://github.com/mesonbuild/meson)
- mesonbuild/scripts/depscan.py:170:26 error[missing-typed-dict-key] Missing required key 'outputs' in TypedDict `Rule` constructor
- mesonbuild/scripts/depscan.py:182:45 error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `Require`, found `dict[str, str]`
- mesonbuild/scripts/depscan.py:182:45 error[missing-typed-dict-key] Missing required key 'compiled-module-path' in TypedDict `Require` constructor
- mesonbuild/scripts/depscan.py:182:45 error[missing-typed-dict-key] Missing required key 'lookup-method' in TypedDict `Require` constructor
- mesonbuild/scripts/depscan.py:182:45 error[missing-typed-dict-key] Missing required key 'source-path' in TypedDict `Require` constructor
- mesonbuild/scripts/depscan.py:182:45 error[missing-typed-dict-key] Missing required key 'unique-on-source-path' in TypedDict `Require` constructor
- mesonbuild/scripts/depscan.py:192:41 error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `Provide`, found `dict[str, str | Unknown]`
- mesonbuild/scripts/depscan.py:192:41 error[missing-typed-dict-key] Missing required key 'is-interface' in TypedDict `Provide` constructor
- mesonbuild/scripts/depscan.py:192:41 error[missing-typed-dict-key] Missing required key 'unique-on-source-path' in TypedDict `Provide` constructor
+ unittests/cargotests.py:333:33 error[invalid-argument-type] Argument to bound method `from_raw` is incorrect: Expected `Manifest`, found `dict[str, dict[str, str] | FromWorkspace]`
+ unittests/cargotests.py:333:45 error[missing-typed-dict-key] Missing required key 'version' in TypedDict `Package` constructor
+ unittests/cargotests.py:340:33 error[invalid-argument-type] Argument to bound method `from_raw` is incorrect: Expected `Manifest`, found `dict[str, dict[str, str]]`
+ unittests/cargotests.py:340:45 error[missing-typed-dict-key] Missing required key 'version' in TypedDict `Package` constructor
operator (https://github.com/canonical/operator)
- ops/pebble.py:2102:32 error[missing-typed-dict-key] Missing required key 'basic' in TypedDict `IdentityDict` constructor
- ops/pebble.py:2102:32 error[missing-typed-dict-key] Missing required key 'local' in TypedDict `IdentityDict` constructorf911635 to
cd256ad
Compare
1f59e42 to
778c8e2
Compare
|
(looks like there's a fair bit of failing CI on this one rn) |
778c8e2 to
c8660ea
Compare
cd256ad to
a9dd255
Compare
a9dd255 to
6da784f
Compare
c8660ea to
31c66b0
Compare
6da784f to
1edfdbc
Compare
31c66b0 to
e2950d5
Compare
1edfdbc to
e80e895
Compare
a3e5ce7 to
3fab758
Compare
e80e895 to
3bf53cd
Compare
3fab758 to
db29c72
Compare
AlexWaygood
left a comment
There was a problem hiding this comment.
Nice, this LGTM! One inline comment -- and also, as we discussed on Discord, it looks like this new field should probably go on DefinitionInferenceExtra rather than DefinitionInference
3bf53cd to
d4f851b
Compare
db29c72 to
92afb6b
Compare
d4f851b to
f005931
Compare
92afb6b to
018fb2d
Compare
f005931 to
39e2479
Compare
018fb2d to
1326be3
Compare
39e2479 to
41d79fb
Compare
1326be3 to
8cc7ac0
Compare
86a9862 to
6369ebb
Compare
c6fd2aa to
4b4d514
Compare
6369ebb to
8c2a9cf
Compare
4b4d514 to
b1e747d
Compare
|
(Sorry, this accidentally got merged because I pushed a downstream local change to the upstream branch. I will re-open.) |
## Summary This PR adds basic support for functional TypedDict construction, including recursive TypedDicts. The intent is to follow the patterns we've established for functional NamedTuple and `type(...)` calls as closely as we can. There are two follow-up PRs that were carved out to make them easier to review: - #24226 - #24227 (My intent is to merge the stack once all three are approved. E.g., the new false positive in the ecosystem test is fixed in #24176.) Part of: astral-sh/ty#3095. --------- Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
Summary
Part of: astral-sh/ty#3095.