Skip to content

Comments

[ty] Track dictionary literal keys as individual places#22882

Merged
ibraheemdev merged 4 commits intomainfrom
ibraheem/implicit-typed-dict
Jan 28, 2026
Merged

[ty] Track dictionary literal keys as individual places#22882
ibraheemdev merged 4 commits intomainfrom
ibraheem/implicit-typed-dict

Conversation

@ibraheemdev
Copy link
Member

@ibraheemdev ibraheemdev commented Jan 27, 2026

Track every key-value assignment in a dictionary literal as a place, such that later accesses to individual keys can be narrowed to a more specific type. For example:

x = {"a": 1, "b": "2"}
reveal_type(x)  # revealed: dict[Unknown | str, Unknown | int | str]
reveal_type(x["a"])  # revealed: Literal[1]
reveal_type(x["b"])  # revealed: Literal["2"]

See astral-sh/ty#1248 for details.

@ibraheemdev ibraheemdev added the ty Multi-file analysis & type inference label Jan 27, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 27, 2026

Typing conformance results

No changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 27, 2026

mypy_primer results

Changes were detected when running on open source projects
pip (https://github.com/pypa/pip)
- src/pip/_vendor/requests/cookies.py:486:36: warning[possibly-missing-attribute] Attribute `startswith` may be missing on object of type `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/rich/pretty.py:1006:31: warning[unused-ignore-comment] Unused blanket `type: ignore` directive

beartype (https://github.com/beartype/beartype)
+ beartype/__init__.py:122:63: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 499 diagnostics
+ Found 500 diagnostics

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/serving.py:225:52: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `IO[bytes]`, found `BufferedIOBase`
- Found 410 diagnostics
+ Found 411 diagnostics

paasta (https://github.com/yelp/paasta)
- paasta_tools/contrib/service_shard_update.py:283:25: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | str`
- paasta_tools/paastaapi/api_client.py:713:21: error[invalid-assignment] Cannot assign to a subscript on an object of type `None`
- paasta_tools/paastaapi/api_client.py:717:21: error[invalid-assignment] Cannot assign to a subscript on an object of type `None`
- paasta_tools/paastaapi/api_client.py:725:21: error[invalid-assignment] Cannot assign to a subscript on an object of type `None`
- paasta_tools/setup_kubernetes_cr.py:306:9: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["labels"]` on object of type `str`
- paasta_tools/setup_kubernetes_cr.py:306:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- paasta_tools/setup_kubernetes_cr.py:310:9: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["annotations"]` on object of type `str`
- paasta_tools/setup_kubernetes_cr.py:310:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- paasta_tools/setup_kubernetes_cr.py:313:9: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["labels"]` on object of type `str`
- paasta_tools/setup_kubernetes_cr.py:313:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- paasta_tools/setup_kubernetes_cr.py:316:5: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["annotations"]` on object of type `str`
- paasta_tools/setup_kubernetes_cr.py:316:5: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- paasta_tools/setup_kubernetes_cr.py:317:5: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["annotations"]` on object of type `str`
- paasta_tools/setup_kubernetes_cr.py:317:5: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- paasta_tools/setup_kubernetes_cr.py:318:5: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["labels"]` on object of type `str`
- paasta_tools/setup_kubernetes_cr.py:318:5: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- paasta_tools/setup_kubernetes_cr.py:319:5: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["labels"]` on object of type `str`
- paasta_tools/setup_kubernetes_cr.py:319:5: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- paasta_tools/setup_kubernetes_cr.py:320:5: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["labels"]` on object of type `str`
- paasta_tools/setup_kubernetes_cr.py:320:5: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- paasta_tools/tron/client.py:49:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- paasta_tools/tron_tools.py:1105:17: error[invalid-argument-type] Argument to function `build_spark_command` is incorrect: Expected `str`, found `Unknown | list[TronSecretVolume] | bool | str | None`
- Found 1099 diagnostics
+ Found 1077 diagnostics

twine (https://github.com/pypa/twine)
+ twine/utils.py:230:53: warning[redundant-cast] Value is already of type `str`
- Found 9 diagnostics
+ Found 10 diagnostics

scrapy (https://github.com/scrapy/scrapy)
- tests/test_http2_client_protocol.py:109:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- Found 1774 diagnostics
+ Found 1773 diagnostics

rich (https://github.com/Textualize/rich)
+ rich/pretty.py:1006:31: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 353 diagnostics
+ Found 354 diagnostics

dulwich (https://github.com/dulwich/dulwich)
+ dulwich/tests/utils.py:372:58: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 226 diagnostics
+ Found 227 diagnostics

ignite (https://github.com/pytorch/ignite)
- tests/ignite/metrics/test_metric.py:1214:9: error[unresolved-attribute] Unresolved attribute `_num_correct` on type `Metric`
- tests/ignite/metrics/test_metric.py:1215:9: error[unresolved-attribute] Unresolved attribute `_num_examples` on type `Metric`
- tests/ignite/metrics/test_metric.py:1216:9: error[unresolved-attribute] Unresolved attribute `_numerator` on type `Metric`
- tests/ignite/metrics/test_metric.py:1217:9: error[unresolved-attribute] Unresolved attribute `_denominator` on type `Metric`
- tests/ignite/metrics/test_metric.py:1218:9: error[unresolved-attribute] Unresolved attribute `_weight` on type `Metric`
- tests/ignite/metrics/test_metric.py:1219:9: error[unresolved-attribute] Unresolved attribute `_updated` on type `Metric`
- Found 2078 diagnostics
+ Found 2072 diagnostics

schemathesis (https://github.com/schemathesis/schemathesis)
- src/schemathesis/transport/requests.py:87:13: warning[possibly-missing-attribute] Attribute `pop` may be missing on object of type `Unknown | str | dict[str, Any] | CaseInsensitiveDict[Unknown] | dict[Unknown, Unknown]`
- Found 281 diagnostics
+ Found 280 diagnostics

tornado (https://github.com/tornadoweb/tornado)
- tornado/ioloop.py:540:12: warning[possibly-missing-attribute] Attribute `cancelled` may be missing on object of type `(Unknown & ~None) | bool`
- tornado/ioloop.py:540:53: warning[possibly-missing-attribute] Attribute `done` may be missing on object of type `(Unknown & ~None) | bool`
- tornado/ioloop.py:547:16: warning[possibly-missing-attribute] Attribute `result` may be missing on object of type `(Unknown & ~None) | bool`
- Found 327 diagnostics
+ Found 324 diagnostics

mitmproxy (https://github.com/mitmproxy/mitmproxy)
- mitmproxy/addons/savehar.py:206:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- mitmproxy/addons/savehar.py:206:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- mitmproxy/addons/savehar.py:206:17: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["text"]` and value of type `str` on object of type `list[dict[Unknown, Unknown]]`
- mitmproxy/addons/savehar.py:207:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- mitmproxy/addons/savehar.py:207:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- mitmproxy/addons/savehar.py:207:17: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["encoding"]` and value of type `Literal["base64"]` on object of type `list[dict[Unknown, Unknown]]`
- mitmproxy/addons/savehar.py:211:21: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- mitmproxy/addons/savehar.py:211:21: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- mitmproxy/addons/savehar.py:211:21: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["text"]` and value of type `Literal[""]` on object of type `list[dict[Unknown, Unknown]]`
- mitmproxy/addons/savehar.py:213:21: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- mitmproxy/addons/savehar.py:213:21: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- mitmproxy/addons/savehar.py:213:21: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["text"]` and value of type `str` on object of type `list[dict[Unknown, Unknown]]`
- Found 2140 diagnostics
+ Found 2128 diagnostics

optuna (https://github.com/optuna/optuna)
+ tests/samplers_tests/test_nsgaii.py:857:40: error[invalid-argument-type] Argument to bound method `to_internal_repr` is incorrect: Expected `None | int | float | str`, found `ndarray[Unknown, dtype[Any]]`
+ tests/samplers_tests/test_nsgaii.py:858:40: error[invalid-argument-type] Argument to bound method `to_internal_repr` is incorrect: Expected `None | int | float | str`, found `ndarray[Unknown, dtype[Any]]`
- Found 576 diagnostics
+ Found 578 diagnostics

dragonchain (https://github.com/dragonchain/dragonchain)
- dragonchain/lib/dto/api_key_model_utest.py:265:9: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["transactions"]` on object of type `str`
- dragonchain/lib/dto/api_key_model_utest.py:265:9: error[not-subscriptable] Cannot subscript object of type `bool` with no `__getitem__` method
- Found 436 diagnostics
+ Found 434 diagnostics

vision (https://github.com/pytorch/vision)
- references/detection/coco_utils.py:137:9: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | list[Unknown] | dict[Unknown, Unknown]`
- references/detection/coco_utils.py:166:13: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | list[Unknown] | dict[Unknown, Unknown]`
- Found 1396 diagnostics
+ Found 1394 diagnostics

pyppeteer (https://github.com/pyppeteer/pyppeteer)
+ pyppeteer/input.py:144:43: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- pyppeteer/network_manager.py:727:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- pyppeteer/network_manager.py:727:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `None`
- Found 87 diagnostics
+ Found 86 diagnostics

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- pymongo/asynchronous/server.py:275:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- pymongo/asynchronous/server.py:277:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- pymongo/synchronous/server.py:275:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- pymongo/synchronous/server.py:277:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- Found 444 diagnostics
+ Found 440 diagnostics

discord.py (https://github.com/Rapptz/discord.py)
- discord/gateway.py:471:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- discord/gateway.py:475:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- discord/gateway.py:483:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- discord/gateway.py:740:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- discord/gateway.py:743:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- discord/gateway.py:746:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- Found 536 diagnostics
+ Found 530 diagnostics

xarray (https://github.com/pydata/xarray)
+ xarray/tests/test_dataarray.py:3991:50: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ xarray/tests/test_dataarray.py:3992:50: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ xarray/tests/test_dataset.py:5638:50: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ xarray/tests/test_dataset.py:5639:50: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 1767 diagnostics
+ Found 1771 diagnostics

apprise (https://github.com/caronc/apprise)
- apprise/apprise.py:850:13: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | str | list[Unknown]`
- apprise/plugins/d7networks.py:238:13: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["originator"]` and value of type `Unknown & ~AlwaysFalsy` on object of type `list[Unknown | dict[Unknown | str, Unknown | None | str]]`
- apprise/plugins/d7networks.py:245:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/d7networks.py:257:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/fcm/__init__.py:421:21: error[invalid-assignment] Cannot assign to a subscript on an object of type `None`
- apprise/plugins/lametric.py:768:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/lametric.py:768:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `tuple[Unknown | str, Unknown | str, Unknown | str]`
- apprise/plugins/lametric.py:768:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `tuple[Unknown | str, Unknown | str]`
- apprise/plugins/lametric.py:768:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- apprise/plugins/line.py:174:13: error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
- apprise/plugins/msteams.py:373:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/msteams.py:373:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- apprise/plugins/msteams.py:373:17: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- apprise/plugins/notifiarr.py:330:17: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["text"]` on object of type `str`
- apprise/plugins/notifiarr.py:330:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- apprise/plugins/notifiarr.py:330:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/notifiarr.py:330:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `tuple[int, int, int]`
- apprise/plugins/notifiarr.py:331:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/office365.py:392:13: warning[possibly-missing-attribute] Attribute `update` may be missing on object of type `Unknown | dict[Unknown | str, Unknown | str | dict[Unknown | str, Unknown | str]] | str`
- apprise/plugins/office365.py:471:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/office365.py:491:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/office365.py:496:17: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["toRecipients"]` on object of type `str`
- apprise/plugins/office365.py:496:17: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["emailAddress"]` on object of type `str`
- apprise/plugins/office365.py:508:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/office365.py:515:21: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["ccRecipients"]` on object of type `str`
- apprise/plugins/office365.py:515:21: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | str | dict[Unknown | str, Unknown | str]`
- apprise/plugins/office365.py:538:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/office365.py:545:21: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["bccRecipients"]` on object of type `str`
- apprise/plugins/office365.py:545:21: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | str | dict[Unknown | str, Unknown | str]`
- apprise/plugins/pagerduty.py:359:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/pagerduty.py:362:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/pagerduty.py:381:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/pagerduty.py:384:17: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["custom_details"]` on object of type `str`
- apprise/plugins/pagerduty.py:384:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/pagerduty.py:384:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `bool`
- apprise/plugins/ryver.py:230:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/sendgrid.py:414:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/slack.py:535:21: warning[possibly-missing-attribute] Attribute `insert` may be missing on object of type `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str]]`
- apprise/plugins/slack.py:628:21: error[not-subscriptable] Cannot subscript object of type `bool` with no `__getitem__` method
- apprise/plugins/slack.py:631:17: error[not-subscriptable] Cannot subscript object of type `bool` with no `__getitem__` method
- apprise/plugins/slack.py:635:21: error[not-subscriptable] Cannot subscript object of type `bool` with no `__getitem__` method
- apprise/plugins/smseagle.py:480:13: warning[possibly-missing-attribute] Attribute `update` may be missing on object of type `Unknown | str | dict[Unknown | str, Unknown | None]`
- apprise/plugins/smseagle.py:483:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/smseagle.py:490:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/smseagle.py:491:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/smseagle.py:496:17: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/sparkpost.py:568:21: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | bool | dict[Unknown | str, Unknown | str] | str`
- apprise/plugins/xbmc.py:193:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/xbmc.py:193:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- apprise/plugins/xbmc.py:231:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- apprise/plugins/xbmc.py:231:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- tests/test_apprise_utils.py:2258:12: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["w"]` on object of type `str`
- tests/test_apprise_utils.py:2258:12: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- tests/test_apprise_utils.py:2259:12: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["x"]` on object of type `str`
- tests/test_apprise_utils.py:2259:12: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- tests/test_apprise_utils.py:2268:12: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- tests/test_apprise_utils.py:2269:12: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- tests/test_apprise_utils.py:2270:12: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- tests/test_apprise_utils.py:2271:12: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- Found 2732 diagnostics
+ Found 2673 diagnostics

cloud-init (https://github.com/canonical/cloud-init)
- cloudinit/distros/alpine.py:396:17: warning[possibly-unresolved-reference] Name `new_line_parts` used when possibly not defined
- cloudinit/distros/alpine.py:401:17: warning[possibly-unresolved-reference] Name `new_line_parts` used when possibly not defined
- cloudinit/distros/bsd.py:98:13: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | list[Unknown] | int`
- cloudinit/net/cmdline.py:185:9: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | str | list[Unknown]`
- cloudinit/netinfo.py:86:17: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | str | bool | list[Unknown]`
- cloudinit/netinfo.py:100:17: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | str | bool | list[Unknown]`
- cloudinit/sources/DataSourceEc2.py:1111:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- cloudinit/sources/DataSourceEc2.py:1178:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- cloudinit/sources/DataSourceEc2.py:1181:12: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | int | dict[Unknown, Unknown]`
- cloudinit/sources/DataSourceEc2.py:1182:25: warning[possibly-missing-attribute] Attribute `keys` may be missing on object of type `Unknown | int | dict[Unknown, Unknown]`
- cloudinit/sources/DataSourceEc2.py:1183:13: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- cloudinit/sources/DataSourceEc2.py:1184:13: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- cloudinit/sources/DataSourceEc2.py:1185:13: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- cloudinit/sources/DataSourceEc2.py:1186:13: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- cloudinit/sources/DataSourceNoCloud.py:171:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["seedfrom"]` and `Unknown | dict[Unknown, Unknown] | str | None`
+ cloudinit/sources/DataSourceNoCloud.py:171:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["seedfrom"]` and `dict[Unknown, Unknown] | Unknown | str | None`
- cloudinit/sources/DataSourceNoCloud.py:192:17: error[invalid-argument-type] Argument to function `mergemanydict` is incorrect: Expected `Sequence[Mapping[Unknown, Unknown]]`, found `list[Unknown | dict[Unknown, Unknown] | str | None]`
+ cloudinit/sources/DataSourceNoCloud.py:192:17: error[invalid-argument-type] Argument to function `mergemanydict` is incorrect: Expected `Sequence[Mapping[Unknown, Unknown]]`, found `list[dict[Unknown, Unknown] | Unknown | str | None]`
- cloudinit/sources/DataSourceNoCloud.py:201:13: error[invalid-argument-type] Argument to function `mergemanydict` is incorrect: Expected `Sequence[Mapping[Unknown, Unknown]]`, found `list[Unknown | dict[Unknown, Unknown] | str | None | dict[Unknown | str, Unknown | str]]`
+ cloudinit/sources/DataSourceNoCloud.py:201:13: error[invalid-argument-type] Argument to function `mergemanydict` is incorrect: Expected `Sequence[Mapping[Unknown, Unknown]]`, found `list[dict[Unknown, Unknown] | Unknown | str | None | dict[Unknown | str, Unknown | str]]`
- cloudinit/sources/DataSourceNoCloud.py:216:9: error[invalid-assignment] Object of type `Unknown | dict[Unknown, Unknown] | str | None` is not assignable to attribute `userdata_raw` of type `str | bytes | None`
+ cloudinit/sources/DataSourceNoCloud.py:216:9: error[invalid-assignment] Object of type `str | Unknown | dict[Unknown, Unknown] | None` is not assignable to attribute `userdata_raw` of type `str | bytes | None`
- cloudinit/sources/helpers/vultr.py:176:9: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | int | list[Unknown | dict[Unknown | str, Unknown | str | list[Unknown | str]]]`
- cloudinit/sources/helpers/vultr.py:187:9: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | int | list[Unknown | dict[Unknown | str, Unknown | str | list[Unknown | str]]]`
- tests/unittests/config/test_apt_configure_sources_list_v3.py:437:13: error[not-subscriptable] Cannot subscript object of type `bool` with no `__getitem__` method
- tests/unittests/test__init__.py:26:30: error[no-matching-overload] No overload of function `join` matches arguments
- tests/unittests/test_net.py:2423:43: error[invalid-argument-type] Argument to function `safe_load` is incorrect: Expected `str | bytes | SupportsRead[str] | SupportsRead[bytes]`, found `Unknown | str | dict[Unknown | str, Unknown | str]`
- Found 1157 diagnostics
+ Found 1138 diagnostics

meson (https://github.com/mesonbuild/meson)
- mesonbuild/cmake/fileapi.py:195:21: error[unsupported-operator] Operator `+=` is not supported between objects of type `Path` and `list[Unknown | dict[Unknown, Unknown]]`
- mesonbuild/cmake/fileapi.py:195:21: error[unsupported-operator] Operator `+=` is not supported between objects of type `bool` and `list[Unknown | dict[Unknown, Unknown]]`
- mesonbuild/cmake/fileapi.py:200:21: error[unsupported-operator] Operator `+=` is not supported between objects of type `Path` and `list[Unknown | dict[Unknown, Unknown]]`
- mesonbuild/cmake/fileapi.py:200:21: error[unsupported-operator] Operator `+=` is not supported between objects of type `bool` and `list[Unknown | dict[Unknown, Unknown]]`
- mesonbuild/cmake/fileapi.py:218:17: error[unsupported-operator] Operator `+=` is not supported between objects of type `Path` and `list[Unknown | dict[Unknown | str, Unknown | bool | (list[Unknown] & ~AlwaysFalsy)]]`
- mesonbuild/cmake/fileapi.py:218:17: error[unsupported-operator] Operator `+=` is not supported between objects of type `bool` and `list[Unknown | dict[Unknown | str, Unknown | bool | (list[Unknown] & ~AlwaysFalsy)]]`
- mesonbuild/cmake/fileapi.py:223:17: error[unsupported-operator] Operator `+=` is not supported between objects of type `Path` and `list[Unknown | dict[Unknown | str, Unknown | bool | (list[Unknown] & ~AlwaysFalsy)]]`
- mesonbuild/cmake/fileapi.py:223:17: error[unsupported-operator] Operator `+=` is not supported between objects of type `bool` and `list[Unknown | dict[Unknown | str, Unknown | bool | (list[Unknown] & ~AlwaysFalsy)]]`
- mesonbuild/cmake/fileapi.py:252:17: error[unsupported-operator] Operator `+=` is not supported between objects of type `Path` and `list[Unknown | dict[str, Any]]`
- unittests/allplatformstests.py:3171:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- unittests/allplatformstests.py:3197:21: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- unittests/allplatformstests.py:3199:41: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["dynamic"]` on object of type `str`
- unittests/allplatformstests.py:3199:41: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Unknown | str | dict[Unknown | str, Unknown] | ... omitted 3 union elements`
- unittests/internaltests.py:307:50: error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | list[Unknown | str] | str` and `Literal[".ok"]`
- unittests/internaltests.py:310:36: error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | list[Unknown | str] | str` and `Literal[".hah"]`
- unittests/internaltests.py:332:47: error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | list[Unknown | str] | str` and `Literal[".ok"]`
- unittests/internaltests.py:335:36: error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | list[Unknown | str] | str` and `Literal[".hah"]`
- Found 2185 diagnostics
+ Found 2168 diagnostics

setuptools (https://github.com/pypa/setuptools)
- setuptools/_vendor/backports/tarfile/__init__.py:999:44: warning[possibly-missing-attribute] Attribute `endswith` may be missing on object of type `Unknown | str | None | int | bytes`
- setuptools/_vendor/backports/tarfile/__init__.py:999:66: error[invalid-argument-type] Argument to bound method `endswith` is incorrect: Expected `Buffer | tuple[Buffer, ...]`, found `Literal["/"]`
- setuptools/_vendor/backports/tarfile/__init__.py:1000:13: error[unsupported-operator] Operator `+=` is not supported between objects of type `None` and `Literal["/"]`
- setuptools/_vendor/backports/tarfile/__init__.py:1000:13: error[unsupported-operator] Operator `+=` is not supported between objects of type `int` and `Literal["/"]`
- setuptools/_vendor/backports/tarfile/__init__.py:1000:13: error[unsupported-operator] Operator `+=` is not supported between objects of type `bytes` and `Literal["/"]`
- setuptools/tests/test_editable_install.py:956:5: error[unsupported-operator] Operator `+=` is not supported between objects of type `dict[Unknown | str, Unknown | dict[Unknown | str, Unknown | str]]` and `str`
+ setuptools/tests/test_editable_install.py:956:5: error[unsupported-operator] Operator `+=` is not supported between objects of type `dict[Unknown | str, Unknown | dict[Unknown | str, Unknown | str | dict[Unknown | str, Unknown | str]]]` and `str`
- setuptools/tests/test_editable_install.py:956:5: error[unsupported-operator] Operator `+=` is not supported between objects of type `dict[Unknown | str, Unknown]` and `str`
- setuptools/tests/test_editable_install.py:956:5: error[unsupported-operator] Operator `+=` is not supported between objects of type `dict[Unknown | str, Unknown | dict[Unknown | str, Unknown]]` and `str`
- Found 1151 diagnostics
+ Found 1144 diagnostics

cwltool (https://github.com/common-workflow-language/cwltool)
- cwltool/checker.py:49:50: error[invalid-argument-type] Argument to bound method `remove` is incorrect: Expected `Never`, found `Literal["null"]`
- Found 512 diagnostics
+ Found 511 diagnostics

openlibrary (https://github.com/internetarchive/openlibrary)
- openlibrary/accounts/model.py:855:9: warning[possibly-missing-attribute] Attribute `get` may be missing on object of type `Unknown | bool | dict[Unknown | str, Unknown]`
+ openlibrary/accounts/model.py:855:9: warning[possibly-missing-attribute] Attribute `get` may be missing on object of type `dict[Unknown | str, Unknown] | Unknown | bool`
- openlibrary/accounts/model.py:862:12: warning[possibly-missing-attribute] Attribute `get` may be missing on object of type `Unknown | bool | dict[Unknown | str, Unknown]`
+ openlibrary/accounts/model.py:862:12: warning[possibly-missing-attribute] Attribute `get` may be missing on object of type `dict[Unknown | str, Unknown] | Unknown | bool`
- openlibrary/accounts/model.py:863:30: warning[possibly-missing-attribute] Attribute `get` may be missing on object of type `Unknown | bool | dict[Unknown | str, Unknown]`
+ openlibrary/accounts/model.py:863:30: warning[possibly-missing-attribute] Attribute `get` may be missing on object of type `dict[Unknown | str, Unknown] | Unknown | bool`
- openlibrary/accounts/model.py:950:23: warning[possibly-missing-attribute] Attribute `pop` may be missing on object of type `Unknown | bool | dict[Unknown | str, Unknown]`
+ openlibrary/accounts/model.py:950:23: warning[possibly-missing-attribute] Attribute `pop` may be missing on object of type `dict[Unknown | str, Unknown] | Unknown | bool`
- openlibrary/accounts/model.py:951:23: warning[possibly-missing-attribute] Attribute `pop` may be missing on object of type `Unknown | bool | dict[Unknown | str, Unknown]`
+ openlibrary/accounts/model.py:951:23: warning[possibly-missing-attribute] Attribute `pop` may be missing on object of type `dict[Unknown | str, Unknown] | Unknown | bool`
- openlibrary/core/observations.py:581:13: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | list[Unknown] | defaultdict[Unknown, Unknown]`
- openlibrary/core/observations.py:585:21: error[invalid-argument-type] Method `__getitem__` of type `Overload[(i: SupportsIndex, /) -> Unknown, (s: slice[Any, Any, Any], /) -> list[Unknown]]` cannot be called with key of type `str` on object of type `list[Unknown]`
- openlibrary/core/observations.py:585:21: error[invalid-argument-type] Method `__getitem__` of type `Overload[(i: SupportsIndex, /) -> Unknown, (s: slice[Any, Any, Any], /) -> list[Unknown]]` cannot be called with key of type `list[Unknown | int]` on object of type `list[Unknown]`
- openlibrary/core/observations.py:585:21: error[invalid-argument-type] Method `__getitem__` of type `Overload[(i: SupportsIndex, /) -> Unknown, (s: slice[Any, Any, Any], /) -> list[Unknown]]` cannot be called with key of type `list[Unknown | dict[Unknown | str, Unknown | int | str]]` on object of type `list[Unknown]`
- openlibrary/plugins/books/dynlinks.py:355:17: warning[possibly-missing-attribute] Attribute `insert` may be missing on object of type `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str]] | ... omitted 3 union elements`
- openlibrary/plugins/books/dynlinks.py:399:33: error[invalid-argument-type] Argument to function `trim` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str]] | ... omitted 3 union elements`
- openlibrary/plugins/books/dynlinks.py:400:37: error[invalid-argument-type] Argument to function `trim` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str]] | ... omitted 3 union elements`
- openlibrary/plugins/openlibrary/lists.py:439:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- openlibrary/plugins/openlibrary/lists.py:439:13: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["next"]` and value of type `Unknown` on object of type `list[Unknown]`
- openlibrary/plugins/openlibrary/lists.py:443:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- openlibrary/plugins/openlibrary/lists.py:443:13: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["prev"]` and value of type `Unknown` on object of type `list[Unknown]`
- Found 1153 diagnostics
+ Found 1142 diagnostics

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/manifold/_t_sne.py:1066:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- sklearn/manifold/_t_sne.py:1066:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `float`
- sklearn/manifold/_t_sne.py:1066:13: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["angle"]` and value of type `Unknown | float` on object of type `list[Unknown | int]`
- sklearn/manifold/_t_sne.py:1068:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- sklearn/manifold/_t_sne.py:1068:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `float`
- sklearn/manifold/_t_sne.py:1068:13: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["verbose"]` and value of type `Unknown | Literal[0]` on object of type `list[Unknown | int]`
- sklearn/manifold/_t_sne.py:1071:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- sklearn/manifold/_t_sne.py:1071:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `float`
- sklearn/manifold/_t_sne.py:1071:13: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["num_threads"]` and value of type `Unknown` on object of type `list[Unknown | int]`
- sklearn/metrics/tests/test_classification.py:179:23: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- sklearn/metrics/tests/test_classification.py:179:23: error[not-subscriptable] Cannot subscript object of type `float` with no `__getitem__` method
- sklearn/metrics/tests/test_classification.py:180:23: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- sklearn/metrics/tests/test_classification.py:180:23: error[not-subscriptable] Cannot subscript object of type `float` with no `__getitem__` method
- sklearn/metrics/tests/test_classification.py:181:23: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- sklearn/metrics/tests/test_classification.py:181:23: error[not-subscriptable] Cannot subscript object of type `float` with no `__getitem__` method
- sklearn/metrics/tests/test_classification.py:182:23: error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- sklearn/metrics/tests/test_classification.py:182:23: error[not-subscriptable] Cannot subscript object of type `float` with no `__getitem__` method
- sklearn/model_selection/tests/test_search.py:2613:14: warning[possibly-missing-attribute] Attribute `C` may be missing on object of type `Unknown | LinearSVC | int | float`
- sklearn/model_selection/tests/test_search.py:2623:12: warning[possibly-missing-attribute] Attribute `C` may be missing on object of type `Unknown | LinearSVC | int | float`
- sklearn/utils/_testing.py:936:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- sklearn/utils/_testing.py:936:13: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- Found 2486 diagnostics
+ Found 2465 diagnostics

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ddtrace/contrib/internal/tornado/application.py:42:5: warning[possibly-missing-attribute] Attribute `configure` may be missing on object of type `Unknown | Tracer | None`
- ddtrace/contrib/internal/tornado/application.py:46:5: error[invalid-assignment] Object of type `def wrap_executor(tracer, fn, args, kwargs, span_name, service=None, resource=None, span_type=None) -> Unknown` is not assignable to attribute `_wrap_executor` on type `Unknown | Tracer | None`
- ddtrace/contrib/internal/tornado/application.py:50:9: error[invalid-assignment] Object of type `Unknown | Tracer | None` is not assignable to attribute `enabled` on type `Unknown | Tracer | None`
- ddtrace/contrib/internal/tornado/application.py:52:35: warning[possibly-missing-attribute] Attribute `_agent_url` may be missing on object of type `Unknown | Tracer | None`
- ddtrace/contrib/internal/tornado/application.py:55:9: error[invalid-assignment] Object of type `str` is not assignable to attribute `_agent_url` on type `Unknown | Tracer | None`
- ddtrace/contrib/internal/tornado/application.py:55:29: warning[possibly-missing-attribute] Attribute `_span_aggregator` may be missing on object of type `Unknown | Tracer | None`
- ddtrace/contrib/internal/tornado/application.py:56:9: warning[possibly-missing-attribute] Attribute `_recreate` may be missing on object of type `Unknown | Tracer | None`
- ddtrace/contrib/internal/tornado/application.py:61:9: warning[possibly-missing-attribute] Attribute `set_tags` may be missing on object of type `Unknown | Tracer | None`
- ddtrace/contrib/internal/tornado/application.py:63:15: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `Unknown | Tracer | None`
+ ddtrace/debugging/_probe/status.py:68:66: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- tests/appsec/appsec_utils.py:343:18: error[no-matching-overload] No overload of bound method `__init__` matches arguments
- tests/ci_visibility/api_client/_util.py:77:9: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["early_flake_detection"]` on object of type `str`
- tests/ci_visibility/api_client/_util.py:77:9: warning[possibly-missing-attribute] Attribute `update` may be missing on object of type `Unknown | bool | dict[Unknown | str, Unknown | bool]`
- tests/ci_visibility/api_client/_util.py:106:9: error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[Any, Any, Any], /) -> LiteralString, (key: SupportsIndex | slice[Any, Any, Any], /) -> str]` cannot be called with key of type `Literal["tests"]` on object of type `str`
- tests/debugging/origin/test_span.py:230:21: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | str | list[Unknown]`
- tests/internal/remoteconfig/test_remoteconfig_appsec_client_e2e.py:61:9: error[invalid-argument-type] Method `__getitem__` of type `Overload[(i: SupportsIndex, /) -> Unknown, (s: slice[Any, Any, Any], /) -> list[Unknown]]` cannot be called with key of type `Literal["state"]` on object of type `list[Unknown]`
- tests/internal/remoteconfig/test_remoteconfig_appsec_client_e2e.py:61:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["backend_client_state"]` and value of type `Unknown & ~AlwaysFalsy` on object of type `list[Unknown | str]`
- tests/internal/remoteconfig/test_remoteconfig_appsec_client_e2e.py:61:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `bool`
- tests/internal/remoteconfig/test_remoteconfig_appsec_client_e2e.py:61:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- tests/internal/remoteconfig/test_remoteconfig_appsec_client_e2e.py:63:9: error[invalid-argument-type] Method `__getitem__` of type `Overload[(i: SupportsIndex, /) -> Unknown, (s: slice[Any, Any, Any], /) -> list[Unknown]]` cannot be called with key of type `Literal["state"]` on object of type `list[Unknown]`
- tests/internal/remoteconfig/test_remoteconfig_appsec_client_e2e.py:63:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["error"]` and value of type `Unknown | None` on object of type `list[Unknown | str]`
- tests/internal/remoteconfig/test_remoteconfig_appsec_client_e2e.py:63:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `bool`
- tests/internal/remoteconfig/test_remoteconfig_appsec_client_e2e.py:63:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- tests/llmobs/_utils.py:279:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- tests/llmobs/_utils.py:325:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["tag"]` and value of type `dict[Unknown | str, Unknown]` on object of type `list[Unknown | str]`
- tests/llmobs/_utils.py:327:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["span"]` and value of type `dict[Unknown | str, Unknown]` on object of type `list[Unknown | str]`
- tests/openfeature/config_helpers.py:116:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- Found 8256 diagnostics
+ Found 8231 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
- src/integrations/prefect-dbt/prefect_dbt/core/settings.py:94:28: error[invalid-assignment] Object of type `dict[Any, Any] | int | dict[str, Any] | ... omitted 4 union elements` is not assignable to `dict[str, Any]`
- src/integrations/prefect-dbt/prefect_dbt/core/settings.py:99:28: error[invalid-assignment] Object of type `int | dict[Any, Any] | float | ... omitted 3 union elements` is not assignable to `dict[str, Any]`
- src/prefect/cli/deploy/_core.py:86:21: error[invalid-assignment] Object of type `dict[Any, Any] | int | dict[str, Any] | ... omitted 4 union elements` is not assignable to `dict[str, Any]`
- src/prefect/cli/deploy/_core.py:87:21: error[invalid-assignment] Object of type `int | dict[Any, Any] | float | ... omitted 3 union elements` is not assignable to `dict[str, Any]`
- src/prefect/deployments/steps/core.py:137:38: error[invalid-argument-type] Argument is incorrect: Argument type `dict[Any, Any] | int | dict[str, Any] | ... omitted 4 union elements` does not satisfy constraints (`str`, `int`, `int | float`, `bool`, `dict[Any, Any]`, `list[Any]`, `None`) of type variable `T`
- src/prefect/utilities/templating.py:320:13: error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `Unknown | int | dict[str, Any] | ... omitted 4 union elements` on object of type `dict[str, Any]`
+ src/prefect/utilities/templating.py:320:13: error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `Unknown | dict[str, Any]` on object of type `dict[str, Any]`
- src/prefect/utilities/templating.py:323:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_block_document_references | dict[str, Any]`, found `list[Unknown | int | dict[str, Any] | ... omitted 4 union elements]`
+ src/prefect/utilities/templating.py:323:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_block_document_references | dict[str, Any]`, found `list[Unknown | dict[str, Any]]`
- src/prefect/utilities/templating.py:437:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `dict[object, Unknown | int | float | ... omitted 4 union elements]`
+ src/prefect/utilities/templating.py:437:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `dict[object, Unknown]`
- src/prefect/utilities/templating.py:442:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `list[Unknown | int | float | ... omitted 4 union elements]`
+ src/prefect/utilities/templating.py:442:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `list[Unknown]`
+ src/prefect/workers/base.py:232:13: error[invalid-argument-type] Argument is incorrect: Argument type `str | dict[str, Any]` does not satisfy constraints (`str`, `int`, `int | float`, `bool`, `dict[Any, Any]`, `list[Any]`, `None`) of type variable `T`
- src/prefect/workers/base.py:232:13: error[invalid-argument-type] Argument is incorrect: Argument type `str | int | dict[str, Any] | ... omitted 3 union elements` does not satisfy constraints (`str`, `int`, `int | float`, `bool`, `dict[Any, Any]`, `list[Any]`, `None`) of type variable `T`
- src/prefect/workers/base.py:234:20: error[invalid-ar

... (truncated 116 lines) ...

No memory usage changes detected ✅

@ibraheemdev ibraheemdev changed the title [ty] Basic dictionary key assignment narrowing [ty] Track dictionary literal keys as individual places Jan 27, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 27, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-assignment 4 135 2
invalid-argument-type 8 51 3
possibly-missing-attribute 0 45 5
not-subscriptable 0 27 0
unsupported-operator 0 18 2
unused-ignore-comment 14 0 0
invalid-return-type 0 4 4
unresolved-attribute 0 6 0
no-matching-overload 0 2 0
possibly-unresolved-reference 0 2 0
type-assertion-failure 2 0 0
not-iterable 0 1 0
redundant-cast 1 0 0
Total 29 291 16

Full report with detailed diff (timing results)

@ibraheemdev ibraheemdev marked this pull request as ready for review January 27, 2026 21:29
Some(CurrentAssignment::AnnAssign(ann_assign)) => {
self.add_standalone_type_expression(&ann_assign.annotation);
self.add_definition(
let assignment = self.add_definition(
Copy link
Member Author

@ibraheemdev ibraheemdev Jan 27, 2026

Choose a reason for hiding this comment

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

Note that during semantic indexing, we don't have a way of distinguishing between an annotated or unannotated assignment, e.g., x: dict[str, Any]; x = {}, so we perform the narrowing in both cases. We also perform the narrowing on TypedDict assignments for the same reason.

Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

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

This is fantastic! Code makes sense, looks great; ecosystem report is all good news. Kinda surprised there's no perf impact, but I'll take it!

@ibraheemdev ibraheemdev merged commit b345431 into main Jan 28, 2026
49 checks passed
@ibraheemdev ibraheemdev deleted the ibraheem/implicit-typed-dict branch January 28, 2026 02:00
@ibraheemdev
Copy link
Member Author

Hmm.. it looks like this fails to consider mutations through the dictionary object, e.g.,

def f(a: int, b: str): ...

x = { "a": 1, "b": "2" }
x.pop("b")

f(x["a"], x["b"]) # ok

But we have similar behavior for other attribute narrowing, is this a known issue?

class X:
    y: str | None

def evil(x: X):
    x.y = None

def _(x: X):
    if not x.y is None:
        evil(x)
        assert_type(x.y, str) # ok

@carljm
Copy link
Contributor

carljm commented Jan 28, 2026

Yes, that's a known issue with attribute/subscript narrowing in general, and shared by all type checkers (for those cases where they do attribute/subscript narrowing).

I don't think there is any way around it in general (without giving up very-useful-in-practice narrowing). The problem with any fully sound approach is that there are so many different ways in Python that arbitrary code can implicitly be executed, that ultimately you'd almost always be forced to discard the narrowing almost immediately. We could attempt to handle some common "obvious" cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecosystem-analyzer ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants