[ty] Use field type context for TypedDict constructor values#24422
Open
charliermarsh wants to merge 1 commit intomainfrom
Open
[ty] Use field type context for TypedDict constructor values#24422charliermarsh wants to merge 1 commit intomainfrom
charliermarsh wants to merge 1 commit intomainfrom
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 87.72%. The percentage of expected errors that received a diagnostic held steady at 82.85%. The number of fully passing files held steady at 74/132. |
Memory usage reportMemory usage unchanged ✅ |
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-await |
0 | 40 | 0 |
invalid-argument-type |
0 | 6 | 14 |
invalid-return-type |
0 | 1 | 0 |
| Total | 0 | 47 | 14 |
Changes in flaky projects detected. Raw diff output excludes flaky projects; see the HTML report for details.
Raw diff (20 changes)
core (https://github.com/home-assistant/core)
- homeassistant/components/adguard/entity.py:63:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, Unknown, Unknown, Unknown]]`
+ homeassistant/components/adguard/entity.py:63:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, Unknown, Unknown, Unknown]]`
- homeassistant/components/azure_devops/entity.py:23:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str, Unknown]]`
+ homeassistant/components/azure_devops/entity.py:23:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, str, Unknown]]`
- homeassistant/components/bond/entity.py:83:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, Unknown | str | None, Unknown | str]]`
+ homeassistant/components/bond/entity.py:83:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, Unknown | str | None, Unknown | str]]`
- homeassistant/components/hvv_departures/binary_sensor.py:144:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, Unknown, Unknown, Unknown]]`
+ homeassistant/components/hvv_departures/binary_sensor.py:144:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, Unknown, Unknown, Unknown]]`
- homeassistant/components/hvv_departures/sensor.py:79:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, Unknown, Unknown, Unknown]]`
+ homeassistant/components/hvv_departures/sensor.py:79:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, Unknown, Unknown, Unknown]]`
- homeassistant/components/izone/climate.py:479:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str, Unknown]]`
+ homeassistant/components/izone/climate.py:479:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, str, Unknown]]`
- homeassistant/components/met_eireann/weather.py:99:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str]]`
+ homeassistant/components/met_eireann/weather.py:99:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str]]`
- homeassistant/components/toon/entity.py:43:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, Unknown, str]]`
+ homeassistant/components/toon/entity.py:43:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, Unknown, str]]`
- homeassistant/components/toon/entity.py:63:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, Unknown, str]]`
+ homeassistant/components/toon/entity.py:63:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, Unknown, str]]`
- homeassistant/components/toon/entity.py:83:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, Unknown, str]]`
+ homeassistant/components/toon/entity.py:83:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, Unknown, str]]`
- homeassistant/components/toon/entity.py:103:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, Unknown, str]]`
+ homeassistant/components/toon/entity.py:103:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, Unknown, str]]`
- homeassistant/components/toon/entity.py:124:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, Unknown, str]]`
+ homeassistant/components/toon/entity.py:124:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, Unknown, str]]`
- homeassistant/components/toon/entity.py:144:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, Unknown, str]]`
+ homeassistant/components/toon/entity.py:144:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, Unknown, str]]`
- homeassistant/components/vilfo/sensor.py:75:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, Unknown, Unknown]]`
+ homeassistant/components/vilfo/sensor.py:75:25 error[invalid-argument-type] Invalid argument to key "identifiers" with declared type `set[tuple[str, str]]` on TypedDict `DeviceInfo`: value of type `set[tuple[str, str] | tuple[str, Unknown, Unknown]]`
zulip (https://github.com/zulip/zulip)
- zerver/webhooks/fixtureless_integrations.py:98:13 error[invalid-argument-type] Invalid argument to key "content" with declared type `str | list[MessageThread]` on TypedDict `ScreenshotContent`: value of type `list[dict[str, str]]`
- zerver/webhooks/fixtureless_integrations.py:128:13 error[invalid-argument-type] Invalid argument to key "content" with declared type `str | list[MessageThread]` on TypedDict `ScreenshotContent`: value of type `list[dict[str, str]]`
- zerver/webhooks/fixtureless_integrations.py:155:13 error[invalid-argument-type] Invalid argument to key "content" with declared type `str | list[MessageThread]` on TypedDict `ScreenshotContent`: value of type `list[dict[str, str]]`
- zerver/webhooks/fixtureless_integrations.py:166:13 error[invalid-argument-type] Invalid argument to key "content" with declared type `str | list[MessageThread]` on TypedDict `ScreenshotContent`: value of type `list[dict[str, str]]`
- zerver/webhooks/fixtureless_integrations.py:189:13 error[invalid-argument-type] Invalid argument to key "content" with declared type `str | list[MessageThread]` on TypedDict `ScreenshotContent`: value of type `list[dict[str, str]]`
- zerver/webhooks/fixtureless_integrations.py:263:13 error[invalid-argument-type] Invalid argument to key "content" with declared type `str | list[MessageThread]` on TypedDict `ScreenshotContent`: value of type `list[dict[str, str]]`
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
Sign up for free
to 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.
Summary
This PR adds logic to re-infer
TypedDictconstructor values with the destination field's declared type context, which prevents us from rejecting the constructor in:#23936 solves this with a broader rewrite of TypedDict construction. The change here is intentionally more narrow.
Closes astral-sh/ty#3027.