Skip to content

Conversation

@ibraheemdev
Copy link
Member

Summary

This solves most of astral-sh/ty#1576. More advanced cases likely require the new constraint solver.

@ibraheemdev ibraheemdev added the ty Multi-file analysis & type inference label Dec 2, 2025
@ibraheemdev ibraheemdev force-pushed the ibraheem/bidi-subtyping branch from 51d8ef8 to 0e577a3 Compare December 2, 2025 05:33
@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 2, 2025

Diagnostic diff on typing conformance tests

Changes were detected when running ty on typing conformance tests
--- old-output.txt	2025-12-02 22:03:19.784386714 +0000
+++ new-output.txt	2025-12-02 22:03:23.396430298 +0000
@@ -815,7 +815,7 @@
 overloads_evaluation.py:291:33: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `T@example6`
 protocols_class_objects.py:58:16: error[invalid-assignment] Object of type `<class 'ConcreteA'>` is not assignable to `ProtoA1`
 protocols_class_objects.py:59:16: error[invalid-assignment] Object of type `<class 'ConcreteA'>` is not assignable to `ProtoA2`
-protocols_definition.py:30:11: error[invalid-argument-type] Argument to function `close_all` is incorrect: Expected `Iterable[SupportsClose]`, found `list[Unknown | int]`
+protocols_definition.py:30:11: error[invalid-argument-type] Argument to function `close_all` is incorrect: Expected `Iterable[SupportsClose]`, found `list[SupportsClose | int]`
 protocols_definition.py:114:22: error[invalid-assignment] Object of type `Concrete2_Bad1` is not assignable to `Template2`
 protocols_definition.py:115:22: error[invalid-assignment] Object of type `Concrete2_Bad2` is not assignable to `Template2`
 protocols_definition.py:116:22: error[invalid-assignment] Object of type `Concrete2_Bad3` is not assignable to `Template2`

@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 2, 2025

mypy_primer results

Changes were detected when running on open source projects
paroxython (https://github.com/laowantong/paroxython)
+ paroxython/derived_labels_db.py:189:13: error[invalid-argument-type] Method `__getitem__` of type `bound method defaultdict[LabelName, dict[Span, Any]].__getitem__(key: LabelName, /) -> dict[Span, Any]` cannot be called with key of type `str | Unknown` on object of type `defaultdict[LabelName, dict[Span, Any]]`
- Found 7 diagnostics
+ Found 8 diagnostics

pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
+ pytest_robotframework/__init__.py:301:22: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `nullcontext[None]`, found `nullcontext[object]`
- Found 167 diagnostics
+ Found 168 diagnostics

spack (https://github.com/spack/spack)
- lib/spack/spack/vendor/jinja2/environment.py:1114:25: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `MutableMapping[Unknown, Unknown]`, found `Mapping[str, Any] | dict[Unknown, Unknown]`
+ lib/spack/spack/vendor/jinja2/environment.py:1114:25: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `MutableMapping[str, Any]`, found `Mapping[str, Any]`

pip (https://github.com/pypa/pip)
+ src/pip/_internal/commands/search.py:101:13: error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `dict[Unknown | str, Unknown | str | list[Unknown | str]]` on object of type `OrderedDict[str, TransformedHit]`
- src/pip/_vendor/resolvelib/structs.py:203:37: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `() -> Iterable[Unknown]`, found `(Iterable[CT@build_iter_view] & (() -> object)) | (() -> Iterable[CT@build_iter_view])`
+ src/pip/_vendor/resolvelib/structs.py:203:37: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `() -> Iterable[CT@build_iter_view]`, found `(Iterable[CT@build_iter_view] & (() -> object)) | (() -> Iterable[CT@build_iter_view])`
+ src/pip/_vendor/resolvelib/structs.py:206:34: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[CT@build_iter_view]`, found `(Iterable[CT@build_iter_view] & Sequence[object] & ~(() -> object)) | list[CT@build_iter_view]`
- Found 601 diagnostics
+ Found 603 diagnostics

beartype (https://github.com/beartype/beartype)
+ beartype/claw/_ast/_kind/clawastimport.py:622:68: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ beartype/claw/_ast/_kind/clawastimport.py:631:72: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 496 diagnostics
+ Found 498 diagnostics

werkzeug (https://github.com/pallets/werkzeug)
- tests/test_routing.py:615:9: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Rule]`, found `list[Unknown | Submount | EndpointPrefix | Subdomain]`
+ tests/test_routing.py:615:9: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Rule]`, found `list[Rule | Submount | EndpointPrefix | Subdomain]`
- tests/test_send_file.py:131:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[tuple[str, str]] | None`, found `dict[Unknown | str, Unknown | str]`
+ tests/test_send_file.py:131:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[tuple[str, str]] | None`, found `dict[tuple[str, str] | str, Unknown | str]`
- tests/test_test.py:223:24: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[tuple[str, str]] | None`, found `dict[Unknown | str, Unknown | str]`
+ tests/test_test.py:223:24: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[tuple[str, str]] | None`, found `dict[tuple[str, str] | str, Unknown | str]`
- tests/test_test.py:227:50: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[tuple[str, str]] | None`, found `dict[Unknown | str, Unknown | str]`
+ tests/test_test.py:227:50: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[tuple[str, str]] | None`, found `dict[tuple[str, str] | str, Unknown | str]`

jinja (https://github.com/pallets/jinja)
- tests/test_loader.py:283:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[BaseLoader]`, found `list[Unknown | BaseLoader | None]`
+ tests/test_loader.py:283:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[BaseLoader]`, found `list[BaseLoader | Unknown | None]`
- tests/test_loader.py:293:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Mapping[str, BaseLoader]`, found `dict[Unknown | str, Unknown | BaseLoader | None]`
+ tests/test_loader.py:293:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Mapping[str, BaseLoader]`, found `dict[str, BaseLoader | Unknown | None]`

scrapy (https://github.com/scrapy/scrapy)
- tests/test_contracts.py:571:35: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[type[Contract]]`, found `list[Unknown | CustomFailContractPreProcess]`
+ tests/test_contracts.py:571:35: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[type[Contract]]`, found `list[type[Contract] | CustomFailContractPreProcess]`
- tests/test_contracts.py:585:35: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[type[Contract]]`, found `list[Unknown | CustomFailContractPostProcess]`
+ tests/test_contracts.py:585:35: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[type[Contract]]`, found `list[type[Contract] | CustomFailContractPostProcess]`
- tests/test_http_response.py:282:35: error[invalid-argument-type] Argument to bound method `follow_all` is incorrect: Expected `Iterable[str | Link]`, found `list[Unknown | None]`
+ tests/test_http_response.py:282:35: error[invalid-argument-type] Argument to bound method `follow_all` is incorrect: Expected `Iterable[str | Link]`, found `list[str | Link | None] & list[Unknown | None]`
- tests/test_http_response.py:291:35: error[invalid-argument-type] Argument to bound method `follow_all` is incorrect: Expected `Iterable[str | Link]`, found `list[Unknown | None]`
+ tests/test_http_response.py:291:35: error[invalid-argument-type] Argument to bound method `follow_all` is incorrect: Expected `Iterable[str | Link]`, found `list[str | Link | None] & list[Unknown | None]`
- tests/test_pipeline_files.py:368:28: error[invalid-assignment] Object of type `dataclasses.Field[list[str] | <class 'list'>]` is not assignable to `list[str]`
+ tests/test_pipeline_files.py:368:28: error[invalid-assignment] Object of type `dataclasses.Field[<class 'list'> | list[str]]` is not assignable to `list[str]`
- tests/test_pipeline_files.py:369:35: error[invalid-assignment] Object of type `dataclasses.Field[list[dict[str, str]] | <class 'list'>]` is not assignable to `list[dict[str, str]]`
+ tests/test_pipeline_files.py:369:35: error[invalid-assignment] Object of type `dataclasses.Field[<class 'list'> | list[dict[str, str]]]` is not assignable to `list[dict[str, str]]`
- tests/test_pipeline_files.py:371:35: error[invalid-assignment] Object of type `dataclasses.Field[list[str] | <class 'list'>]` is not assignable to `list[str]`
+ tests/test_pipeline_files.py:371:35: error[invalid-assignment] Object of type `dataclasses.Field[<class 'list'> | list[str]]` is not assignable to `list[str]`
- tests/test_pipeline_files.py:372:42: error[invalid-assignment] Object of type `dataclasses.Field[list[dict[str, str]] | <class 'list'>]` is not assignable to `list[dict[str, str]]`
+ tests/test_pipeline_files.py:372:42: error[invalid-assignment] Object of type `dataclasses.Field[<class 'list'> | list[dict[str, str]]]` is not assignable to `list[dict[str, str]]`
- tests/test_pipeline_images.py:332:29: error[invalid-assignment] Object of type `dataclasses.Field[list[str] | <class 'list'>]` is not assignable to `list[str]`
+ tests/test_pipeline_images.py:332:29: error[invalid-assignment] Object of type `dataclasses.Field[<class 'list'> | list[str]]` is not assignable to `list[str]`
- tests/test_pipeline_images.py:333:36: error[invalid-assignment] Object of type `dataclasses.Field[list[dict[str, str]] | <class 'list'>]` is not assignable to `list[dict[str, str]]`
+ tests/test_pipeline_images.py:333:36: error[invalid-assignment] Object of type `dataclasses.Field[<class 'list'> | list[dict[str, str]]]` is not assignable to `list[dict[str, str]]`
- tests/test_pipeline_images.py:335:36: error[invalid-assignment] Object of type `dataclasses.Field[list[str] | <class 'list'>]` is not assignable to `list[str]`
+ tests/test_pipeline_images.py:335:36: error[invalid-assignment] Object of type `dataclasses.Field[<class 'list'> | list[str]]` is not assignable to `list[str]`
- tests/test_pipeline_images.py:336:43: error[invalid-assignment] Object of type `dataclasses.Field[list[dict[str, str]] | <class 'list'>]` is not assignable to `list[dict[str, str]]`
+ tests/test_pipeline_images.py:336:43: error[invalid-assignment] Object of type `dataclasses.Field[<class 'list'> | list[dict[str, str]]]` is not assignable to `list[dict[str, str]]`

paasta (https://github.com/yelp/paasta)
- paasta_tools/instance/kubernetes.py:381:17: warning[possibly-missing-attribute] Attribute `append` may be missing on object of type `Unknown | str | int | list[Unknown]`
- paasta_tools/kubernetes_tools.py:3177:17: warning[possibly-missing-attribute] Attribute `extend` may be missing on object of type `Unknown | list[Unknown] | str`
- paasta_tools/setup_kubernetes_cr.py:307: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:307:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- paasta_tools/setup_kubernetes_cr.py:311: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:311:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- paasta_tools/setup_kubernetes_cr.py:314: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:314:9: 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["annotations"]` 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/setup_kubernetes_cr.py:321: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:321:5: error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- paasta_tools/utils.py:609:17: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[DockerParameter]`, found `list[Unknown | dict[Unknown | str, Unknown | str]]`
+ paasta_tools/utils.py:609:17: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[DockerParameter]`, found `list[DockerParameter | dict[Unknown | str, Unknown | str]]`
- paasta_tools/utils.py:617:35: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[DockerParameter]`, found `list[Unknown | dict[Unknown | str, Unknown | str]]`
+ paasta_tools/utils.py:617:35: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[DockerParameter]`, found `list[DockerParameter | dict[Unknown | str, Unknown | str]]`
- paasta_tools/utils.py:630:16: error[invalid-return-type] Return type does not match returned value: expected `Iterable[DockerParameter]`, found `list[Unknown | dict[Unknown | str, Unknown | str]]`
+ paasta_tools/utils.py:630:16: error[invalid-return-type] Return type does not match returned value: expected `Iterable[DockerParameter]`, found `list[DockerParameter | dict[Unknown | str, Unknown | str]]`
- Found 1101 diagnostics
+ Found 1083 diagnostics

graphql-core (https://github.com/graphql-python/graphql-core)
- src/graphql/execution/execute.py:1676:21: error[invalid-assignment] Object of type `BoxedAwaitableOrValue[CoroutineType[Any, Any, ReconcilableDeferredGroupedFieldSetResult | NonReconcilableDeferredGroupedFieldSetResult]]` is not assignable to attribute `result` of type `BoxedAwaitableOrValue[ReconcilableDeferredGroupedFieldSetResult | NonReconcilableDeferredGroupedFieldSetResult] | (() -> BoxedAwaitableOrValue[ReconcilableDeferredGroupedFieldSetResult | NonReconcilableDeferredGroupedFieldSetResult])`
+ src/graphql/execution/execute.py:1676:21: error[invalid-assignment] Object of type `BoxedAwaitableOrValue[ReconcilableDeferredGroupedFieldSetResult | NonReconcilableDeferredGroupedFieldSetResult | CoroutineType[Any, Any, ReconcilableDeferredGroupedFieldSetResult | NonReconcilableDeferredGroupedFieldSetResult]]` is not assignable to attribute `result` of type `BoxedAwaitableOrValue[ReconcilableDeferredGroupedFieldSetResult | NonReconcilableDeferredGroupedFieldSetResult] | (() -> BoxedAwaitableOrValue[ReconcilableDeferredGroupedFieldSetResult | NonReconcilableDeferredGroupedFieldSetResult])`
- src/graphql/execution/execute.py:1828:32: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `BoxedAwaitableOrValue[StreamItemResult] | (() -> BoxedAwaitableOrValue[StreamItemResult])`, found `BoxedAwaitableOrValue[CoroutineType[Any, Any, StreamItemResult]]`
+ src/graphql/execution/execute.py:1828:32: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `BoxedAwaitableOrValue[StreamItemResult] | (() -> BoxedAwaitableOrValue[StreamItemResult])`, found `BoxedAwaitableOrValue[StreamItemResult | CoroutineType[Any, Any, StreamItemResult]]`

dulwich (https://github.com/dulwich/dulwich)
- dulwich/contrib/swift.py:158:35: error[invalid-argument-type] Argument to bound method `add_todo` is incorrect: Expected `Iterable[tuple[ObjectID, bytes | None, int | None, bool]]`, found `list[Unknown | tuple[Unknown | bytes, None, None, bool]]`
+ dulwich/contrib/swift.py:158:35: error[invalid-argument-type] Argument to bound method `add_todo` is incorrect: Expected `Iterable[tuple[ObjectID, bytes | None, int | None, bool]]`, found `list[tuple[ObjectID, bytes | None, int | None, bool] | tuple[Unknown | bytes, None, None, bool]]`
- dulwich/contrib/swift.py:891:13: error[invalid-argument-type] Argument to bound method `add_objects` is incorrect: Expected `Sequence[tuple[ShaFile, str | None]]`, found `list[Unknown | tuple[object, None]]`
+ dulwich/contrib/swift.py:891:13: error[invalid-argument-type] Argument to bound method `add_objects` is incorrect: Expected `Sequence[tuple[ShaFile, str | None]]`, found `list[tuple[ShaFile, str | None] | tuple[object, None]]`
- dulwich/diff_tree.py:421:26: error[invalid-argument-type] Argument to function `_all_eq` is incorrect: Expected `(Unknown, /) -> Literal["delete"]`, found `def change_type(c: TreeChange) -> str`
+ dulwich/diff_tree.py:421:26: error[invalid-argument-type] Argument to function `_all_eq` is incorrect: Expected `(TreeChange | Unknown, /) -> Literal["delete"]`, found `def change_type(c: TreeChange) -> str`
- dulwich/object_store.py:2641:63: error[invalid-argument-type] Argument to function `_split_commits_and_tags` is incorrect: Expected `Iterable[ObjectID]`, found `list[Unknown | bytes]`
+ dulwich/object_store.py:2641:63: error[invalid-argument-type] Argument to function `_split_commits_and_tags` is incorrect: Expected `Iterable[ObjectID]`, found `list[bytes | Unknown]`
- dulwich/object_store.py:2812:31: error[invalid-argument-type] Argument to bound method `add_todo` is incorrect: Expected `Iterable[tuple[ObjectID, bytes | None, int | None, bool]]`, found `list[Unknown | tuple[Unknown | bytes, None, Unknown | int, bool]]`
+ dulwich/object_store.py:2812:31: error[invalid-argument-type] Argument to bound method `add_todo` is incorrect: Expected `Iterable[tuple[ObjectID, bytes | None, int | None, bool]]`, found `list[tuple[ObjectID, bytes | None, int | None, bool] | tuple[Unknown | bytes, None, Unknown | int, bool]]`
- dulwich/walk.py:332:23: error[invalid-assignment] Object of type `list[Unknown | ObjectID | (Sequence[ObjectID] & bytes)]` is not assignable to `ObjectID | Sequence[ObjectID]`
+ dulwich/walk.py:332:23: error[invalid-assignment] Object of type `list[ObjectID | (Sequence[ObjectID] & bytes)]` is not assignable to `ObjectID | Sequence[ObjectID]`

ignite (https://github.com/pytorch/ignite)
- tests/ignite/metrics/nlp/test_bleu.py:26:29: error[invalid-argument-type] Argument to bound method `_corpus_bleu` is incorrect: Expected `Sequence[Sequence[Sequence[Any]]]`, found `list[Unknown | list[Unknown | int]]`
+ tests/ignite/metrics/nlp/test_bleu.py:26:29: error[invalid-argument-type] Argument to bound method `_corpus_bleu` is incorrect: Expected `Sequence[Sequence[Sequence[Any]]]`, found `list[Sequence[Sequence[Any]] | list[Sequence[Any] | int]]`

mkosi (https://github.com/systemd/mkosi)
- mkosi/__init__.py:2528:17: error[invalid-argument-type] Argument to bound method `sandbox` is incorrect: Expected `Sequence[Path | str]`, found `list[Unknown | str | None | Path]`
+ mkosi/__init__.py:2528:17: error[invalid-argument-type] Argument to bound method `sandbox` is incorrect: Expected `Sequence[Path | str]`, found `list[Path | str | Unknown | None]`
- mkosi/__init__.py:4345:9: error[invalid-argument-type] Argument to function `run` is incorrect: Expected `Sequence[Path | str]`, found `list[Unknown | Path | None | str]`
+ mkosi/__init__.py:4345:9: error[invalid-argument-type] Argument to function `run` is incorrect: Expected `Sequence[Path | str]`, found `list[Path | str | None]`
+ mkosi/__init__.py:4369:16: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `nullcontext[None]`, found `nullcontext[Popen[str] | None]`
+ mkosi/__init__.py:4372:16: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `nullcontext[None]`, found `nullcontext[Popen[str] | None]`
+ mkosi/__init__.py:4378:16: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `nullcontext[None]`, found `nullcontext[Popen[str] | None]`
+ mkosi/__init__.py:4384:16: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `nullcontext[None]`, found `nullcontext[Popen[str] | None]`
- Found 96 diagnostics
+ Found 100 diagnostics

pybind11 (https://github.com/pybind/pybind11)
- tests/test_pytypes.py:457:31: error[invalid-argument-type] Argument to class `tuple` is incorrect: Expected `Iterable[object]`, found `Unknown | bytes | bytearray | ... omitted 5 union elements`
+ tests/test_pytypes.py:457:31: error[invalid-argument-type] Argument to class `tuple` is incorrect: Expected `Iterable[Unknown]`, found `Unknown | bytes | bytearray | ... omitted 5 union elements`

PyGithub (https://github.com/PyGithub/PyGithub)
- github/RepositoryAdvisory.py:153:13: error[invalid-argument-type] Argument to bound method `add_vulnerabilities` is incorrect: Expected `Iterable[SimpleAdvisoryVulnerability | AdvisoryVulnerability]`, found `list[Unknown | dict[Unknown | str, Unknown | dict[Unknown | str, Unknown | str | None] | str | None | list[str]]]`
- github/RepositoryAdvisory.py:199:28: error[invalid-argument-type] Argument to bound method `offer_credits` is incorrect: Expected `Iterable[SimpleCredit | AdvisoryCredit]`, found `list[Unknown | dict[Unknown | str, Unknown | str | NamedUser]]`
- tests/RepositoryAdvisory.py:141:13: error[invalid-argument-type] Argument to bound method `offer_credits` is incorrect: Expected `Iterable[SimpleCredit | AdvisoryCredit]`, found `list[Unknown | dict[Unknown | str, Unknown | str]]`
- Found 354 diagnostics
+ Found 351 diagnostics

urllib3 (https://github.com/urllib3/urllib3)
+ test/with_dummyserver/test_https.py:760:21: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `nullcontext[None]`, found `nullcontext[object]`
- Found 264 diagnostics
+ Found 265 diagnostics

mitmproxy (https://github.com/mitmproxy/mitmproxy)
- test/mitmproxy/test_http.py:588:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[tuple[bytes, bytes]]`, found `list[Unknown | list[Unknown | bytes]]`
+ test/mitmproxy/test_http.py:588:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[tuple[bytes, bytes]]`, found `list[tuple[bytes, bytes] | list[Unknown | bytes]]`
- test/mitmproxy/test_http.py:821:21: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[tuple[bytes, bytes]]`, found `list[Unknown | tuple[bytes, str]]`
+ test/mitmproxy/test_http.py:821:21: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[tuple[bytes, bytes]]`, found `list[tuple[bytes, bytes] | tuple[bytes, str]]`

pandera (https://github.com/pandera-dev/pandera)
+ pandera/backends/polars/base.py:143:13: error[invalid-argument-type] Method `__getitem__` of type `bound method defaultdict[str, int].__getitem__(key: str, /) -> int` cannot be called with key of type `Unknown | None` on object of type `defaultdict[str, int]`
- tests/mypy/pandas_modules/pandas_dataframe.py:35:12: error[no-matching-overload] No overload of bound method `pipe` matches arguments
- tests/mypy/pandas_modules/pandas_dataframe.py:41:12: error[invalid-return-type] Return type does not match returned value: expected `DataFrame[SchemaOut]`, found `DataFrame[SchemaOut] | DataFrame[Schema]`
+ tests/mypy/pandas_modules/pandas_dataframe.py:41:12: error[invalid-return-type] Return type does not match returned value: expected `DataFrame[SchemaOut]`, found `DataFrame[Schema] | DataFrame[SchemaOut]`
- tests/pandas/test_dtypes.py:169:43: error[invalid-assignment] Object of type `list[tuple[dict[Unknown, Unknown], list[Unknown]] | tuple[dict[Unknown | <class 'datetime'> | <class 'datetime64'> | ... omitted 4 union elements, Unknown | str], Series[pandas._libs.tslibs.timestamps.Timestamp]] | tuple[dict[Unknown | PeriodDtype, Unknown | str], Series[Period]] | tuple[dict[Unknown | <class 'SparseDtype'> | SparseDtype, Unknown | SparseDtype], Series[list[Unknown | int | None]]] | tuple[dict[Unknown | IntervalDtype, Unknown | str], Series[Interval[int | float]]]]` is not assignable to `list[tuple[dict[Unknown, Unknown], list[Unknown]]]`
+ tests/pandas/test_dtypes.py:169:43: error[invalid-assignment] Object of type `list[tuple[dict[Unknown, Unknown], list[Unknown]] | tuple[dict[Unknown | <class 'datetime'> | <class 'datetime64'> | ... omitted 4 union elements, Unknown | str], Series[pandas._libs.tslibs.timestamps.Timestamp]] | tuple[dict[Unknown | PeriodDtype, Unknown | str], Series[Period]] | tuple[dict[Unknown | <class 'SparseDtype'> | SparseDtype, Unknown | SparseDtype], Series[list[Unknown | int | None] & list[int | integer[Any] | None] & list[int | numpy.bool[builtins.bool] | None] & list[BaseOffset | int | None] & list[str | int | None] & list[list[str] | int | None] & list[int | None]]] | tuple[dict[Unknown | IntervalDtype, Unknown | str], Series[Interval[int | float]]]]` is not assignable to `list[tuple[dict[Unknown, Unknown], list[Unknown]]]`

koda-validate (https://github.com/keithasaurus/koda-validate)
- koda_validate/dictionary.py:60:20: error[invalid-return-type] Return type does not match returned value: expected `Valid[Just[A@KeyNotRequired] | Nothing] | Invalid`, found `Valid[Just[Unknown | A@KeyNotRequired]]`
- koda_validate/dictionary.py:67:20: error[invalid-return-type] Return type does not match returned value: expected `Valid[Just[A@KeyNotRequired] | Nothing] | Invalid`, found `Valid[Just[Unknown | A@KeyNotRequired]]`
- Found 400 diagnostics
+ Found 398 diagnostics

optuna (https://github.com/optuna/optuna)
- optuna/study/study.py:496:13: error[invalid-argument-type] Argument to function `_optimize` is incorrect: Expected `tuple[type[Exception], ...]`, found `tuple[object, ...]`
+ optuna/study/study.py:496:25: error[invalid-argument-type] Argument to class `tuple` is incorrect: Expected `Iterable[type[Exception]]`, found `Iterable[type[Exception]] | (type[Exception] & Iterable[object])`

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/commands/slash.py:1779:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[(...) -> Coroutine[Any, Any, Any] | Any]`, found `Sequence[(...) -> Coroutine[Any, Any, Any] | Any] | (((...) -> Coroutine[Any, Any, Any] | Any) & Sequence[object])`
- tanjun/context/menu.py:57:96: error[invalid-assignment] Object of type `frozenset[CommandType | Unknown]` is not assignable to `frozenset[Literal[CommandType.USER, CommandType.MESSAGE]]`

freqtrade (https://github.com/freqtrade/freqtrade)
- freqtrade/optimize/analysis/lookahead.py:48:13: error[invalid-argument-type] Argument to bound method `backtest` is incorrect: Expected `dict[Unknown, Unknown]`, found `dict[Unknown, Unknown] | DataFrame`
+ freqtrade/optimize/analysis/lookahead.py:48:13: error[invalid-argument-type] Argument to bound method `backtest` is incorrect: Expected `dict[Unknown, Unknown]`, found `DataFrame | dict[Unknown, Unknown]`

build (https://github.com/pypa/build)
- tests/test_main.py:270:58: error[invalid-argument-type] Argument to function `build_package` is incorrect: Expected `Sequence[Literal["sdist", "wheel", "editable"]]`, found `list[Unknown | str]`
- tests/test_main.py:285:58: error[invalid-argument-type] Argument to function `build_package` is incorrect: Expected `Sequence[Literal["sdist", "wheel", "editable"]]`, found `list[Unknown | str]`
- tests/test_main.py:302:58: error[invalid-argument-type] Argument to function `build_package` is incorrect: Expected `Sequence[Literal["sdist", "wheel", "editable"]]`, found `list[Unknown | str]`
- tests/test_main.py:330:62: error[invalid-argument-type] Argument to function `build_package` is incorrect: Expected `Sequence[Literal["sdist", "wheel", "editable"]]`, found `list[Unknown | str]`
- tests/test_main.py:340:62: error[invalid-argument-type] Argument to function `build_package` is incorrect: Expected `Sequence[Literal["sdist", "wheel", "editable"]]`, found `list[Unknown | str]`
- tests/test_main.py:346:68: error[invalid-argument-type] Argument to function `build_package` is incorrect: Expected `Sequence[Literal["sdist", "wheel", "editable"]]`, found `list[Unknown | str]`
- tests/test_main.py:357:78: error[invalid-argument-type] Argument to function `build_package_via_sdist` is incorrect: Expected `Sequence[Literal["sdist", "wheel", "editable"]]`, found `list[Unknown | str]`
- tests/test_main.py:368:92: error[invalid-argument-type] Argument to function `build_package_via_sdist` is incorrect: Expected `Sequence[Literal["sdist", "wheel", "editable"]]`, found `list[Unknown | str]`
- tests/test_main.py:373:82: error[invalid-argument-type] Argument to function `build_package_via_sdist` is incorrect: Expected `Sequence[Literal["sdist", "wheel", "editable"]]`, found `list[Unknown | str]`
- Found 56 diagnostics
+ Found 47 diagnostics

mypy (https://github.com/python/mypy)
- mypyc/irbuild/util.py:35:44: error[invalid-assignment] Object of type `frozenset[str | Unknown]` is not assignable to `frozenset[Literal["native_class", "allow_interpreted_subclasses", "serializable", "free_list_len"]]`
- Found 1783 diagnostics
+ Found 1782 diagnostics

meson (https://github.com/mesonbuild/meson)
+ mesonbuild/backend/ninjabackend.py:1692:37: error[unresolved-attribute] Object of type `File` has no attribute `name`
+ mesonbuild/backend/ninjabackend.py:1695:17: error[invalid-assignment] Invalid subscript assignment with key of type `Unknown` and value of type `CustomTarget | CustomTargetIndex | GeneratedList` on object of type `OrderedDict[str, File]`
- mesonbuild/build.py:1295:9: error[invalid-assignment] Object of type `list[Sequence[str | bool] | Literal[False]]` is not assignable to attribute `install_dir` of type `list[str | Literal[False]]`
+ mesonbuild/build.py:1295:9: error[invalid-assignment] Object of type `list[str | Literal[False] | list[str | Literal[False]]]` is not assignable to attribute `install_dir` of type `list[str | Literal[False]]`
+ mesonbuild/mconf.py:290:17: error[invalid-argument-type] Method `__getitem__` of type `bound method defaultdict[str, dict[OptionKey, UserBooleanOption | UserComboOption | UserIntegerOption | ... omitted 3 union elements]].__getitem__(key: str, /) -> dict[OptionKey, UserBooleanOption | UserComboOption | UserIntegerOption | ... omitted 3 union elements]` cannot be called with key of type `Unknown | str | None` on object of type `defaultdict[str, dict[OptionKey, UserBooleanOption | UserComboOption | UserIntegerOption | ... omitted 3 union elements]]`
- mesonbuild/modules/codegen.py:317:26: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[Literal["lex", "flex", "reflex", "win_flex"]]`, found `list[Unknown | str]`
- mesonbuild/modules/codegen.py:398:55: error[invalid-assignment] Object of type `dict[Unknown | str, Unknown | list[str]]` is not assignable to `Mapping[Literal["yacc", "byacc", "bison", "win_bison"], list[str]]`
- mesonbuild/modules/i18n.py:425:17: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[str | BuildTarget | CustomTarget | ... omitted 4 union elements]`, found `list[Unknown | ExternalProgram | Executable | None | str]`
+ mesonbuild/modules/i18n.py:425:17: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[str | BuildTarget | CustomTarget | ... omitted 4 union elements]`, found `list[str | BuildTarget | CustomTarget | ... omitted 5 union elements]`
- mesonbuild/modules/rust.py:478:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[str | File | BuildTarget | ... omitted 5 union elements]`, found `list[Unknown | File | CustomTarget | ... omitted 5 union elements]`
+ mesonbuild/modules/rust.py:478:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[str | File | BuildTarget | ... omitted 5 union elements]`, found `list[str | File | BuildTarget | ... omitted 7 union elements]`
- mesonbuild/mparser.py:671:47: error[invalid-assignment] Object of type `dict[Unknown | str, Unknown | str]` is not assignable to `Mapping[str, Literal["==", "!=", "<", "<=", ">=", ... omitted 3 literals]]`

trio (https://github.com/python-trio/trio)
- src/trio/_channel.py:250:16: error[invalid-argument-type] Argument to bound method `_create` is incorrect: Expected `<class 'MemorySendChannel[SendType@MemorySendChannel]'>`, found `<class 'MemorySendChannel'>`
+ src/trio/_channel.py:250:16: error[invalid-argument-type] Argument to bound method `_create` is incorrect: Expected `<class 'MemorySendChannel[Unknown]'>`, found `<class 'MemorySendChannel'>`
- src/trio/_channel.py:402:16: error[invalid-argument-type] Argument to bound method `_create` is incorrect: Expected `<class 'MemoryReceiveChannel[ReceiveType@MemoryReceiveChannel]'>`, found `<class 'MemoryReceiveChannel'>`
+ src/trio/_channel.py:402:16: error[invalid-argument-type] Argument to bound method `_create` is incorrect: Expected `<class 'MemoryReceiveChannel[Unknown]'>`, found `<class 'MemoryReceiveChannel'>`

apprise (https://github.com/caronc/apprise)
- apprise/plugins/fortysixelks.py:161:23: error[invalid-assignment] Object of type `list[Unknown | (str & ~Literal[""]) | None]` is not assignable to `Iterable[str] | None`
+ apprise/plugins/fortysixelks.py:161:23: error[invalid-assignment] Object of type `list[str | None]` is not assignable to `Iterable[str] | None`

cloud-init (https://github.com/canonical/cloud-init)
- 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[Mapping[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[Mapping[Unknown, Unknown] | Unknown | str | None]`
- cloudinit/sources/helpers/aliyun.py:174:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- cloudinit/sources/helpers/aliyun.py:202:9: error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- cloudinit/sources/helpers/aliyun.py:205:12: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | int | dict[Unknown, Unknown]`
- cloudinit/sources/helpers/aliyun.py:206:25: warning[possibly-missing-attribute] Attribute `keys` may be missing on object of type `Unknown | int | dict[Unknown, Unknown]`
- cloudinit/sources/helpers/aliyun.py:207:13: error[non-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- cloudinit/sources/helpers/aliyun.py:208:13: error[non-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- cloudinit/sources/helpers/aliyun.py:209:13: error[non-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- cloudinit/sources/helpers/aliyun.py:210:13: error[non-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
+ tests/unittests/sources/test_lxd.py:40:5: error[non-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- tests/unittests/test_ds_identify.py:1034:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["etc/cloud/ds-identify.cfg"]` and value of type `str` on object of type `list[Unknown | dict[Unknown | str, Unknown | str | int]]`
+ tests/unittests/test_ds_identify.py:1034:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["etc/cloud/ds-identify.cfg"]` and value of type `LiteralString` on object of type `list[Unknown | dict[Unknown | str, Unknown | str | int]]`
- tests/unittests/test_ds_identify.py:1034:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["etc/cloud/ds-identify.cfg"]` and value of type `str` on object of type `list[Unknown | str]`
+ tests/unittests/test_ds_identify.py:1034:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["etc/cloud/ds-identify.cfg"]` and value of type `LiteralString` on object of type `list[Unknown | str]`
+ tests/unittests/test_net.py:5345:41: warning[possibly-missing-attribute] Attribute `keys` may be missing on object of type `Unknown | list[Unknown | str] | dict[Unknown | str, Unknown | str | None] | dict[Unknown, Unknown]`
+ tests/unittests/test_net.py:5502:41: warning[possibly-missing-attribute] Attribute `keys` may be missing on object of type `Unknown | list[Unknown | str] | dict[Unknown | str, Unknown | str | None] | dict[Unknown | str, Unknown | str]`
- Found 1179 diagnostics
+ Found 1174 diagnostics

vision (https://github.com/pytorch/vision)
- test/test_transforms_v2.py:3700:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | Sequence[int] | None`, found `list[Unknown | int | float]`
+ test/test_transforms_v2.py:3700:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | Sequence[int] | None`, found `list[int | float] & list[Unknown | int | float]`
- test/test_transforms_v2.py:3706:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | Sequence[int] | None`, found `list[Unknown | float]`
+ test/test_transforms_v2.py:3706:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | Sequence[int] | None`, found `list[int | float] & list[Unknown | float]`
- test/test_transforms_v2.py:4721:28: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | Sequence[int]`, found `list[Unknown | int | float]`
+ test/test_transforms_v2.py:4721:28: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | Sequence[int]`, found `list[int | float] & list[Unknown | int | float]`
- test/test_transforms_v2.py:4727:28: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | Sequence[int]`, found `list[Unknown | float]`
+ test/test_transforms_v2.py:4727:28: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | Sequence[int]`, found `list[int | float] & list[Unknown | float]`
- torchvision/ops/poolers.py:283:34: error[invalid-argument-type] Argument to class `tuple` is incorrect: Expected `Iterable[object]`, found `tuple[int] | list[int] | int`
+ torchvision/ops/poolers.py:283:34: error[invalid-argument-type] Argument to class `tuple` is incorrect: Expected `Iterable[Unknown]`, found `tuple[int] | list[int] | int`
- torchvision/prototype/utils/_internal.py:34:82: error[invalid-argument-type] Argument is incorrect: Expected `Sequence[str]`, found `(Collection[str] & Sequence[object]) | list[Unknown]`
+ torchvision/prototype/utils/_internal.py:34:82: error[invalid-argument-type] Argument is incorrect: Expected `Sequence[str]`, found `Collection[str] & Sequence[object]`

zope.interface (https://github.com/zopefoundation/zope.interface)
- src/zope/interface/__init__.py:88:46: error[invalid-argument-type] Argument to class `tuple` is incorrect: Expected `Iterable[object]`, found `<class 'IInterfaceDeclaration'>`
+ src/zope/interface/__init__.py:88:46: error[invalid-argument-type] Argument to class `tuple` is incorrect: Expected `Iterable[Unknown]`, found `<class 'IInterfaceDeclaration'>`

discord.py (https://github.com/Rapptz/discord.py)
- discord/interactions.py:229:58: error[invalid-argument-type] Argument to bound method `_from_value` is incorrect: Expected `Sequence[Literal[0, 1, 2]]`, found `list[Unknown | int]`
- Found 566 diagnostics
+ Found 565 diagnostics

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- pymongo/asynchronous/auth.py:365:69: error[invalid-assignment] Object of type `dict[Unknown | str, Unknown | ((credentials: @Todo, conn: AsyncConnection) -> CoroutineType[Any, Any, None]) | ((credentials: @Todo, conn: AsyncConnection, reauthenticate: bool) -> CoroutineType[Any, Any, Mapping[str, Any] | None]) | partial[Unknown]]` is not assignable to `Mapping[str, (...) -> Coroutine[Any, Any, None]]`
+ pymongo/asynchronous/auth.py:365:69: error[invalid-assignment] Object of type `dict[str, ((...) -> Coroutine[Any, Any, None]) | ((credentials: @Todo, conn: AsyncConnection, reauthenticate: bool) -> CoroutineType[Any, Any, Mapping[str, Any] | None])]` is not assignable to `Mapping[str, (...) -> Coroutine[Any, Any, None]]`
- pymongo/helpers_shared.py:160:39: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- pymongo/synchronous/auth.py:360:48: error[invalid-assignment] Object of type `dict[Unknown | str, Unknown | ((credentials: @Todo, conn: Connection) -> None) | ((credentials: @Todo, conn: Connection, reauthenticate: bool) -> Mapping[str, Any] | None) | partial[Unknown]]` is not assignable to `Mapping[str, (...) -> None]`
+ pymongo/synchronous/auth.py:360:48: error[invalid-assignment] Object of type `dict[str, ((...) -> None) | ((credentials: @Todo, conn: Connection, reauthenticate: bool) -> Mapping[str, Any] | None)]` is not assignable to `Mapping[str, (...) -> None]`
- pymongo/synchronous/database.py:938:20: error[no-matching-overload] No overload of bound method `_command` matches arguments
- Found 458 diagnostics
+ Found 456 diagnostics

setuptools (https://github.com/pypa/setuptools)
- setuptools/_distutils/dist.py:74:12: error[invalid-return-type] Return type does not match returned value: expected `str | list[str]`, found `Iterable[str] | list[Unknown]`
+ setuptools/_distutils/dist.py:74:12: error[invalid-return-type] Return type does not match returned value: expected `str | list[str]`, found `Iterable[str]`
- setuptools/_vendor/inflect/__init__.py:3001:13: error[no-matching-overload] No overload of bound method `join` matches arguments
+ setuptools/glob.py:34:17: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[AnyStr@glob]`, found `Iterator[str]`
+ setuptools/glob.py:34:23: error[invalid-argument-type] Argument to function `iglob` is incorrect: Expected `str`, found `AnyStr@glob`
- Found 1262 diagnostics
+ Found 1263 diagnostics

cwltool (https://github.com/common-workflow-language/cwltool)
- cwltool/cwlviewer.py:56:40: error[invalid-argument-type] Argument to bound method `query` is incorrect: Expected `Mapping[str, Identifier] | None`, found `dict[Unknown | str, Unknown | str]`
+ cwltool/cwlviewer.py:56:40: error[invalid-argument-type] Argument to bound method `query` is incorrect: Expected `Mapping[str, Identifier] | None`, found `dict[str, str]`
- cwltool/cwlviewer.py:124:40: error[invalid-argument-type] Argument to bound method `query` is incorrect: Expected `Mapping[str, Identifier] | None`, found `dict[Unknown | str, Unknown | str]`
+ cwltool/cwlviewer.py:124:40: error[invalid-argument-type] Argument to bound method `query` is incorrect: Expected `Mapping[str, Identifier] | None`, found `dict[str, str]`
- cwltool/cwlviewer.py:155:35: error[invalid-argument-type] Argument to bound method `query` is incorrect: Expected `Mapping[str, Identifier] | None`, found `dict[Unknown | str, Unknown | str]`
+ cwltool/cwlviewer.py:155:35: error[invalid-argument-type] Argument to bound method `query` is incorrect: Expected `Mapping[str, Identifier] | None`, found `dict[str, str]`
- cwltool/main.py:301:42: error[invalid-argument-type] Argument to function `realize_input_schema` is incorrect: Expected `MutableSequence[str | MutableMapping[str, None | int | str | ... omitted 3 union elements]]`, found `list[Unknown | (int & Top[Mapping[Unknown, object]]) | (str & Top[Mapping[Unknown, object]]) | ... omitted 3 union elements]`
+ cwltool/main.py:301:42: error[invalid-argument-type] Argument to function `realize_input_schema` is incorrect: Expected `MutableSequence[str | MutableMapping[str, None | int | str | ... omitted 3 union elements]]`, found `list[str | MutableMapping[str, None | int | str | ... omitted 3 union elements] | (@Todo & Top[Mapping[Unknown, object]]) | ... omitted 4 union elements]`
- cwltool/main.py:477:33: warning[possibly-missing-attribute] Attribute `get` may be missing on object of type `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None | dict[Unknown | str, Unknown] | dict[Unknown, Unknown]`
+ cwltool/main.py:477:33: warning[possibly-missing-attribute] Attribute `get` may be missing on object of type `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None`
- cwltool/main.py:499:37: error[invalid-argument-type] Argument to bound method `_init_job` is incorrect: Expected `MutableMapping[str, None | int | str | ... omitted 3 union elements]`, found `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None | dict[Unknown | str, Unknown] | dict[Unknown, Unknown]`
+ cwltool/main.py:499:37: error[invalid-argument-type] Argument to bound method `_init_job` is incorrect: Expected `MutableMapping[str, None | int | str | ... omitted 3 union elements]`, found `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None`
- cwltool/main.py:502:43: error[invalid-argument-type] Argument to bound method `bind_input` is incorrect: Expected `MutableMapping[str, None | int | str | ... omitted 3 union elements] | list[MutableMapping[str, None | int | str | ... omitted 3 union elements]]`, found `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None | dict[Unknown | str, Unknown] | dict[Unknown, Unknown]`
+ cwltool/main.py:502:43: error[invalid-argument-type] Argument to bound method `bind_input` is incorrect: Expected `MutableMapping[str, None | int | str | ... omitted 3 union elements] | list[MutableMapping[str, None | int | str | ... omitted 3 union elements]]`, found `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None`
- cwltool/main.py:510:13: error[invalid-argument-type] Argument to function `printdeps` is incorrect: Expected `MutableMapping[str, None | int | str | ... omitted 3 union elements]`, found `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None | dict[Unknown | str, Unknown] | dict[Unknown, Unknown]`
+ cwltool/main.py:510:13: error[invalid-argument-type] Argument to function `printdeps` is incorrect: Expected `MutableMapping[str, None | int | str | ... omitted 3 union elements]`, found `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None`
- cwltool/main.py:523:13: error[invalid-argument-type] Argument to bound method `store` is incorrect: Expected `MutableMapping[str, None | int | str | ... omitted 3 union elements]`, found `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None | dict[Unknown | str, Unknown] | dict[Unknown, Unknown]`
+ cwltool/main.py:523:13: error[invalid-argument-type] Argument to bound method `store` is incorrect: Expected `MutableMapping[str, None | int | str | ... omitted 3 union elements]`, found `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None`
- cwltool/main.py:526:8: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["cwl:tool"]` and `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None | dict[Unknown | str, Unknown] | dict[Unknown, Unknown]`
+ cwltool/main.py:526:8: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["cwl:tool"]` and `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None`
- cwltool/main.py:528:8: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["__id"]` and `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None | dict[Unknown | str, Unknown] | dict[Unknown, Unknown]`
+ cwltool/main.py:528:8: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["__id"]` and `MutableMapping[str, None | int | str | ... omitted 3 union elements] | None`
- cwltool/main.py:530:12: error[invalid-return-type] Return type does not match returned value: expected `MutableMapping[str, None | int | str | ... omitted 3 union elements]`, found `MutableMapping[str, None | int | str 

... (truncated 705 lines) ...
Memory usage changes were detected when running on open source projects
sphinx (https://github.com/sphinx-doc/sphinx)
-     memo metadata = ~76MB
+     memo metadata = ~80MB

prefect (https://github.com/PrefectHQ/prefect)
-     memo metadata = ~159MB
+     memo metadata = ~167MB

@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 2, 2025

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 26 80 168
invalid-assignment 5 25 66
unsupported-operator 0 1 39
type-assertion-failure 0 13 21
invalid-return-type 1 4 14
possibly-missing-attribute 2 11 2
unresolved-attribute 14 0 0
no-matching-overload 7 5 0
unused-ignore-comment 5 6 0
non-subscriptable 1 4 0
not-iterable 0 2 0
unsupported-base 0 1 0
Total 61 152 310

Full report with detailed diff (timing results)

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 2, 2025

CodSpeed Performance Report

Merging #21747 will degrade performances by 7.79%

Comparing ibraheem/bidi-subtyping (19c5cd8) with main (2250fa6)

Summary

❌ 1 regression
✅ 21 untouched
⏩ 30 skipped1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Mode Benchmark BASE HEAD Change
WallTime medium[static-frame] 19.4 s 21.1 s -7.79%

Footnotes

  1. 30 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@ibraheemdev ibraheemdev force-pushed the ibraheem/bidi-subtyping branch 2 times, most recently from ceff10e to 83ba34d Compare December 2, 2025 22:00
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

nice, this looks great

Comment on lines +1055 to +1069
// TODO: We should use the constraint solver here to determine the type mappings for more
// complex subtyping relationships, e.g., `type[C[T]]` to `Callable[..., T]`, or unions
// containing multiple generic elements.
Copy link
Member

Choose a reason for hiding this comment

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

you could possibly also mention protocols here, since although this PR tackles simple cases where a nominal type actually subclasses a protocol, there are also lots of cases where a nominal type is a subtype of a protocol without actually subclassing that protocol

timestamp: datetime = field(default_factory=datetime.now, init=False)

# revealed: (self: Data, content: list[int] = list[int]) -> None
# revealed: (self: Data, content: list[int] = Unknown) -> None
Copy link
Member

Choose a reason for hiding this comment

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

any idea what's going on here?

Comment on lines +1077 to +1093
for (base_typevar, base_ty) in specialization
.generic_context(db)
.variables(db)
.zip(specialization.types(db))
{
if *base_ty == Type::TypeVar(bound_typevar) {
if !visited.insert((origin, base_typevar.identity(db))) {
return None;
}

if let Some(ty) =
self.find_type_var_from_impl(db, base_typevar, origin, visited)
{
return Some(ty);
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

we do a similar loop through the MRO in the (old) constraint solver which doesn't seem to need to do the FxHashSet memoization thing -- could you also take a similar approach here? Might that be more performant?

// Extract formal_alias if this is a generic class
let formal_alias = match formal {
Type::NominalInstance(formal_nominal) => {
formal_nominal.class(self.db).into_generic_alias()
}
// TODO: This will only handle classes that explicit implement a generic protocol
// by listing it as a base class. To handle classes that implicitly implement a
// generic protocol, we will need to check the types of the protocol members to be
// able to infer the specialization of the protocol that the class implements.
Type::ProtocolInstance(ProtocolInstanceType {
inner: Protocol::FromClass(class),
..
}) => class.into_generic_alias(),
_ => None,
};
if let Some(formal_alias) = formal_alias {
let formal_origin = formal_alias.origin(self.db);
for base in actual_nominal.class(self.db).iter_mro(self.db) {
let ClassBase::Class(ClassType::Generic(base_alias)) = base else {
continue;
};
if formal_origin != base_alias.origin(self.db) {
continue;
}
let generic_context = formal_alias
.specialization(self.db)
.generic_context(self.db)
.variables(self.db);
let formal_specialization =
formal_alias.specialization(self.db).types(self.db);
let base_specialization = base_alias.specialization(self.db).types(self.db);
for (typevar, formal_ty, base_ty) in itertools::izip!(
generic_context,
formal_specialization,
base_specialization
) {
let variance = typevar.variance_with_polarity(self.db, polarity);
self.infer_map_impl(*formal_ty, *base_ty, variance, &mut f)?;
}
return Ok(());
}
}
}

Comment on lines 6128 to 6134
// ```py
// class tuple:
// class tuple(Sequence[_T_co]):
// @overload
// def __new__(cls) -> tuple[()]: ...
// @overload
// def __new__(cls, iterable: Iterable[object]) -> tuple[object, ...]: ...
// def __new__(cls, iterable: Iterable[_T_co]) -> tuple[_T_co, ...]: ...
// ```
Copy link
Member

Choose a reason for hiding this comment

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

oops, sorry... I guess I baked this bug in a long time ago for you to find now :-)

@AlexWaygood
Copy link
Member

(this will also help with #21499, where I'm currently trying (not very successfully) to do some awkward workarounds due to this missing feature 😆)

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.

3 participants