[ty] Preserve inferred types for unknown class-decorator results - #28067
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 97.79%. The percentage of expected errors that received a diagnostic held steady at 94.33%. The number of fully passing files held steady at 112/136. |
Memory usage reportMemory usage unchanged ✅ |
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-type-form |
195 | 63 | 0 |
invalid-argument-type |
77 | 0 | 4 |
unresolved-attribute |
63 | 0 | 18 |
unsound-return-statement |
46 | 28 | 3 |
unsound-assignment |
22 | 7 | 0 |
invalid-base |
26 | 0 | 0 |
missing-argument |
17 | 0 | 0 |
unknown-argument |
16 | 0 | 0 |
unsupported-operator |
9 | 0 | 7 |
invalid-assignment |
7 | 0 | 7 |
no-matching-overload |
4 | 0 | 0 |
unsound-yield |
3 | 0 | 0 |
unsupported-base |
2 | 0 | 0 |
call-non-callable |
1 | 0 | 0 |
invalid-method-override |
1 | 0 | 0 |
invalid-return-type |
1 | 0 | 0 |
unused-ignore-comment |
0 | 1 | 0 |
unused-type-ignore-comment |
0 | 1 | 0 |
| Total | 490 | 100 | 39 |
Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.
Showing a random sample of 394 of 629 changes. See the HTML report for the full diff.
Raw diff sample (394 of 629 changes)
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ tests/contrib/ray/jobs/actor_without_init.py:18:15 error[unresolved-attribute] Class `Counter` has no attribute `remote`
+ tests/contrib/ray/test_ray.py:139:25 error[unresolved-attribute] Class `Counter` has no attribute `remote`
+ tests/contrib/ray/test_ray.py:188:29 error[unresolved-attribute] Class `IgnoredCounter` has no attribute `remote`
+ tests/contrib/ray/test_ray.py:282:19 error[unresolved-attribute] Class `ComputationManager` has no attribute `remote`
+ tests/contrib/ray/test_ray.py:319:22 error[unresolved-attribute] Class `Sender` has no attribute `remote`
+ tests/contrib/ray/test_ray.py:320:24 error[unresolved-attribute] Class `Receiver` has no attribute `remote`
+ tests/contrib/ray/test_ray.py:402:29 error[unresolved-attribute] Class `Counter` has no attribute `remote`
+ tests/contrib/ray_serve/test_ray_serve.py:142:21 error[unresolved-attribute] Class `Ingress` has no attribute `bind`
+ tests/contrib/ray_serve/test_ray_serve.py:180:19 error[unresolved-attribute] Class `TraceIDDeployment` has no attribute `bind`
mypy (https://github.com/python/mypy)
- mypy/typeshed/stdlib/typing.pyi:1063:77 warning[unused-ignore-comment] Unused `ty: ignore` directive
+ mypy/typeshed/stdlib/typing.pyi:157:14 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:314:15 error[invalid-type-form] Invalid subscript of object of type `_SpecialForm` in a type expression
+ mypy/typeshed/stdlib/typing.pyi:326:15 error[invalid-type-form] Invalid subscript of object of type `_SpecialForm` in a type expression
+ mypy/typeshed/stdlib/typing.pyi:400:31 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:400:38 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:407:20 error[invalid-argument-type] Argument to `TypeVar.__init__` is incorrect: Expected `Any | None`, found `object`
+ mypy/typeshed/stdlib/typing.pyi:411:28 error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: Any) -> object` cannot be called with key of type `tuple[EllipsisType, <class 'Any'>]` on object of type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:420:22 error[invalid-argument-type] Argument to `TypeVar.__init__` is incorrect: Expected `Any | None`, found `<special-form 'type[object]'>`
+ mypy/typeshed/stdlib/typing.pyi:422:20 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:423:24 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:423:31 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:427:65 error[invalid-type-form] Invalid subscript of object of type `_SpecialForm` in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:433:42 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:463:33 error[invalid-argument-type] Argument to `TypeVar.__init__` is incorrect: Expected `Any`, found `<class 'bytes'>`
+ mypy/typeshed/stdlib/typing.pyi:481:28 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:484:19 error[invalid-base] Invalid class base with type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:490:21 error[invalid-base] Invalid class base with type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:508:21 error[invalid-base] Invalid class base with type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:514:19 error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: Any) -> object` cannot be called with key of type `TypeVar` on object of type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:517:26 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:520:21 error[invalid-base] Invalid class base with type `object`
+ mypy/typeshed/stdlib/typing.pyi:520:21 error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: Any) -> object` cannot be called with key of type `TypeVar` on object of type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:531:13 error[invalid-base] Invalid class base with type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:544:16 error[invalid-base] Invalid class base with type `object`
+ mypy/typeshed/stdlib/typing.pyi:544:16 error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: Any) -> object` cannot be called with key of type `TypeVar` on object of type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:546:27 error[invalid-type-form] Non-generic class `Iterator` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:549:33 error[invalid-base] Invalid class base with type `object`
+ mypy/typeshed/stdlib/typing.pyi:549:33 error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: Any) -> object` cannot be called with key of type `TypeVar` on object of type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:551:27 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:552:27 error[invalid-type-form] Non-generic class `Iterator` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:555:35 error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: Any) -> object` cannot be called with key of type `TypeVar` on object of type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:557:31 error[invalid-type-form] Non-generic class `Iterator` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:561:54 error[unknown-argument] Argument `default` does not match any known parameter of `TypeVar.__init__`
+ mypy/typeshed/stdlib/typing.pyi:564:39 error[invalid-base] Invalid class base with type `object`
+ mypy/typeshed/stdlib/typing.pyi:565:27 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:567:48 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:576:98 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:592:49 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a type expression
+ mypy/typeshed/stdlib/typing.pyi:592:70 error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: Any) -> object` cannot be called with key of type `TypeVar` on object of type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:595:59 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a type expression
+ mypy/typeshed/stdlib/typing.pyi:595:80 error[invalid-base] Invalid class base with type `object`
+ mypy/typeshed/stdlib/typing.pyi:595:80 error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: Any) -> object` cannot be called with key of type `TypeVar` on object of type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:598:17 error[invalid-base] Invalid class base with type `object`
+ mypy/typeshed/stdlib/typing.pyi:598:17 error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: Any) -> object` cannot be called with key of type `TypeVar` on object of type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:600:28 error[invalid-type-form] Non-generic class `Generator` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:606:44 error[invalid-base] Invalid class base with type `_Final`
+ mypy/typeshed/stdlib/typing.pyi:611:27 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:617:10 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:620:98 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:632:5 error[invalid-base] Invalid class base with type `_Final`
+ mypy/typeshed/stdlib/typing.pyi:637:21 error[invalid-base] Invalid class base with type `object`
+ mypy/typeshed/stdlib/typing.pyi:637:21 error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: Any) -> object` cannot be called with key of type `TypeVar` on object of type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:642:43 error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: Any) -> object` cannot be called with key of type `TypeVar` on object of type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:644:28 error[invalid-type-form] Non-generic class `Awaitable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:645:28 error[invalid-type-form] Non-generic class `AsyncIterator` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:648:49 error[invalid-base] Invalid class base with type `object`
+ mypy/typeshed/stdlib/typing.pyi:667:17 error[invalid-base] Invalid class base with type `object`
+ mypy/typeshed/stdlib/typing.pyi:673:53 error[invalid-base] Invalid class base with type `object`
+ mypy/typeshed/stdlib/typing.pyi:691:31 error[invalid-type-form] Non-generic class `Iterator` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:695:41 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:699:45 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:706:46 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:709:60 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:719:29 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:721:30 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:723:42 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:724:29 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:725:32 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:747:26 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:749:30 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:764:48 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a type expression
+ mypy/typeshed/stdlib/typing.pyi:768:30 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:768:61 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:771:27 error[invalid-type-form] Non-generic class `Iterator` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:772:29 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:772:59 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:773:30 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:773:78 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:774:30 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:774:69 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:776:30 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:776:68 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:777:31 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:777:61 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:780:42 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:782:57 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:783:30 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:784:31 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:787:29 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:787:53 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:787:62 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:788:30 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:788:54 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:789:30 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:789:55 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:790:31 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:791:30 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:791:54 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:791:63 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:792:55 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:792:64 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:795:62 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:797:27 error[invalid-type-form] Non-generic class `Iterator` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:804:32 error[invalid-base] Invalid class base with type `_Final`
+ mypy/typeshed/stdlib/typing.pyi:808:43 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:812:24 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:814:52 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:816:38 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:826:32 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:832:24 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:836:24 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:836:38 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:838:37 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:849:31 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:849:45 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:849:56 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:872:48 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:874:43 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:874:80 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:874:99 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:876:40 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:876:45 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:878:43 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:878:52 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:878:72 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:880:43 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:880:62 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:911:39 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:915:47 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:917:52 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:941:33 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:944:27 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
+ mypy/typeshed/stdlib/typing.pyi:946:27 error[invalid-type-form] Non-generic class `Iterator` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:981:7 error[invalid-type-form] Invalid subscript of object of type `_SpecialForm` in a type alias value
+ mypy/typeshed/stdlib/typing.pyi:981:7 error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: Any) -> object` cannot be called with key of type `tuple[EllipsisType, <class 'Any'>]` on object of type `_SpecialForm`
+ mypy/typeshed/stdlib/typing.pyi:1003:14 error[invalid-type-form] Variable of type `object` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:1021:20 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:1047:22 error[invalid-type-form] Invalid subscript of object of type `_SpecialForm` in a type expression
+ mypy/typeshed/stdlib/typing.pyi:1048:14 error[invalid-type-form] Invalid subscript of object of type `_SpecialForm` in a type expression
+ mypy/typeshed/stdlib/typing.pyi:1049:21 error[invalid-type-form] Invalid subscript of object of type `_SpecialForm` in a type expression
+ mypy/typeshed/stdlib/typing.pyi:1056:47 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
+ mypy/typeshed/stdlib/typing.pyi:1076:16 error[invalid-type-form] Invalid subscript of object of type `_SpecialForm` in a type expression
+ mypy/typeshed/stdlib/typing.pyi:1078:24 error[invalid-type-form] Invalid subscript of object of type `_SpecialForm` in a type expression
+ mypy/typeshed/stdlib/typing.pyi:1096:39 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:651:28 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypy/typeshed/stdlib/typing.pyi:739:64 error[unsupported-operator] Operator `|` is not supported between two objects of type `TypeVar`
+ mypy/typeshed/stdlib/typing.pyi:741:65 error[unsupported-operator] Operator `|` is not supported between two objects of type `TypeVar`
+ mypy/typeshed/stdlib/typing.pyi:847:46 error[unsupported-operator] Operator `|` is not supported between objects of type `TypeVar` and `None`
+ mypy/typeshed/stdlib/typing.pyi:847:63 error[invalid-type-form] Variable of type `TypeVar` is not allowed in a parameter annotation
+ mypyc/test-data/fixtures/typing-full.pyi:64:28 error[invalid-type-form] Non-generic class `Iterator` cannot be specialized in a type expression
+ mypyc/test-data/fixtures/typing-full.pyi:86:28 error[invalid-type-form] Non-generic class `Awaitable` cannot be specialized in a type expression
+ mypyc/test-data/fixtures/typing-full.pyi:95:25 error[invalid-type-form] Non-generic class `Awaitable` cannot be specialized in a type expression
+ mypyc/test-data/fixtures/typing-full.pyi:121:29 error[invalid-type-form] Non-generic class `AsyncIterator` cannot be specialized in a type expression
+ mypyc/test-data/fixtures/typing-full.pyi:125:29 error[invalid-type-form] Non-generic class `AsyncIterator` cannot be specialized in a type expression
+ mypyc/test-data/fixtures/typing-full.pyi:127:28 error[invalid-type-form] Non-generic class `Awaitable` cannot be specialized in a type expression
+ mypyc/test-data/fixtures/typing-full.pyi:168:27 error[invalid-type-form] Non-generic class `Iterator` cannot be specialized in a type expression
+ mypyc/test-data/fixtures/typing-full.pyi:92:64 error[invalid-type-form] Non-generic class `Awaitable` cannot be specialized in a type expression
+ mypyc/test-data/fixtures/typing-full.pyi:141:24 error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
pandera (https://github.com/pandera-dev/pandera)
+ tests/pandas/test_numpy_engine.py:45:30 error[missing-argument] No argument provided for required parameter `dtype` of `DataType.__init__`
- pandera/engines/pandas_engine.py:240:24 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `DataType`
- pandera/typing/common.py:52:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/common.py:53:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/common.py:56:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/common.py:59:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/common.py:60:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/common.py:61:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/common.py:65:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/common.py:66:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/common.py:68:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/common.py:69:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/common.py:70:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:89:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:90:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:92:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:95:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:96:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:97:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:99:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:101:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:102:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:103:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:104:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:105:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:106:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- pandera/typing/pandas.py:117:9 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
+ tests/geopandas/test_engine.py:119:20 error[no-matching-overload] No overload of function `any` matches arguments
+ tests/geopandas/test_geopandas.py:174:30 warning[unsound-assignment] Unsound assignment: `Any` is not a subtype of `Geometry`
+ tests/geopandas/test_geopandas.py:190:30 warning[unsound-assignment] Unsound assignment: `Any` is not a subtype of `Geometry`
+ tests/geopandas/test_geopandas.py:191:28 warning[unsound-assignment] Unsound assignment: `Any` is not a subtype of `Geometry`
+ tests/geopandas/test_geopandas.py:213:30 warning[unsound-assignment] Unsound assignment: `Any` is not a subtype of `Geometry`
- tests/io/test_pandas_io.py:1714:23 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/io/test_pandas_io.py:2361:27 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/io/test_pandas_io.py:2362:27 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/io/test_pandas_io.py:2381:27 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
+ tests/io/test_pandas_io.py:2381:40 warning[unsound-assignment] Unsound assignment: `Any` is not a subtype of `Series[Int64]`
+ tests/narwhals/test_pandas_e2e.py:828:21 error[missing-argument] No argument provided for required parameter `dtype` of `DataType.__init__`
- tests/pandas/test_dtypes.py:158:74 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- tests/pandas/test_dtypes.py:176:43 error[invalid-assignment] Object of type `list[tuple[dict[Unknown, Unknown], list[Unknown]] | tuple[dict[Unknown | <class 'datetime'> | <class 'datetime64'> | type[Unknown] | DatetimeTZDtype, Unknown | str], Series[Timestamp]] | tuple[dict[Unknown | PeriodDtype, Unknown | str], Series[Period]] | tuple[dict[Unknown | <class 'SparseDtype'> | SparseDtype, Unknown | SparseDtype], Series[Any]] | tuple[dict[Unknown | IntervalDtype, Unknown | str], Series[Interval[float]]]]` is not assignable to `list[tuple[dict[Unknown, Unknown], list[Unknown]]]`
+ tests/pandas/test_dtypes.py:176: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[Any]] | tuple[dict[Unknown | IntervalDtype, Unknown | str], Series[Interval[float]]]]` is not assignable to `list[tuple[dict[Unknown, Unknown], list[Unknown]]]`
+ tests/pandas/test_logical_dtypes.py:212:12 error[unresolved-attribute] Object of type `bool | Iterable[bool]` has no attribute `all`
+ tests/pandas/test_logical_dtypes.py:235:16 error[unresolved-attribute] Object of type `bool | Iterable[bool]` has no attribute `any`
+ tests/pandas/test_logical_dtypes.py:243:31 error[invalid-argument-type] Argument to bound method `Decimal.check` is incorrect: Expected `DataType`, found `dtype[generic[Any]] | ExtensionDtype`
+ tests/pandas/test_logical_dtypes.py:245:12 error[unresolved-attribute] Object of type `bool | Iterable[bool]` has no attribute `dtype`
+ tests/pandas/test_logical_dtypes.py:269:9 error[invalid-argument-type] Argument to bound method `Decimal.check` is incorrect: Expected `pandera.engines.pandas_engine.DataType`, found `pandera.dtypes.DataType`
+ tests/pandas/test_logical_dtypes.py:269:52 error[invalid-argument-type] Argument to bound method `Decimal.check` is incorrect: Expected `Series[Any] | None`, found `Series[Any] | DataFrame`
+ tests/pandas/test_pandas_engine.py:130:24 error[invalid-argument-type] Argument to bound method `pandera.engines.pandas_engine.DataType.check` is incorrect: Expected `pandera.dtypes.DataType`, found `dtype[generic[Any]] | ExtensionDtype | Series[Any]`
+ tests/pandas/test_pandas_engine.py:249:9 error[missing-argument] No argument provided for required parameter `dtype` of `DataType.__init__`
+ tests/pandas/test_pandas_engine.py:413:38 error[unknown-argument] Argument `tz` does not match any known parameter of `DataType.__init__`
+ tests/pandas/test_pandas_engine.py:467:13 error[unknown-argument] Argument `time_zone_agnostic` does not match any known parameter of `DataType.__init__`
+ tests/pandas/test_pandas_engine.py:467:38 error[unknown-argument] Argument `tz` does not match any known parameter of `DataType.__init__`
+ tests/pandas/test_pandas_engine.py:490:13 error[missing-argument] No argument provided for required parameter `dtype` of `DataType.__init__`
+ tests/pandas/test_pandas_engine.py:507:13 error[missing-argument] No argument provided for required parameter `dtype` of `DataType.__init__`
+ tests/pandas/test_pandas_engine.py:601:12 error[call-non-callable] Object of type `Series[Any]` is not callable
+ tests/pandas/test_pandas_engine.py:606:13 error[missing-argument] No argument provided for required parameter `dtype` of `DataType.__init__`
+ tests/pandas/test_pandas_engine.py:624:9 error[invalid-argument-type] Argument to function `DateTime._rebuild_data_container` is incorrect: Expected `Series[Any] | DataFrame`, found `Index[str]`
+ tests/pandas/test_pandas_engine.py:640:13 error[missing-argument] No argument provided for required parameter `dtype` of `DataType.__init__`
+ tests/pandas/test_pandas_engine.py:640:36 error[unknown-argument] Argument `time_zone_agnostic` does not match any known parameter of `DataType.__init__`
+ tests/pandas/test_pandas_engine.py:466:20 error[missing-argument] No argument provided for required parameter `dtype` of `DataType.__init__`
- tests/pandas/test_typing.py:22:17 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/pandas/test_typing.py:38:17 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/pandas/test_typing.py:42:17 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/pandas/test_typing.py:54:17 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/pandas/test_typing.py:58:17 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/pandas/test_typing.py:70:17 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/pandas/test_typing.py:74:17 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/pandas/test_typing.py:82:17 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/pandas/test_typing.py:90:17 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/pandas/test_typing.py:94:17 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
- tests/pandas/test_typing.py:515:17 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
+ tests/pandas/test_typing.py:515:35 warning[unsound-assignment] Unsound assignment: `Any` is not a subtype of `Series[Bool]`
+ tests/pandas/test_typing.py:529:36 warning[unsound-assignment] Unsound assignment: `Any` is not a subtype of `Series[Int64]`
+ tests/polars/test_polars_model.py:401:37 warning[unsound-assignment] Unsound assignment: `Any` is not a subtype of `DateTime`
+ tests/polars/test_polars_model.py:406:37 warning[unsound-assignment] Unsound assignment: `Any` is not a subtype of `DateTime`
+ tests/pyspark/test_schemas_on_pyspark_pandas.py:280:13 error[missing-argument] No argument provided for required parameter `dtype` of `DataType.__init__`
- tests/strategies/test_strategies.py:391:13 error[invalid-argument-type] Argument to function `str_length_strategy` is incorrect: Expected `pandera.engines.numpy_engine.DataType | pandera.engines.pandas_engine.DataType`, found `type[Unknown]`
+ tests/strategies/test_strategies.py:391:13 error[invalid-argument-type] Argument to function `str_length_strategy` is incorrect: Expected `pandera.engines.numpy_engine.DataType | pandera.engines.pandas_engine.DataType`, found `<class 'String'>`
- tests/strategies/test_strategies.py:405:44 error[invalid-argument-type] Argument to function `str_length_strategy` is incorrect: Expected `pandera.engines.numpy_engine.DataType | pandera.engines.pandas_engine.DataType`, found `type[Unknown]`
+ tests/strategies/test_strategies.py:405:44 error[invalid-argument-type] Argument to function `str_length_strategy` is incorrect: Expected `pandera.engines.numpy_engine.DataType | pandera.engines.pandas_engine.DataType`, found `<class 'String'>`
spack (https://github.com/spack/spack)
- lib/spack/spack/dependency.py:69:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `str`
- lib/spack/spack/hash_types.py:43:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `str`
- lib/spack/spack/solver/reuse.py:69:12 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `bool`
+ lib/spack/spack/cmd/create.py:1074:45 error[invalid-argument-type] Argument to bound method `RepoPath.get_repo` is incorrect: Expected `str`, found `(str & ~AlwaysFalsy) | Literal[True] | (Unknown & ~AlwaysFalsy)`
+ lib/spack/spack/concretize.py:264:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Spec`
+ lib/spack/spack/hash_lookup.py:77:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Spec`
+ lib/spack/spack/installer/schedule.py:258:16 warning[unsound-return-statement] Unsound return statement: `list[Spec | Unknown]` is not a subtype of `list[Spec]`
+ lib/spack/spack/test/architecture.py:66:12 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/directory_layout.py:132:37 error[invalid-argument-type] Argument to bound method `Spec.copy` is incorrect: Expected `int | str | list[str] | tuple[str, ...]`, found `SpecHashDescriptor`
+ lib/spack/spack/test/error.py:55:61 error[invalid-argument-type] Argument to `OutputDoesNotSatisfyInputError.__init__` is incorrect: Expected `list[tuple[Spec, Spec | None]]`, found `list[tuple[Spec, Spec] | tuple[Spec, None]]`
+ lib/spack/spack/test/spec_format.py:174:53 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/spec_format.py:184:43 error[unresolved-attribute] Attribute `os` is not defined on `None` in union `None | ArchSpec | Unknown`
- lib/spack/spack/binary_distribution.py:1117:12 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `str`
+ lib/spack/spack/binary_distribution.py:962:21 error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `Prefix`, found `str`
- lib/spack/spack/builder.py:225:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `str`
+ lib/spack/spack/cmd/__init__.py:272:16 warning[unsound-return-statement] Unsound return statement: `Spec | Unknown` is not a subtype of `Spec`
+ lib/spack/spack/cmd/__init__.py:276:12 warning[unsound-return-statement] Unsound return statement: `Spec | Unknown` is not a subtype of `Spec`
+ lib/spack/spack/cmd/compiler.py:246:12 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `list[Spec]`
- lib/spack/spack/compilers/config.py:252:12 warning[unsound-return-statement] Unsound return statement: `tuple[Unknown, str, str]` is not a subtype of `tuple[str, str, str]`
+ lib/spack/spack/compilers/config.py:178:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `list[Spec]`
+ lib/spack/spack/cray_manifest.py:182:5 error[unresolved-attribute] Unresolved attribute `_hashes_final` on type `Spec`
+ lib/spack/spack/cray_manifest.py:184:5 error[unresolved-attribute] Unresolved attribute `origin` on type `Spec`
+ lib/spack/spack/database.py:1229:25 error[unresolved-attribute] Object of type `Spec` has no attribute `_package_hash`
+ lib/spack/spack/database.py:1283:17 error[invalid-argument-type] Argument to `InstallRecord.__init__` is incorrect: Expected `str | None`, found `object`
- lib/spack/spack/database.py:382:16 warning[unsound-return-statement] Unsound return statement: `tuple[Unknown, Unknown]` is not a subtype of `tuple[str, str]`
+ lib/spack/spack/database.py:382:16 warning[unsound-return-statement] Unsound return statement: `tuple[Unknown, str]` is not a subtype of `tuple[str, str]`
+ lib/spack/spack/detection/path.py:333:16 warning[unsound-return-statement] Unsound return statement: `list[Unknown | Spec]` is not a subtype of `list[Spec]`
+ lib/spack/spack/detection/path.py:477:12 warning[unsound-return-statement] Unsound return statement: `defaultdict[Unknown, Unknown]` is not a subtype of `dict[str, list[Spec]]`
+ lib/spack/spack/directives.py:794:24 error[no-matching-overload] No overload of bound method `MutableMapping.setdefault` matches arguments
+ lib/spack/spack/directory_layout.py:37:20 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Spec | None`
- lib/spack/spack/environment/environment.py:1085:13 warning[unsound-return-statement] Unsound return statement: `bool | (Unknown & ~AlwaysTruthy)` is not a subtype of `bool`
- lib/spack/spack/environment/environment.py:2337:42 error[invalid-argument-type] Argument to function `traverse_nodes` is incorrect: Expected `Sequence[Unknown]`, found `dict_values[str, Unknown]`
+ lib/spack/spack/environment/environment.py:2337:42 error[invalid-argument-type] Argument to function `traverse_nodes` is incorrect: Expected `Sequence[Spec]`, found `dict_values[str, Spec]`
- lib/spack/spack/environment/environment.py:2604:26 warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `str`
+ lib/spack/spack/environment/environment.py:2604:26 error[invalid-assignment] Object of type `None | str | bool | Unknown` is not assignable to `str`
+ lib/spack/spack/externals.py:89:9 error[invalid-assignment] Object of type `Microarchitecture` is not assignable to attribute `target` on type `None | (ArchSpec & ~AlwaysTruthy) | (Unknown & ~AlwaysTruthy)`
- lib/spack/spack/install_test.py:1013:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `str`
- lib/spack/spack/modules/common.py:777:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `str`
+ lib/spack/spack/modules/common.py:681:16 warning[unsound-return-statement] Unsound return statement: `dict[str, Unknown | Spec]` is not a subtype of `dict[str, Spec]`
+ lib/spack/spack/modules/common.py:692:16 warning[unsound-return-statement] Unsound return statement: `Any | dict[str, Spec]` is not a subtype of `dict[str, Spec]`
+ lib/spack/spack/modules/common.py:757:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Spec`
+ lib/spack/spack/old_installer.py:555:32 error[no-matching-overload] No overload of function `join` matches arguments
+ lib/spack/spack/old_installer.py:577:44 error[invalid-argument-type] Argument to bound method `RepoPath.get_repo` is incorrect: Expected `str`, found `None | str | bool | Unknown`
+ lib/spack/spack/old_installer.py:578:21 error[no-matching-overload] No overload of function `join` matches arguments
+ lib/spack/spack/old_installer.py:580:24 error[invalid-argument-type] Argument to function `create_or_construct` is incorrect: Expected `str | None`, found `None | str | bool | Unknown`
- lib/spack/spack/package_base.py:1461:16 warning[unsound-return-statement] Unsound return statement: `Literal[False] | Unknown` is not a subtype of `bool`
+ lib/spack/spack/platforms/__init__.py:35:32 warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `() -> Platform`
- lib/spack/spack/solver/asp.py:1477:16 warning[unsound-assignment] Unsound assignment: `(Unknown & ~AlwaysFalsy) | str | None` is not a subtype of `str | None`
- lib/spack/spack/solver/asp.py:1493:16 warning[unsound-assignment] Unsound assignment: `(Unknown & ~AlwaysFalsy) | str | None` is not a subtype of `str | None`
- lib/spack/spack/solver/asp.py:1646:30 warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `tuple[bool | str, ...]`
- lib/spack/spack/solver/asp.py:1780:25 warning[unsound-assignment] Unsound assignment: `(Unknown & ~AlwaysFalsy) | str | None` is not a subtype of `str | None`
- lib/spack/spack/solver/asp.py:1806:24 warning[unsound-assignment] Unsound assignment: `(Unknown & ~AlwaysFalsy) | str | None` is not a subtype of `str | None`
- lib/spack/spack/solver/asp.py:2274:16 warning[unsound-assignment] Unsound assignment: `(Unknown & ~AlwaysFalsy) | (str & ~AlwaysFalsy) | Literal[""]` is not a subtype of `str | None`
+ lib/spack/spack/solver/asp.py:2196:48 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/solver/asp.py:2571:13 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[GitVersion | StandardVersion, list[Provenance]].__getitem__(key: GitVersion | StandardVersion, /) -> list[Provenance]` cannot be called with key of type `ConcreteVersion` on object of type `dict[GitVersion | StandardVersion, list[Provenance]]`
+ lib/spack/spack/solver/asp.py:3067:17 error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `str | bool | (Unknown & ~None)` on object of type `dict[str, str]`
+ lib/spack/spack/solver/asp.py:3544:12 warning[unsound-return-statement] Unsound return statement: `tuple[set[Unknown], set[Unknown]]` is not a subtype of `tuple[set[Spec], set[Spec]]`
- lib/spack/spack/spec.py:1022:16 warning[unsound-return-statement] Unsound return statement: `Unknown | Literal[True]` is not a subtype of `bool`
- lib/spack/spack/spec.py:1834:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `bool`
- lib/spack/spack/spec.py:1848:12 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `bool`
- lib/spack/spack/spec.py:3896:16 warning[unsound-return-statement] Unsound return statement: `bool | Unknown` is not a subtype of `bool`
- lib/spack/spack/spec.py:5413:16 warning[unsound-return-statement] Unsound return statement: `int | Unknown` is not a subtype of `int`
- lib/spack/spack/spec.py:5498:16 warning[unsound-return-statement] Unsound return statement: `tuple[list[Unknown], list[Unknown]]` is not a subtype of `tuple[list[str], list[str]]`
- lib/spack/spack/spec.py:6371:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `bool`
+ lib/spack/spack/spec.py:703:17 warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `ArchSpec`
+ lib/spack/spack/spec.py:766:17 warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `ArchSpec`
+ lib/spack/spack/spec.py:1727:23 warning[unsound-yield] Unsound `yield`: `Unknown` is not a subtype of `DependencySpec`
+ lib/spack/spack/spec.py:2337:35 warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `DependencySpec | None`
+ lib/spack/spack/spec.py:2800:29 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["propagation"]` and value of type `Literal["PREFERENCE"]` on object of type `dict[str, tuple[Literal["build", "link", "run", "test"], ...] | tuple[Divergent, ...]]`
+ lib/spack/spack/spec.py:2815:13 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["compiler"]` and value of type `str` on object of type `dict[str, int]`
+ lib/spack/spack/spec.py:3101:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Spec`
+ lib/spack/spack/spec.py:3547:17 warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `str | Spec`
+ lib/spack/spack/spec.py:3755:17 warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `str | Spec`
+ lib/spack/spack/spec.py:5425:9 error[invalid-method-override] Invalid override of method `__setitem__`: Definition is incompatible with `HashableMap.__setitem__`
+ lib/spack/spack/spec.py:5914:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Spec`
+ lib/spack/spack/spec.py:6049:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Spec`
- lib/spack/spack/spec.py:1655:12 warning[unsound-return-statement] Unsound return statement: `Literal[""] | Unknown` is not a subtype of `str`
+ lib/spack/spack/spec.py:1655:12 warning[unsound-return-statement] Unsound return statement: `str | Unknown` is not a subtype of `str`
- lib/spack/spack/spec.py:3475:24 error[unresolved-attribute] Attribute `constrain` is not defined on `None` in union `None | Unknown`
+ lib/spack/spack/spec.py:3475:24 error[unresolved-attribute] Attribute `constrain` is not defined on `None` in union `None | ArchSpec | Unknown`
- lib/spack/spack/spec.py:4959:16 error[unresolved-attribute] Attribute `platform` is not defined on `None` in union `None | Unknown`
+ lib/spack/spack/spec.py:4959:16 error[unresolved-attribute] Attribute `platform` is not defined on `None` in union `None | ArchSpec | Unknown`
- lib/spack/spack/spec.py:4967:16 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | Unknown`
+ lib/spack/spack/spec.py:4967:16 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
- lib/spack/spack/spec.py:5296:57 error[unresolved-attribute] Attribute `platform` is not defined on `None` in union `None | Unknown`
+ lib/spack/spack/spec.py:5296:57 error[unresolved-attribute] Attribute `platform` is not defined on `None` in union `None | ArchSpec | Unknown`
- lib/spack/spack/spec.py:5297:17 error[invalid-assignment] Object of type `Unknown & ~AlwaysFalsy` is not assignable to attribute `platform` on type `None | Unknown`
+ lib/spack/spack/spec.py:5297:17 error[invalid-assignment] Object of type `Unknown & ~AlwaysFalsy` is not assignable to attribute `platform` on type `None | ArchSpec | Unknown`
- lib/spack/spack/spec.py:5299:45 error[unresolved-attribute] Attribute `os` is not defined on `None` in union `None | Unknown`
+ lib/spack/spack/spec.py:5299:45 error[unresolved-attribute] Attribute `os` is not defined on `None` in union `None | ArchSpec | Unknown`
- lib/spack/spack/spec.py:5302:53 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | Unknown`
+ lib/spack/spack/spec.py:5302:53 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
- lib/spack/spack/spec.py:5303:17 error[invalid-assignment] Object of type `Unknown & ~AlwaysFalsy` is not assignable to attribute `target` on type `None | Unknown`
+ lib/spack/spack/spec.py:5303:17 error[invalid-assignment] Object of type `Unknown & ~AlwaysFalsy` is not assignable to attribute `target` on type `None | ArchSpec | Unknown`
- lib/spack/spack/spec_parser.py:365:27 error[invalid-assignment] Object of type `tuple[Unknown, Unknown | dict[str, tuple[str] | int], None | Token | Unknown | type[Token]]` is not assignable to `tuple[Unknown, dict[Unknown, Unknown], Token] | None`
+ lib/spack/spack/spec_parser.py:365:27 error[invalid-assignment] Object of type `tuple[Unknown, Unknown | dict[str, tuple[str] | int], None | Token | Unknown | type[Token]]` is not assignable to `tuple[Spec, dict[Unknown, Unknown], Token] | None`
+ lib/spack/spack/test/ci.py:475:29 error[invalid-argument-type] Argument to function `run_standalone_tests` is incorrect: Expected `CDashHandler | None`, found `Spec`
+ lib/spack/spack/test/cmd/env.py:3018:41 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/cmd/env.py:3044:41 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/cmd/env.py:3061:41 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/cmd/env.py:3081:41 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/cmd/env.py:3163:41 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/cmd/env.py:3302:41 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/concretization/core.py:652:49 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/concretization/core.py:1163:20 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/concretization/core.py:1198:20 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/concretization/core.py:1671:20 error[invalid-argument-type] Argument to `set.__init__` is incorrect: Expected `Iterable[bool | str]`, found `tuple[bool | str, ...] | bool | str`
+ lib/spack/spack/test/concretization/core.py:3451:37 error[invalid-argument-type] Argument to bound method `ReusableSpecsSelector.reusable_specs` is incorrect: Expected `list[Spec]`, found `list[Spec | str]`
+ lib/spack/spack/test/concretization/core.py:4618:12 error[unresolved-attribute] Object of type `Spec` has no attribute `_hash`
+ lib/spack/spack/test/concretization/core.py:4619:12 error[unresolved-attribute] Object of type `Spec` has no attribute `_hash`
+ lib/spack/spack/test/concretization/core.py:5759:12 error[unresolved-attribute] Attribute `target_concrete` is not defined on `None` in union `None | ArchSpec | Unknown`
- lib/spack/spack/test/cray_manifest.py:204:12 error[unresolved-attribute] Attribute `extra_attributes` is not defined on `None` in union `Unknown | None`
+ lib/spack/spack/test/cray_manifest.py:204:12 error[unresolved-attribute] Attribute `extra_attributes` is not defined on `None` in union `Spec | None`
- lib/spack/spack/test/directives.py:138:5 error[invalid-assignment] Object of type `dict[Unknown, str]` is not assignable to attribute `licenses` of type `property`
+ lib/spack/spack/test/directives.py:138:5 error[invalid-assignment] Object of type `dict[Spec, str]` is not assignable to attribute `licenses` of type `property`
+ lib/spack/spack/test/env.py:66:5 error[unresolved-attribute] Unresolved attribute `_hash` on type `Spec`
+ lib/spack/spack/test/modules/common.py:132:41 error[invalid-argument-type] Argument to bound method `UpstreamModuleIndex.upstream_module` is incorrect: Expected `Spec`, found `MockSpec`
+ lib/spack/spack/test/modules/common.py:148:40 error[invalid-argument-type] Argument to bound method `UpstreamModuleIndex.upstream_module` is incorrect: Expected `Spec`, found `MockSpec`
+ lib/spack/spack/test/modules/common.py:173:51 error[invalid-argument-type] Argument to function `get_module` is incorrect: Expected `Spec`, found `MockSpec`
+ lib/spack/spack/test/patch.py:214:12 error[unsupported-operator] Operator `not in` is not supported between objects of type `Literal["a69b288d7393261e613c276c6d38a01461028291f6e381623acc58139d01f54d"]` and `tuple[bool | str, ...] | bool | str`
+ lib/spack/spack/test/spec_semantics.py:1171:16 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["test"]` and `None | ArchSpec | Unknown`
+ lib/spack/spack/test/spec_semantics.py:1172:16 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["debian"]` and `None | ArchSpec | Unknown`
+ lib/spack/spack/test/spec_semantics.py:1173:16 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["x86_64"]` and `None | ArchSpec | Unknown`
+ lib/spack/spack/test/spec_semantics.py:1378:9 error[unresolved-attribute] Unresolved attribute `_hash` on type `Spec`
+ lib/spack/spack/test/spec_semantics.py:1856:9 error[unresolved-attribute] Unresolved attribute `_package_hash` on type `Spec`
+ lib/spack/spack/test/spec_semantics.py:1888:5 error[unresolved-attribute] Unresolved attribute `_hash` on type `Spec`
+ lib/spack/spack/test/spec_semantics.py:1920:20 error[unresolved-attribute] Object of type `Spec` has no attribute `_package_hash`
+ lib/spack/spack/test/spec_semantics.py:2257:16 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/spec_semantics.py:2265:16 error[unresolved-attribute] Attribute `target` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/test/spec_syntax.py:1302:27 error[invalid-argument-type] Argument to function `expand_toolchains` is incorrect: Expected `Spec`, found `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1360:36 error[invalid-argument-type] Argument to function `replace_hash` is incorrect: Expected `Spec`, found `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1365:36 error[invalid-argument-type] Argument to function `replace_hash` is incorrect: Expected `Spec`, found `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1375:36 error[invalid-argument-type] Argument to function `replace_hash` is incorrect: Expected `Spec`, found `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1389:36 error[invalid-argument-type] Argument to function `replace_hash` is incorrect: Expected `Spec`, found `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1396:36 error[invalid-argument-type] Argument to function `replace_hash` is incorrect: Expected `Spec`, found `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1403:36 error[invalid-argument-type] Argument to function `replace_hash` is incorrect: Expected `Spec`, found `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1451:5 error[unresolved-attribute] Unresolved attribute `_hash` on type `Spec`
+ lib/spack/spack/test/spec_syntax.py:1462:39 error[invalid-argument-type] Argument to function `lookup_hash` is incorrect: Expected `Spec`, found `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1467:39 error[invalid-argument-type] Argument to function `lookup_hash` is incorrect: Expected `Spec`, found `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1478:40 error[invalid-argument-type] Argument to function `replace_hash` is incorrect: Expected `Spec`, found `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1481:40 error[invalid-argument-type] Argument to function `replace_hash` is incorrect: Expected `Spec`, found `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1486:40 error[invalid-argument-type] Argument to function `replace_hash` is incorrect: Expected `Spec`, found `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1509:40 error[invalid-argument-type] Argument to function `replace_hash` is incorrect: Expected `Spec`, found `Spec | None`
- lib/spack/spack/test/spec_syntax.py:1390:12 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["fake"]` and `Unknown | None`
+ lib/spack/spack/test/spec_syntax.py:1390:12 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["fake"]` and `Spec | None`
- lib/spack/spack/test/spec_syntax.py:1392:12 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["zmpi"]` and `Unknown | None`
+ lib/spack/spack/test/spec_syntax.py:1392:12 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["zmpi"]` and `Spec | None`
- lib/spack/spack/test/spec_syntax.py:1404:12 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["zmpi"]` and `Unknown | None`
+ lib/spack/spack/test/spec_syntax.py:1404:12 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["zmpi"]` and `Spec | None`
- lib/spack/spack/test/spec_syntax.py:1407:12 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["fake"]` and `Unknown | None`
+ lib/spack/spack/test/spec_syntax.py:1407:12 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["fake"]` and `Spec | None`
- lib/spack/spack/test/spec_syntax.py:1838:12 error[unresolved-attribute] Attribute `intersects` is not defined on `None` in union `Unknown | None`
+ lib/spack/spack/test/spec_syntax.py:1838:12 error[unresolved-attribute] Attribute `intersects` is not defined on `None` in union `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1838:27 error[invalid-argument-type] Argument to bound method `Spec.intersects` is incorrect: Expected `str | Spec`, found `Spec | None`
- lib/spack/spack/test/spec_syntax.py:1839:12 error[unresolved-attribute] Attribute `intersects` is not defined on `None` in union `Unknown | None`
+ lib/spack/spack/test/spec_syntax.py:1839:12 error[unresolved-attribute] Attribute `intersects` is not defined on `None` in union `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1839:27 error[invalid-argument-type] Argument to bound method `Spec.intersects` is incorrect: Expected `str | Spec`, found `Spec | None`
- lib/spack/spack/test/spec_syntax.py:1841:12 error[unresolved-attribute] Attribute `satisfies` is not defined on `None` in union `Unknown | None`
+ lib/spack/spack/test/spec_syntax.py:1841:12 error[unresolved-attribute] Attribute `satisfies` is not defined on `None` in union `Spec | None`
- lib/spack/spack/test/spec_syntax.py:1848:12 error[unresolved-attribute] Attribute `architecture` is not defined on `None` in union `Unknown | None`
+ lib/spack/spack/test/spec_syntax.py:1848:12 error[unresolved-attribute] Attribute `architecture` is not defined on `None` in union `Spec | None`
+ lib/spack/spack/test/spec_syntax.py:1848:12 error[unresolved-attribute] Attribute `platform` is not defined on `None` in union `None | ArchSpec | Unknown`
+ lib/spack/spack/traverse.py:234:42 error[invalid-argument-type] Argument to `DependencySpec.__init__` is incorrect: Expected `Spec`, found `None`
+ lib/spack/spack/traverse.py:548:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Iterable[DependencySpec | tuple[int, DependencySpec]]`
+ lib/spack/spack/traverse.py:554:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Iterable[DependencySpec | tuple[int, DependencySpec]]`
+ lib/spack/spack/traverse.py:693:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Iterable[tuple[int, DependencySpec]]`
+ lib/spack/spack/traverse.py:696:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Iterable[tuple[int, DependencySpec]]`
+ lib/spack/spack/util/libc.py:66:16 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Spec | None`
- lib/spack/spack/variant.py:422:20 warning[unsound-return-statement] Unsound return statement: `tuple[bool | str | Unknown, ...]` is not a subtype of `tuple[str | bool, ...]`
+ lib/spack/spack/variant.py:536:55 error[invalid-argument-type] Argument to `VariantValue.__init__` is incorrect: Expected `tuple[bool | str, ...]`, found `tuple[None]`
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/chat.py:586:16 warning[unsound-return-statement] Unsound return statement: `Any` is not a subtype of `tuple[type[MemberT@ChatGroup], type[ChatT@ChatGroup], type[ChatGroupTypeT@ChatGroup]]`
Codex ecosystem summaryPreserving classes when a decorator returns The remaining changes are 28 new diagnostics exposing other existing ty limitations, 39 message-only refinements, 249 changes in mypy's copied typing definitions, and one Pandera ignore becoming used because it now suppresses a false positive. Together these account for all 629 stable changes. The The examples annotate lines whose diagnostics differ between revisions; diagnostics on unaffected lines are omitted from the comments. Save examples as Full reportAffected projects1. mypy: Copied typing definitions are checked as ordinary modules (249 changes)These 249 changes all concern copied typing definitions: 237 in mypy's vendored typeshed Report entries (249)
Representative typing-fixture casesOrdinary TypeVar instances are rejected in annotations.
# Merge base: no diagnostic
# PR: error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
def final(f) -> _T:
pass
@final
class TypeVar:
pass
_T = TypeVar()Decorated fixture classes are rejected when specialized as generics.
def runtime_checkable(cls) -> 0:
pass
@runtime_checkable
class Iterable:
pass
# Merge base: no diagnostic
# PR: error[invalid-type-form] Non-generic class `Iterable` cannot be specialized in a type expression
value: Iterable[int]Preserving both fixture classes exposes incompatible subscription keys.
# Merge base: no diagnostic
# PR: error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
def final(f) -> _T:
pass
@final
class TypeVar:
pass
@final
class _SpecialForm:
def __getitem__(self, parameters: int):
pass
_T = TypeVar()
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: int) -> Unknown` cannot be called with key of type `TypeVar` on object of type `_SpecialForm`
_SpecialForm()[_T]Special-form subscription results are rejected as class bases.
def final(f) -> 0:
pass
@final
class _SpecialForm:
def __getitem__(self, parameters) -> object:
pass
# Merge base: no diagnostic
# PR: error[invalid-base] Invalid class base with type `object`
class Container(_SpecialForm()[None]):
passOrdinary special-form instances are rejected in type expressions.
def final(f) -> 0:
pass
@final
class _SpecialForm:
pass
ClassVar: _SpecialForm
# Merge base: no diagnostic
# PR: error[invalid-type-form] Invalid subscript of object of type `_SpecialForm` in a type expression
__hash__: ClassVar[None]Unresolved decorators no longer hide nongeneric fixture classes.
# Merge base: no diagnostic
# PR: error[invalid-type-form] Non-generic class `Iterator` cannot be specialized in a type expression
__iter__: Iterator[int]
@runtime_checkable
class Iterator:
passSpecial-form instances are rejected as class bases.
def final(f) -> 0:
pass
@final
class _SpecialForm:
pass
# Merge base: no diagnostic
# PR: error[invalid-base] Invalid class base with type `_SpecialForm`
class SupportsBytes(_SpecialForm()):
passThe local Generic helper returns instances as class bases.
def type_check_only(func_or_cls) -> 0:
pass
@type_check_only
class _Generic:
def __class_getitem__(cls, args) -> object:
pass
# Merge base: no diagnostic
# PR: error[invalid-base] Invalid class base with type `object`
class Coroutine(_Generic[int]):
passConstructor arguments are checked against ordinary nominal types.
def final(f) -> 0:
pass
@final
class TypeVar:
def __init__(self, bound: int):
pass
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to `TypeVar.__init__` is incorrect: Expected `int`, found `<class 'object'>`
TypeVar(object)Special-form subscriptions reject tuple keys.
def final(f) -> 0:
pass
@final
class _SpecialForm:
def __getitem__(self, parameters: int):
pass
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Method `__getitem__` of type `bound method _SpecialForm.__getitem__(parameters: int) -> Unknown` cannot be called with key of type `None` on object of type `_SpecialForm`
_SpecialForm()[None]TypeVar operator annotations reject the supplied operands.
# Merge base: no diagnostic
# PR: error[invalid-type-form] Variable of type `TypeVar` is not allowed in a return type annotation
def final(f) -> _T:
pass
@final
class TypeVar:
def __or__(self, right: int, /):
pass
_T = TypeVar()
# Merge base: no diagnostic
# PR: error[unsupported-operator] Operator `|` is not supported between two objects of type `TypeVar`
_T | _TThe Python 3.10 TypeVar constructor rejects default keywords.
def final(f) -> 0:
pass
@final
class TypeVar:
pass
# Merge base: no diagnostic
# PR: error[unknown-argument] Argument `default` does not match any known parameter of `object.__init__`
TypeVar(default=None)A known subscription result fails a known constructor’s bound check.
def final(f) -> 0:
pass
@final
class TypeVar:
def __init__(self, bound: int):
pass
@final
class _SpecialForm:
def __getitem__(self, parameters) -> object:
pass
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to `TypeVar.__init__` is incorrect: Expected `int`, found `object`
TypeVar(_SpecialForm()[None])A subscription result is rejected as a union operand.
def final(f) -> 0:
pass
@final
class _SpecialForm:
def __getitem__(self, parameters) -> object:
pass
# Merge base: no diagnostic
# PR: error[unsupported-operator] Operator `|` is not supported between objects of type `object` and `<class 'type'>`
_SpecialForm()[None] | typeA subscription result is rejected in a parameter annotation.
def final(f) -> 0:
pass
@final
class _SpecialForm:
def __getitem__(self, parameters) -> object:
pass
Allowed = _SpecialForm()[None]
# Merge base: no diagnostic
# PR: error[invalid-type-form] Variable of type `object` is not allowed in a parameter annotation
def get_type_hints(obj: Allowed):
passAn existing ignore now suppresses a specialization error.
def runtime_checkable(cls) -> 0:
pass
@runtime_checkable
class Iterable:
pass
# Merge base: warning[unused-ignore-comment] Unused `ty: ignore` directive
# PR: no diagnostic
iterable: Iterable[int] # ty:ignore[invalid-type-form]2. pandera: Decorated dtype classes become valid annotations (59 changes)
Report entries (59)
from typing import TypeVar
_Dtype = TypeVar("_Dtype")
_DataTypeClass = type[_Dtype]
def immutable(pandera_dtype_cls) -> _DataTypeClass:
return pandera_dtype_cls
@immutable
class Bool:
pass
# Merge base: error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
# PR: no diagnostic
value: Bool3. spack: Restored class annotations expose gradual return values (41 changes)Spack's Report entries (41)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
def spec(conf) -> Spec:
# Merge base: no diagnostic
# PR: warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `Spec`
return conf4. pandera: Registered dtype constructors expose incomplete decorator annotations (30 changes)The merge base loses registered dtype classes through Report entries (30)
from collections.abc import Callable
def register_dtype() -> Callable:
return lambda pandera_dtype_cls: pandera_dtype_cls
@register_dtype()
class DateTime:
def __init__(self, dtype):
pass
# Merge base: no diagnostic
# PR: error[missing-argument] No argument provided for required parameter `dtype` of `DateTime.__init__`
# PR: error[unknown-argument] Argument `tz` does not match any known parameter of `DateTime.__init__`
DateTime(tz=None)
# Merge base: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
# PR: no diagnostic
DateTime() # type: ignore5. spack: Optional architecture fields become visible to callers (28 changes)
Report entries (28)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
class ArchSpec:
os: str
@lazy_lexicographic_ordering
class Spec:
def __init__(self):
self.architecture = None
def _set_architecture(self):
self.architecture = ArchSpec()
def test_user_input_combination(spec: Spec):
# Merge base: no diagnostic
# PR: error[unresolved-attribute] Attribute `os` is not defined on `None` in union `None | ArchSpec`
spec.architecture.os6. spack: Recovered members remove unsound return warnings (26 changes)Preserving the decorated classes recovers the types of their fields, properties, methods and comparison results, removing these return warnings. This also recovers inherited methods on subclasses of Report entries (26)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
name: str
def name(spec: Spec) -> str:
# Merge base: warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `str`
# PR: no diagnostic
return spec.namedef decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def cformat(self) -> str:
pass
def _format_spec(spec: Spec) -> str:
# Merge base: warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `str`
# PR: no diagnostic
return spec.cformat()def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def __eq__(self, other) -> bool:
pass
def equal(left: Spec, right: Spec) -> bool:
# Merge base: warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `bool`
# PR: no diagnostic
return left == rightdef decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def __init__(self):
self.original_spec_format = int()
def _dup(self, other: "Spec"):
self.original_spec_format = other.original_spec_format
def get_original_spec_format(self) -> int:
# Merge base: warning[unsound-return-statement] Unsound return statement: `int | Unknown` is not a subtype of `int`
# PR: no diagnostic
return self.original_spec_formatdef decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def constrain(self) -> bool:
pass
class _ImmutableSpec(Spec):
def constrain(self) -> bool:
# Merge base: warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `bool`
# PR: no diagnostic
return super().constrain()7. spack: Existing optional-member errors name the recovered class (18 changes)These accesses already reported that Report entries (18)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class ArchSpec:
os: str
class Spec:
def __init__(self):
self.architecture = None
def _set_architecture(self):
self.architecture = ArchSpec()
def os(self):
# Merge base: error[unresolved-attribute] Attribute `os` is not defined on `None` in union `None | Unknown`
# PR: error[unresolved-attribute] Attribute `os` is not defined on `None` in union `None | ArchSpec`
return self.architecture.os8. spack: Optional parser results no longer satisfy required Spec parameters (18 changes)The parser’s Report entries (18)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
def next_spec() -> Spec | None:
pass
def replace_hash(spec: Spec):
pass
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to function `replace_hash` is incorrect: Expected `Spec`, found `Spec | None`
replace_hash(next_spec())9. dd-trace-py: Unresolved Ray decorators no longer hide missing class members (15 changes)Ray is unresolved in the analyzed environment. The tests expect its decorators to add Report entries (15)
@ray
class Counter:
pass
# Merge base: no diagnostic
# PR: error[unresolved-attribute] Class `Counter` has no attribute `remote`
Counter.remote10. spack: Dynamically installed hash fields are no longer hidden by Unknown (14 changes)Spack installs its hash-cache fields with Report entries (14)
Existing ty issues: ty#2016 def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def __init__(self):
setattr(self, "_hash", None)
def test_hash_change_no_rehash_concrete(spec: Spec):
# Merge base: no diagnostic
# PR: error[unresolved-attribute] Object of type `Spec` has no attribute `_hash`
spec._hash11. spack: Required class parameters reject incompatible arguments (10 changes)Parameters annotated with Report entries (10)def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
def unreachable(when_spec: Spec):
pass
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to function `unreachable` is incorrect: Expected `Spec`, found `Literal["target="]`
unreachable(when_spec='target=')12. pandera: Restored dtype annotations expose Field assignment warnings (8 changes)For four fields, restoring the dtype class replaces an invalid-type-expression error with an Report entries (8)
from typing import Any, TypeVar
_Dtype = TypeVar('_Dtype')
_DataTypeClass = type[_Dtype]
def immutable(pandera_dtype_cls) -> _DataTypeClass:
return pandera_dtype_cls
@immutable
class Date:
pass
def check_field(field: Any):
# Merge base: error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
# PR: warning[unsound-assignment] Unsound assignment: `Any` is not a subtype of `Date`
confirmation_date: Date = field13. spack: Restored class annotations expose gradual assignments (8 changes)Assignments into variables annotated with Report entries (8)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class ArchSpec:
def _autospec(self, spec_like):
pass
def satisfies(self, other: 'ArchSpec'):
# Merge base: no diagnostic
# PR: warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `ArchSpec`
other = self._autospec(other)14. spack: The inferred namespace union exposes incompatible uses (8 changes)
Report entries (8)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def _add_flag(self, value: str | bool):
self.namespace = value
def _add_to_environment_repository(spec_node: Spec):
# Merge base: warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `str`
# PR: error[invalid-assignment] Object of type `str | bool` is not assignable to `str`
namespace: str = spec_node.namespacedef decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def _add_flag(self, value: str | bool):
self.namespace = value
def get_repo(namespace: str):
pass
def get_repository(spec: Spec):
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to function `get_repo` is incorrect: Expected `str`, found `str | bool`
get_repo(spec.namespace)from typing import overload
@overload
def join(a: str) -> str:
pass
@overload
def join(a: bytes) -> bytes:
pass
def join(a):
pass
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def _add_flag(self, value: str | bool):
self.namespace = value
def dump_packages(node: Spec):
# Merge base: no diagnostic
# PR: error[no-matching-overload] No overload of function `join` matches arguments
join(node.namespace)def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def _add_flag(self, value: str | bool):
self.namespace = value
def setup(node: Spec, explicitly_required_namespaces: dict[str, str]):
# Merge base: no diagnostic
# PR: error[invalid-assignment] Invalid subscript assignment with key of type `Literal[""]` and value of type `str | bool` on object of type `dict[str, str]`
explicitly_required_namespaces[""] = node.namespace15. spack: Variant values retain their scalar-or-tuple union (8 changes)
Report entries (8)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class VariantValue:
@property
def value(self) -> tuple[bool | str, ...] | bool | str:
pass
def buildsystem_name(variant: VariantValue) -> str:
# Merge base: warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `str`
# PR: error[invalid-return-type] Return type does not match returned value: expected `str`, found `tuple[bool | str, ...] | bool | str`
return variant.valuedef decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class VariantValue:
@property
def value(self) -> tuple[bool | str, ...] | bool | str:
pass
def test_mv_variants_disjoint_sets_from_spec(variant: VariantValue):
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to `set.__init__` is incorrect: Expected `Iterable[bool | str]`, found `tuple[bool | str, ...] | bool | str`
set(variant.value)def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class VariantValue:
@property
def value(self) -> tuple[bool | str, ...] | bool | str:
pass
def test_patch_mixed_versions_subset_constraint(variant: VariantValue):
# Merge base: no diagnostic
# PR: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["a"]` and `tuple[bool | str, ...] | bool | str`
'a' in variant.value16. pandera: Registered dtype fields receive Any assignment checks (7 changes)Geometry and Polars datetime classes previously became Report entries (7)
from typing import Any
from collections.abc import Callable
def register_dtype() -> Callable:
return lambda pandera_dtype_cls: pandera_dtype_cls
@register_dtype()
class Geometry:
pass
def check_field(field: Any):
# Merge base: no diagnostic
# PR: warning[unsound-assignment] Unsound assignment: `Any` is not a subtype of `Geometry`
geometry: Geometry = field17. spack: Recovered field types remove unsound assignment warnings (6 changes)Reading Report entries (6)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
name: str
def spec_versions(spec: Spec, name: str):
# Merge base: warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `str`
# PR: no diagnostic
name = spec.name18. spack: A kwargs dictionary loses the association between its keys and values (5 changes)A dictionary containing the Report entries (5)
Existing ty issues: ty#4160 def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
def run_standalone_tests(*, fail_fast: bool=False, job_spec: Spec | None=None):
pass
args = {'job_spec': Spec()}
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to function `run_standalone_tests` is incorrect: Expected `bool`, found `Spec`
run_standalone_tests(**args)19. spack: Existing membership errors name optional Spec results (5 changes)Membership tests on an unchecked parser result already failed because the result can be Report entries (5)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def __contains__(self, spec):
pass
def test_dep_spec_by_hash(mpileaks_hash_fake: Spec | None):
# Merge base: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["fake"]` and `Unknown | None`
# PR: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["fake"]` and `Spec | None`
"fake" in mpileaks_hash_fake20. pandera: Declared check results expose unsupported attribute accesses (4 changes)Restoring Report entries (4)
from collections.abc import Callable
def register_dtype() -> Callable:
return lambda pandera_dtype_cls: pandera_dtype_cls
@register_dtype()
class Decimal:
def check(self) -> bool:
return False
# Merge base: no diagnostic
# PR: error[unresolved-attribute] Object of type `bool` has no attribute `all`
Decimal().check().all()21. spack: Narrowed nested dictionaries reject later heterogeneous values (4 changes)The outer mappings are explicitly annotated as Report entries (4)
from typing import Any
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class DependencySpec:
virtuals: tuple[str, ...]
def to_node_dict(dspec: DependencySpec):
dep_attrs: dict[str, Any] = {"parameters": {"virtuals": dspec.virtuals}}
# Merge base: no diagnostic
# PR: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["direct"]` and value of type `Literal[True]` on object of type `dict[str, tuple[str, ...]]`
dep_attrs["parameters"]["direct"] = Truefrom typing import Any
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def __init__(self):
self.original_spec_format = int()
def _dup(self, other: "Spec"):
self.original_spec_format = other.original_spec_format
def to_node_dict(self):
d: dict[str, Any] = {}
d["annotations"] = {"original_specfile_version": self.original_spec_format}
# Merge base: no diagnostic
# PR: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["compiler"]` and value of type `str` on object of type `dict[str, int]`
d["annotations"]["compiler"] = str()22. spack: Recovered methods and base constructors check their arguments (4 changes)Calls through a preserved Report entries (4)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
class SpecHashDescriptor:
pass
@lazy_lexicographic_ordering
class Spec:
def copy(self, deps: int):
pass
def test_read_and_write_spec(spec: Spec):
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to bound method `Spec.copy` is incorrect: Expected `int`, found `SpecHashDescriptor`
spec.copy(deps=SpecHashDescriptor())def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class VariantValue:
def __init__(self, value: bool):
pass
class VariantValueRemoval(VariantValue):
def __init__(self):
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to `VariantValue.__init__` is incorrect: Expected `bool`, found `None`
super().__init__(None)23. spack: Writes through optional architecture objects are checked or refined (4 changes)A write through a recovered Report entries (4)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
class ArchSpec:
pass
@lazy_lexicographic_ordering
class Spec:
def __init__(self):
self.architecture = None
def _set_architecture(self):
self.architecture = ArchSpec()
def complete_architecture(node: Spec, target):
# Merge base: no diagnostic
# PR: error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `target` on type `None | ArchSpec`
node.architecture.target = targetdef decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class ArchSpec:
pass
class Spec:
def __init__(self):
self.architecture = None
def _set_architecture(self):
self.architecture = ArchSpec()
def mutate(self, mutator):
# Merge base: error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `platform` on type `None | Unknown`
# PR: error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `platform` on type `None | ArchSpec`
self.architecture.platform = mutator24. pandera: Existing strategy errors identify the concrete class argument (3 changes)The three Report entries (3)
from typing import TypeVar
class NumpyDataType:
pass
_Dtype = TypeVar("_Dtype")
_DataTypeClass = type[_Dtype]
def immutable(pandera_dtype_cls) -> _DataTypeClass:
return pandera_dtype_cls
def str_length_strategy(pandera_dtype: NumpyDataType):
pass
@immutable
class String:
pass
# Merge base: error[invalid-argument-type] Argument to function `str_length_strategy` is incorrect: Expected `NumpyDataType`, found `type[Unknown]`
# PR: error[invalid-argument-type] Argument to function `str_length_strategy` is incorrect: Expected `NumpyDataType`, found `<class 'String'>`
str_length_strategy(String)25. pandera: Known method signatures reject incompatible dtype arguments (3 changes)The PR can now check the dtype arguments passed to registered Report entries (3)from collections.abc import Callable
class SemanticDataType:
pass
def register_dtype() -> Callable:
return lambda pandera_dtype_cls: pandera_dtype_cls
class DataType:
pass
@register_dtype()
class Decimal:
def check(self, pandera_dtype: DataType):
pass
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to bound method `Decimal.check` is incorrect: Expected `DataType`, found `SemanticDataType`
Decimal().check(SemanticDataType())26. spack: Membership checks see an optional architecture object (3 changes)The architecture field now exposes Report entries (3)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
class ArchSpec:
def __contains__(self, string):
pass
@lazy_lexicographic_ordering
class Spec:
def __init__(self):
self.architecture = None
def _set_architecture(self):
self.architecture = ArchSpec()
def test_forwarding_of_architecture_attributes(spec: Spec):
# Merge base: no diagnostic
# PR: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["test"]` and `None | ArchSpec`
"test" in spec.architecture27. spack: Restored iterator annotations expose gradual yielded values (3 changes)Iterator element annotations now retain Report entries (3)from typing import Iterator
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class DependencySpec:
pass
def _satisfying_edges(lhs_edge) -> Iterator[DependencySpec]:
# Merge base: no diagnostic
# PR: warning[unsound-yield] Unsound `yield`: `Unknown` is not a subtype of `DependencySpec`
yield lhs_edge28. spack: Return warnings retain residual Unknown with more precise other arms (3 changes)These returns remain unsound because part of each expression is still gradual. The recovered class changes a tuple element from Report entries (3)def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
name: str
def dag_hash(self):
pass
def _lock_key(spec: Spec) -> tuple[str, str]:
# Merge base: warning[unsound-return-statement] Unsound return statement: `tuple[Unknown, Unknown]` is not a subtype of `tuple[str, str]`
# PR: warning[unsound-return-statement] Unsound return statement: `tuple[Unknown, str]` is not a subtype of `tuple[str, str]`
return (spec.dag_hash(), spec.name)def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
name: str
@property
def external_path(self):
pass
def libc_is_compatible(lhs: Spec, rhs: Spec) -> bool:
# Merge base: warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `bool`
# PR: warning[unsound-return-statement] Unsound return statement: `Literal[False] | Unknown` is not a subtype of `bool`
return lhs.name == rhs.name and lhs.external_pathdef decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def format(self) -> str:
pass
def tree(specs: list[Spec], colorize) -> str:
out = ''
for node in specs:
if colorize:
out += colorize()
out += node.format()
# Merge base: warning[unsound-return-statement] Unsound return statement: `Literal[""] | Unknown` is not a subtype of `str`
# PR: warning[unsound-return-statement] Unsound return statement: `str | Unknown` is not a subtype of `str`
return out29. pandera: Conditional NumPy dtype definitions expose unsupported union bases (2 changes)The PR retains the distinct classes defined by the NumPy availability branches. Their subclasses therefore expose ty's existing limitation for union-valued class bases: both possible bases are valid classes, but ty cannot determine one MRO for the union. Report entries (2)
Existing ty issues: ty#529 from collections.abc import Callable
def register_dtype() -> Callable:
return lambda pandera_dtype_cls: pandera_dtype_cls
def check(FLOAT_128_AVAILABLE):
if FLOAT_128_AVAILABLE:
class Float64:
pass
else:
@register_dtype()
class Float64:
pass
# Merge base: no diagnostic
# PR: warning[unsupported-base] Unsupported class base with type `<class 'case.<locals of function 'check'>.Float64 @ case.py:8:15'> | <class 'case.<locals of function 'check'>.Float64 @ case.py:12:15'>`
class Float32(Float64):
pass30. setuptools: An unresolved decorator no longer hides constructor keywords (2 changes)ty resolves Report entries (2)
@lenient_dataclass
class setuptools_Extension:
pass
# Merge base: no diagnostic
# PR: error[unknown-argument] Argument `py_limited_api` does not match any known parameter of `object.__init__`
setuptools_Extension(py_limited_api=True)31. spack: A concrete-version base type is too broad for the version map key (2 changes)
Report entries (2)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
class ConcreteVersion:
pass
class StandardVersion(ConcreteVersion):
pass
@lazy_lexicographic_ordering
class Spec:
concrete: ConcreteVersion
def define_versions(s: Spec, possible_versions: dict[StandardVersion, object]):
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Method `__getitem__` of type `bound method dict[StandardVersion, object].__getitem__(key: StandardVersion, /) -> object` cannot be called with key of type `ConcreteVersion` on object of type `dict[StandardVersion, object]`
possible_versions[s.concrete]32. spack: Equivalent tuple-union forms are rejected inside an invariant list (2 changes)The inferred list contains a union of tuples, while the parameter places the union inside a tuple element. Once Report entries (2)Existing ty issues: ty#493 def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
def OutputDoesNotSatisfyInputError(input_to_output: list[tuple[Spec | None]]):
pass
def test_output_does_not_satisfy_input_keeps_its_specs():
unsolved = [(Spec(),), (None,)]
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to function `OutputDoesNotSatisfyInputError` is incorrect: Expected `list[tuple[Spec | None]]`, found `list[tuple[Spec] | tuple[None]]`
OutputDoesNotSatisfyInputError(unsolved)33. spack: Existing namedtuple field-assignment errors show Spec keys (2 changes)These tests assign a dictionary to a field descriptor on a class created by Report entries (2)
from collections import namedtuple
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
package = namedtuple('package', ['licenses'])
# Merge base: error[invalid-assignment] Object of type `dict[Unknown, str]` is not assignable to attribute `licenses` of type `property`
# PR: error[invalid-assignment] Object of type `dict[Spec, str]` is not assignable to attribute `licenses` of type `property`
package.licenses = {Spec(): ''}34. spack: Existing ordering errors name optional Spec operands (2 changes)The optional parser results are still unsafe operands for Report entries (2)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
def __lt__(self, other) -> bool: ...
def __le__(self, other) -> bool: ...
def test_compare_abstract_specs(a: Spec | None, b: Spec | None):
# Merge base: error[unsupported-operator] Operator `<=` is not supported between two objects of type `Unknown | None`
# PR: error[unsupported-operator] Operator `<=` is not supported between two objects of type `Spec | None`
a <= b
# Merge base: error[unsupported-operator] Operator `<` is not supported between two objects of type `Unknown | None`
# PR: error[unsupported-operator] Operator `<` is not supported between two objects of type `Spec | None`
b < a35. spack: External attribute writes are checked against Spec (2 changes)Assignments to Report entries (2)
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
def spec_from_entry(spec: Spec):
# Merge base: no diagnostic
# PR: error[unresolved-attribute] Unresolved attribute `_hashes_final` on type `Spec`
spec._hashes_final = True36. spack: Platform factory annotations expose gradual callable values (2 changes)
Report entries (2)
from typing import Callable
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Platform:
pass
def install(_host):
# Merge base: no diagnostic
# PR: warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `() -> Platform`
host: Callable[[], Platform] = _hostfrom typing import Callable
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Platform:
pass
class _PickleableCallable:
def __call__(self):
pass
# Merge base: no diagnostic
# PR: warning[unsound-assignment] Unsound assignment: `_PickleableCallable` is not a subtype of `() -> Platform`
host: Callable[[], Platform] = _PickleableCallable()37. spack: Unannotated callback parameters no longer satisfy a precise callable subtype (2 changes)The required callback type now includes Report entries (2)
from typing import Callable
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
def view_hardlink(*args) -> None:
pass
def function_for_link_type() -> Callable[[Spec], None]:
# Merge base: no diagnostic
# PR: warning[unsound-return-statement] Unsound return statement: `def view_hardlink(*args) -> None` is not a subtype of `(Spec, /) -> None`
return view_hardlink38. jax: A retained operation type exposes an unknown reassignment (1 change)The MLIR registration decorator has an unknown result. The merge base therefore loses Report entries (1)@_cext
class WarpMapOp(_mosaic_gpu_gen_ops):
pass
def lower(op: WarpMapOp):
# Merge base: no diagnostic
# PR: warning[unsound-assignment] Unsound assignment: `Unknown` is not a subtype of `WarpMapOp`
op = op.body39. pandera: A datetime helper rejects an Index missing from its annotation (1 change)
Report entries (1)from collections.abc import Callable
class Series:
...
class Index:
...
def register_dtype() -> Callable:
return lambda pandera_dtype_cls: pandera_dtype_cls
@register_dtype()
class DateTime:
def _rebuild_data_container(data_container: Series):
pass
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to function `DateTime._rebuild_data_container` is incorrect: Expected `Series`, found `Index`
DateTime._rebuild_data_container(Index())40. pandera: A general iterable does not satisfy NumPy any overloads (1 change)
Report entries (1)from collections.abc import Callable
from typing import Protocol, overload
def register_dtype() -> Callable:
...
@register_dtype()
class Geometry:
def check(self) -> object:
...
class _NestedSequence(Protocol):
def __len__(self, /):
...
@overload
def any(a: _NestedSequence):
...
@overload
def any(a: _NestedSequence):
...
# Merge base: no diagnostic
# PR: error[no-matching-overload] No overload of function `any` matches arguments
any(Geometry().check())41. pandera: A possible DataFrame result has no callable tolist method (1 change)Preserving Report entries (1)from collections.abc import Callable
def register_dtype() -> Callable:
...
class DataFrame:
def __getattr__(self, name) -> int:
...
@register_dtype()
class DateTime:
def _call_to_datetime(self) -> DataFrame:
...
# Merge base: no diagnostic
# PR: error[call-non-callable] Object of type `int` is not callable
DateTime()._call_to_datetime().tolist()42. pandera: A possibly-DataFrame argument is rejected where Series is required (1 change)
Report entries (1)from collections.abc import Callable
class Series:
...
class DataFrame:
...
def register_dtype() -> Callable:
return lambda pandera_dtype_cls: pandera_dtype_cls
@register_dtype()
class Decimal:
def check(self, data_container: Series):
pass
def check_coerced(coerced: Series | DataFrame):
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to bound method `Decimal.check` is incorrect: Expected `Series`, found `Series | DataFrame`
Decimal().check(coerced)43. pandera: More precise dtype classes disambiguate Timestamp in an existing error (1 change)This assignment is rejected on both revisions: the fixture annotation expects lists, but some fixtures contain pandas Series. The PR preserves the Pandera dtype classes instead of displaying them as Report entries (1)from typing import TypeVar
_Dtype = TypeVar('_Dtype')
_DataTypeClass = type[_Dtype]
def immutable(pandera_dtype_cls) -> _DataTypeClass:
...
@immutable
class Timestamp:
pass
class pd:
class Timestamp:
pass
# Merge base: error[invalid-assignment] Object of type `tuple[type[Unknown], Timestamp]` is not assignable to `int`
# PR: error[invalid-assignment] Object of type `tuple[<class 'case.Timestamp'>, case.pd.Timestamp]` is not assignable to `int`
dtype_fixtures: int = (Timestamp, pd.Timestamp())44. pandera: Returning a registered dtype retains its base type (1 change)The merge base treats the registered Report entries (1)from collections.abc import Callable
class DataType:
pass
def register_dtype() -> Callable:
return lambda pandera_dtype_cls: pandera_dtype_cls
@register_dtype()
class Category(DataType):
pass
def dtype() -> DataType:
# Merge base: warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `DataType`
# PR: no diagnostic
return Category()45. spack: A Spec value no longer passes as a string (1 change)The PR retains the Report entries (1)def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
def msg(args: str):
pass
def solve(spec: Spec):
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to function `msg` is incorrect: Expected `str`, found `Spec`
msg(spec)46. spack: A hasattr guard establishes existence without establishing a string type (1 change)
Report entries (1)def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
def InstallRecord(origin: str):
pass
def _add(spec: Spec):
if hasattr(spec, 'origin'):
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to function `InstallRecord` is incorrect: Expected `str`, found `object`
InstallRecord(origin=spec.origin)47. spack: A pre-existing sequence mismatch reports the recovered element type (1 change)
Report entries (1)class Sequence:
pass
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
def traverse_nodes(specs: Sequence):
pass
def _concrete_specs_dict(specs_by_hash: dict[str, Spec]):
# Merge base: error[invalid-argument-type] Argument to function `traverse_nodes` is incorrect: Expected `Sequence`, found `dict_values[str, Unknown]`
# PR: error[invalid-argument-type] Argument to function `traverse_nodes` is incorrect: Expected `Sequence`, found `dict_values[str, Spec]`
traverse_nodes(specs_by_hash.values())48. spack: A recovered base class exposes incompatible keyword parameter names (1 change)
Report entries (1)def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class HashableMap:
def __setitem__(self, key, value):
pass
class VariantMap(HashableMap):
# Merge base: no diagnostic
# PR: error[invalid-method-override] Invalid override of method `__setitem__`: Definition is incompatible with `HashableMap.__setitem__`
def __setitem__(self, name, vspec):
pass49. spack: An existing tuple assignment error retains its Spec element (1 change)The parser assigns a tuple containing Report entries (1)def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
class Token:
pass
def next_spec(dependency):
pending: tuple[Spec, Token]
# Merge base: error[invalid-assignment] Object of type `tuple[Unknown, None]` is not assignable to `tuple[Unknown, Token]`
# PR: error[invalid-assignment] Object of type `tuple[Unknown, None]` is not assignable to `tuple[Spec, Token]`
pending = (dependency, None)50. spack: An optional Spec key no longer matches setdefault overloads (1 change)The variant mapping requires Report entries (1)def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
@lazy_lexicographic_ordering
class Spec:
pass
def _execute_variant(variants: dict[Spec, dict[str, object]], when_spec: Spec | None):
# Merge base: no diagnostic
# PR: error[no-matching-overload] No overload of bound method `MutableMapping.setdefault` matches arguments
variants.setdefault(when_spec, {})51. spack: An uninferred callback type variable becomes visible in a return warning (1 change)The generic Report entries (1)from typing import TypeVar, Callable
def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
T = TypeVar('T')
@lazy_lexicographic_ordering
class Spec:
pass
def stable_partition(predicate_fn: Callable[[T], bool]) -> T:
pass
def _partition_user_specs() -> Spec:
new_user_specs = stable_partition(lambda x: True)
# Merge base: no diagnostic
# PR: warning[unsound-return-statement] Unsound return statement: `UnspecializedTypeVar` is not a subtype of `Spec`
return new_user_specs52. spack: Recovered prefix values narrow a list comprehension (1 change)
Report entries (1)def decorator_with_or_without_args(decorator):
return decorator
@decorator_with_or_without_args
def lazy_lexicographic_ordering(cls):
return cls
class Prefix(str):
pass
@lazy_lexicographic_ordering
class Spec:
prefix: Prefix
def prefixes_to_relocate(specs: list[Spec]):
prefixes = [s.prefix for s in specs]
# Merge base: no diagnostic
# PR: error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `Prefix`, found `str`
prefixes.append(str())53. steam.py: A preserved bound exposes a value lost through a cyclic wildcard import (1 change)Steam’s wildcard re-exports leave Report entries (1)Existing ty issues: ty#113
from typing import TypeVar
from . import utils
MemberT = TypeVar('MemberT', bound='Member')
@PartialMember
class Member:
pass
def add_member() -> MemberT:
# Merge base: no diagnostic
# PR: warning[unsound-return-statement] Unsound return statement: `Divergent` is not a subtype of `MemberT@add_member`
return utils
from .app import *54. steam.py: An Any return becomes visible after preserving a type-variable bound (1 change)
Report entries (1)
from typing import Any, TypeVar
def get_original_bases() -> Any:
pass
MemberT = TypeVar('MemberT', bound='Member')
@PartialMember
class Member:
pass
def _type_args() -> MemberT:
# Merge base: no diagnostic
# PR: warning[unsound-return-statement] Unsound return statement: `Any` is not a subtype of `MemberT@_type_args`
return get_original_bases()Reproduction
|
sharkdp
left a comment
There was a problem hiding this comment.
Thank you
I agree that those cases should be handled consistently.
The direction of change seems like it goes against the gradual guarantee, so whether or not this is a good idea really depends on the ecosystem impact. If all of these new diagnostics are really improvements, i.e. new true positives, then I'm all for it, but I haven't looked at the impact closely.
Great that we can simplify the code a lot!
Merging this PR will improve performance by 5.04%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | ty_micro[inherited_recursive_protocol_diagnostic] |
10.3 s | 9.8 s | +5.04% |
| ⚡ | Simulation | ty_micro[inherited_recursive_protocol_constructor] |
10.3 s | 9.8 s | +5.04% |
Tip
Curious why performance improved? Use the CodSpeed MCP and ask your agent.
Comparing alex/simplify-class-decorator-unknown-results (2891955) with main (b453116)
Footnotes
-
84 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. ↩
That's correct, yes -- but we already made the decision when originally implementing support for class decorators in #25091 that it was better to set aside the gradual guarantee in many cases and preserve the original class. So I don't see this as a change in philosophy, just a more consistent application of the decision we made then. I think codex's analysis is solid, and I think 266 ecosystem improvements in exchange for 46 new false positives is a good trade-off. And if you really do want your class to be inferred as |
Summary
Currently we attempt to distinguish between "unannotated class decorators" and class decorators which, for any other reason, evaluate to
Unknownwhen the class is passed in. This creates a strange inconsistency between these two cases:decorator(Foo)andunknown_decorator(Bar)are both inferred as returningUnknownin a call expression because in both cases, we encountered an error and had to fallback to a gradual type. (The only difference between them is that in one case, the error is reported in a diagnostic, whereas we currently do not complain about entirely missing type annotations in any diagnostic.) So why do we treat them differently at the moment when they're used as decorators?This PR radically simplifies our heuristic so that we apply the same treatment for any class decorator that evaluates to
Unknownortype[Unknown]when it's implicitly called on the class. This removes the strange inconsistency above, is much easier to explain to users in my opinion, and is also more similar to the logic we now use fordynamic-function-decorator-return. Codex's ecosystem analysis indicates that this has 266 diagnostic improvements on the ecosystem, at the cost of 46 new false positives. I think that's a pretty good tradeoff.