Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support non-trivial meets and joins of callables #18647

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sterliakov
Copy link
Collaborator

@sterliakov sterliakov commented Feb 9, 2025

Fixes #17766 and probably several other tickets - will be updated.

This PR changes how mypy solves mutliple ParamSpecs in a signature and callable-valued TypeVars.

Three primary steps:

  1. Actually support joins and meets of callables with varying argument kinds and counts. Tricky, and I'm not yet certain that I found all cases - tests are welcome, especially failing ones.
  2. Pass object type to join. This is necessary to avoid producing false def (*Any, **Any) callables where constraints can't be satisfied. I'm not particlarly fond of this, but threading object type through all meet and join helpers looks even worse.
  3. When solving constraints, do not fall back to upper bound with ellipsis (Callable[..., something]) as that produces a lot of false negatives.

This is really just an exploration attempt for now, because I was bitten by such false positives twice this week. Let's see the primer diff.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

hydpy (https://github.com/hydpy-dev/hydpy)
- hydpy/core/variabletools.py:1480: error: Need type annotation for "array"  [var-annotated]

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/ext/commands/commands.py:331: error: Incompatible types in assignment (expression has type "InvokeT", variable has type "None")  [assignment]
+ steam/ext/commands/commands.py:339: error: Incompatible types in assignment (expression has type "InvokeT", variable has type "None")  [assignment]
- steam/ext/commands/commands.py:324: error: Incompatible return value type (got "Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]]", expected "ErrT")  [return-value]
- steam/ext/commands/commands.py:331: error: Incompatible types in assignment (expression has type "Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]]", variable has type "None")  [assignment]
- steam/ext/commands/commands.py:332: error: Incompatible return value type (got "Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]]", expected "InvokeT")  [return-value]
- steam/ext/commands/commands.py:339: error: Incompatible types in assignment (expression has type "Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]]", variable has type "None")  [assignment]
- steam/ext/commands/commands.py:340: error: Incompatible return value type (got "Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]]", expected "InvokeT")  [return-value]
- steam/ext/commands/help.py:138: note:          Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]]
+ steam/ext/commands/help.py:138: note:          ErrT

werkzeug (https://github.com/pallets/werkzeug)
+ tests/middleware/test_shared_data.py:27: error: No overload variant matches argument type "list[tuple[str, Sequence[str]]]"  [call-overload]
+ tests/middleware/test_shared_data.py:27: note: Possible overload variants:
+ tests/middleware/test_shared_data.py:27: note:     def [_T] __init__(self) -> Collection[_KT]
+ tests/middleware/test_shared_data.py:27: note:     def [_T] __init__(self) -> Collection[object]

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/events/utilities.py:57: error: List item 2 has incompatible type "type[PrefectCloudEventsClient]"; expected "type[EventsClient]"  [list-item]
- src/prefect/cli/profile.py:180: error: Cannot call function of unknown type  [operator]
+ src/prefect/infrastructure/provisioners/__init__.py:56: error: Incompatible return value type (got "object", expected "type[Provisioner]")  [return-value]

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/visitors.py:927: error: Dict entry 0 has incompatible type "type[BoolNot]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:928: error: Dict entry 1 has incompatible type "type[BoolEqual]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:929: error: Dict entry 2 has incompatible type "type[BoolAnd]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:930: error: Dict entry 3 has incompatible type "type[BoolOr]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:931: error: Dict entry 4 has incompatible type "type[BoolXor]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:932: error: Dict entry 5 has incompatible type "type[BoolITE]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:933: error: Dict entry 6 has incompatible type "type[BitVecAdd]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:934: error: Dict entry 7 has incompatible type "type[BitVecSub]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:935: error: Dict entry 8 has incompatible type "type[BitVecMul]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:936: error: Dict entry 9 has incompatible type "type[BitVecDiv]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:937: error: Dict entry 10 has incompatible type "type[BitVecUnsignedDiv]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:938: error: Dict entry 11 has incompatible type "type[BitVecMod]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:939: error: Dict entry 12 has incompatible type "type[BitVecRem]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:940: error: Dict entry 13 has incompatible type "type[BitVecUnsignedRem]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:941: error: Dict entry 14 has incompatible type "type[BitVecShiftLeft]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:942: error: Dict entry 15 has incompatible type "type[BitVecShiftRight]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:943: error: Dict entry 16 has incompatible type "type[BitVecArithmeticShiftLeft]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:944: error: Dict entry 17 has incompatible type "type[BitVecArithmeticShiftRight]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:945: error: Dict entry 18 has incompatible type "type[BitVecAnd]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:946: error: Dict entry 19 has incompatible type "type[BitVecOr]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:947: error: Dict entry 20 has incompatible type "type[BitVecXor]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:948: error: Dict entry 21 has incompatible type "type[BitVecNot]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:949: error: Dict entry 22 has incompatible type "type[BitVecNeg]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:950: error: Dict entry 23 has incompatible type "type[LessThan]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:951: error: Dict entry 24 has incompatible type "type[LessOrEqual]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:952: error: Dict entry 25 has incompatible type "type[GreaterThan]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:953: error: Dict entry 26 has incompatible type "type[GreaterOrEqual]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:954: error: Dict entry 27 has incompatible type "type[UnsignedLessThan]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:955: error: Dict entry 28 has incompatible type "type[UnsignedLessOrEqual]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:956: error: Dict entry 29 has incompatible type "type[UnsignedGreaterThan]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:957: error: Dict entry 30 has incompatible type "type[UnsignedGreaterOrEqual]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:958: error: Dict entry 31 has incompatible type "type[BitVecSignExtend]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:959: error: Dict entry 32 has incompatible type "type[BitVecZeroExtend]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:960: error: Dict entry 33 has incompatible type "type[BitVecExtract]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:961: error: Dict entry 34 has incompatible type "type[BitVecConcat]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:963: error: Dict entry 36 has incompatible type "type[ArrayStore]": "str"; expected "type[Expression]": "str"  [dict-item]
+ manticore/core/smtlib/visitors.py:964: error: Dict entry 37 has incompatible type "type[ArraySelect]": "str"; expected "type[Expression]": "str"  [dict-item]

static-frame (https://github.com/static-frame/static-frame)
+ static_frame/core/util.py:228: error: Argument 1 to "frozenset" has incompatible type "tuple[overloaded function, overloaded function, overloaded function]"; expected "Iterable[overloaded function]"  [arg-type]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/array_algos/masked_accumulations.py:57: error: Dict entry 0 has incompatible type overloaded function: "int"; expected overloaded function: "int | floating[Any]"  [dict-item]
+ pandas/core/nanops.py:1733: error: Dict entry 0 has incompatible type overloaded function: "tuple[float, float]"; expected overloaded function: "tuple[float, float]"  [dict-item]
+ pandas/core/arrays/arrow/array.py:1709: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas/io/pytables.py:2929: error: Dict entry 0 has incompatible type "type[DatetimeIndex]": "str"; expected "type[DatetimeIndexOpsMixin]": "str"  [dict-item]
+ pandas/io/pytables.py:2929: error: Dict entry 1 has incompatible type "type[PeriodIndex]": "str"; expected "type[DatetimeIndexOpsMixin]": "str"  [dict-item]
+ pandas/io/pytables.py:2930: error: Value expression in dictionary comprehension has incompatible type "type[DatetimeIndexOpsMixin]"; expected type "type[DatetimeIndexOpsMixin]"  [misc]
- pandas/core/reshape/merge.py:2926: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas/core/reshape/merge.py:2928: error: Invalid index type "type[Any]" for "dict[type[object], type[Factorizer]]"; expected type "type[object]"  [index]
+ pandas/core/reshape/merge.py:2930: error: Invalid index type "type[Any] | Any" for "dict[type[object], type[Factorizer]]"; expected type "type[object]"  [index]
+ pandas/core/indexes/multi.py:4211: error: Dict entry 0 has incompatible type "type[datetime64[_DT64ItemT_co@datetime64]]": "str"; expected "type[generic[Literal[0] | None]]": "str"  [dict-item]
+ pandas/core/indexes/multi.py:4211: error: Argument 1 to "get" of "dict" has incompatible type "type[Any]"; expected "type[generic[Literal[0] | None]]"  [arg-type]
+ pandas/_testing/__init__.py:167: error: No overload variant matches argument types "str", "str"  [call-overload]
+ pandas/_testing/__init__.py:167: note: Possible overload variants:
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self) -> generic[Literal[0] | None]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, Literal['NAT', 'NaT', 'nat', b'NAT', b'NaT', b'nat'] | None, Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D', 'h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us', 'ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'] | tuple[Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D', 'h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us', 'ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'], SupportsIndex], /) -> generic[None]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, Literal['NAT', 'NaT', 'nat', b'NAT', b'NaT', b'nat'], Literal['ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'] | tuple[Literal['ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'], SupportsIndex], /) -> generic[int | None]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, Literal['NAT', 'NaT', 'nat', b'NAT', b'NaT', b'nat'], Literal['h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us'] | tuple[Literal['h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us'], SupportsIndex], /) -> generic[datetime | None]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, Literal['NAT', 'NaT', 'nat', b'NAT', b'NaT', b'nat'], Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D'] | tuple[Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D'], SupportsIndex], /) -> generic[date | None]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, Literal['NAT', 'NaT', 'nat', b'NAT', b'NaT', b'nat'] | None, Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D', 'h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us', 'ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'] | tuple[Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D', 'h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us', 'ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'], SupportsIndex], /) -> generic[_DT64ItemT_co | None]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, int, Literal['ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'] | tuple[Literal['ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'], SupportsIndex], /) -> generic[int]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, int, tuple[Never, SupportsIndex], /) -> generic[object]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, int, Literal['Y', 'M', b'Y', b'M'] | tuple[Literal['Y', 'M', b'Y', b'M'], SupportsIndex], /) -> generic[object]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, int, Literal['h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us'] | tuple[Literal['h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us'], SupportsIndex], /) -> generic[object]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, int, Literal['W', 'D', b'W', b'D'] | tuple[Literal['W', 'D', b'W', b'D'], SupportsIndex], /) -> generic[object]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, Literal['NAT', 'NaT', 'nat', b'NAT', b'NaT', b'nat'] | None, Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D', 'h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us', 'ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'] | tuple[Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D', 'h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us', 'ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'], SupportsIndex] = ..., /) -> generic[_TD64ItemT_co | None]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, Literal['NOW', 'now', b'NOW', b'now'], Literal['h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us'] | tuple[Literal['h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us'], SupportsIndex] = ..., /) -> generic[object]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, Literal['TODAY', 'today', b'TODAY', b'today'], Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D'] | tuple[Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D'], SupportsIndex] = ..., /) -> generic[object]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, int | bytes | str, Literal['ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'] | tuple[Literal['ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'], SupportsIndex], /) -> generic[object]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, int | bytes | str, Literal['h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us'] | tuple[Literal['h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us'], SupportsIndex], /) -> generic[object]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, int | bytes | str, Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D'] | tuple[Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D'], SupportsIndex], /) -> generic[object]
+ pandas/_testing/__init__.py:167: note:     def [_DT64ItemT_co: date | int | None] __init__(self, bytes | str | None, Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D', 'h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us', 'ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'] | tuple[Literal['Y', 'M', b'Y', b'M', 'W', 'D', b'W', b'D', 'h', 'm', 's', 'ms', 'us', 'μs', b'h', b'm', b's', b'ms', b'us', 'ns', 'ps', 'fs', 'as', b'ns', b'ps', b'fs', b'as'], SupportsIndex] = ..., /) -> generic[_TD64ItemT_co]
+ pandas/_testing/__init__.py:168: error: List item 0 has incompatible type "type[datetime64[_DT64ItemT_co@datetime64]]"; expected "type[generic[Literal[0] | None]]"  [list-item]
+ pandas/tests/series/test_cumulative.py:18: error: Dict entry 0 has incompatible type "str": overloaded function; expected "str": overloaded function  [dict-item]
+ pandas/tests/series/test_cumulative.py:19: error: Dict entry 1 has incompatible type "str": overloaded function; expected "str": overloaded function  [dict-item]
+ pandas/tests/reshape/test_pivot.py:2125: error: List item 0 has incompatible type overloaded function; expected overloaded function  [list-item]
+ pandas/tests/reshape/test_pivot.py:2125: error: List item 1 has incompatible type overloaded function; expected overloaded function  [list-item]
+ pandas/tests/reshape/test_pivot.py:2126: error: List item 0 has incompatible type overloaded function; expected overloaded function  [list-item]
+ pandas/tests/reshape/test_pivot.py:2126: error: List item 1 has incompatible type overloaded function; expected overloaded function  [list-item]
+ pandas/tests/reshape/test_pivot.py:2127: error: List item 0 has incompatible type overloaded function; expected overloaded function  [list-item]
+ pandas/tests/reshape/test_pivot.py:2127: error: List item 1 has incompatible type overloaded function; expected overloaded function  [list-item]
+ pandas/tests/resample/test_resample_api.py:531: error: Dict entry 0 has incompatible type "str": "dict[str, overloaded function]"; expected "str": "dict[str, overloaded function]"  [dict-item]
+ pandas/tests/resample/test_resample_api.py:531: error: Dict entry 0 has incompatible type "str": overloaded function; expected "str": overloaded function  [dict-item]
+ pandas/tests/resample/test_resample_api.py:531: error: Dict entry 1 has incompatible type "str": overloaded function; expected "str": overloaded function  [dict-item]
+ pandas/tests/resample/test_resample_api.py:532: error: Dict entry 0 has incompatible type "str": "tuple[str, overloaded function]"; expected "str": "tuple[str, overloaded function]"  [dict-item]
+ pandas/tests/resample/test_resample_api.py:532: error: Dict entry 1 has incompatible type "str": "tuple[str, overloaded function]"; expected "str": "tuple[str, overloaded function]"  [dict-item]
+ pandas/tests/indexes/datetimelike_/test_sort_values.py:43: error: List item 0 has incompatible type "type[DatetimeIndex]"; expected "type[DatetimeIndexOpsMixin]"  [list-item]
+ pandas/tests/indexes/datetimelike_/test_sort_values.py:43: error: List item 1 has incompatible type "type[TimedeltaIndex]"; expected "type[DatetimeIndexOpsMixin]"  [list-item]
+ pandas/tests/indexes/datetimelike_/test_sort_values.py:43: error: List item 2 has incompatible type "type[PeriodIndex]"; expected "type[DatetimeIndexOpsMixin]"  [list-item]
+ pandas/conftest.py:524: error: List item 0 has incompatible type "type[Index]"; expected "type[IndexOpsMixin]"  [list-item]
+ pandas/conftest.py:524: error: List item 1 has incompatible type "type[Series]"; expected "type[IndexOpsMixin]"  [list-item]
+ pandas/conftest.py:537: error: List item 1 has incompatible type "type[Series]"; expected "Callable[[Sequence[object] | ExtensionArray | ndarray[Any, Any] | Index | Series, ExtensionDtype | str | dtype[Any] | type[object] | None, bool], object]"  [list-item]
+ pandas/tests/tools/test_to_numeric.py:50: error: List item 2 has incompatible type "tuple[Callable[[Any], ndarray[tuple[int, ...], dtype[Any]]], Callable[[Any, Any, bool, bool | Literal['equiv'], Any, Any, str, Any], None]]"; expected "tuple[Callable[[Any], object], Callable[[Index, Index, bool, bool, bool, bool, bool, DefaultNamedArg(str, 'obj')], None]]"  [list-item]

setuptools (https://github.com/pypa/setuptools)
+ setuptools/_static.py:170: error: Argument 1 to "get" of "dict" has incompatible type "type[T]"; expected "type[Collection[object]]"  [arg-type]
+ setuptools/_static.py:170: note: Error code "arg-type" not covered by "type: ignore" comment

streamlit (https://github.com/streamlit/streamlit)
+ lib/tests/streamlit/runtime/state/widgets_test.py:559:13: error: List item 4 has incompatible type "tuple[overloaded function, str]"; expected "tuple[overloaded function, str]"  [list-item]
+ lib/tests/streamlit/runtime/state/widgets_test.py:560:13: error: List item 5 has incompatible type "tuple[overloaded function, str]"; expected "tuple[overloaded function, str]"  [list-item]
+ lib/tests/streamlit/runtime/state/widgets_test.py:561:13: error: List item 6 has incompatible type "tuple[overloaded function, str]"; expected "tuple[overloaded function, str]"  [list-item]

spark (https://github.com/apache/spark)
+ python/pyspark/sql/classic/dataframe.py:430: error: Invalid index type "type[Any]" for "dict[type[object], Any]"; expected type "type[object]"  [index]
+ python/pyspark/pandas/plot/matplotlib.py:591: error: List item 1 has incompatible type "type[PandasOnSparkBarPlot]"; expected "type[object]"  [list-item]
+ python/pyspark/pandas/plot/matplotlib.py:593: error: List item 3 has incompatible type "type[PandasOnSparkPiePlot]"; expected "type[object]"  [list-item]
+ python/pyspark/pandas/plot/matplotlib.py:594: error: List item 4 has incompatible type "type[PandasOnSparkAreaPlot]"; expected "type[object]"  [list-item]
+ python/pyspark/pandas/plot/matplotlib.py:595: error: List item 5 has incompatible type "type[PandasOnSparkLinePlot]"; expected "type[object]"  [list-item]
+ python/pyspark/pandas/plot/matplotlib.py:596: error: List item 6 has incompatible type "type[PandasOnSparkBarhPlot]"; expected "type[object]"  [list-item]
+ python/pyspark/pandas/plot/matplotlib.py:597: error: List item 7 has incompatible type "type[PandasOnSparkScatterPlot]"; expected "type[object]"  [list-item]

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/i18n.py: note: In function "format_date":
+ sphinx/util/i18n.py:303:68: error: Argument "formatter" to "babel_format_date" has incompatible type "DateFormatter | TimeFormatter | Callable[[date | time | float | None, Literal['full', 'long', 'medium', 'short'] | str, tzinfo | None, Locale | str | None], str]"; expected "DateFormatter | TimeFormatter | DatetimeFormatter"  [arg-type]
+ sphinx/transforms/__init__.py:224:5: error: Dict entry 0 has incompatible type "str": "type[literal_block]"; expected "str": "type[Element]"  [dict-item]
+ sphinx/transforms/__init__.py:225:5: error: Dict entry 1 has incompatible type "str": "type[doctest_block]"; expected "str": "type[Element]"  [dict-item]
+ sphinx/transforms/__init__.py:226:5: error: Dict entry 2 has incompatible type "str": "type[raw]"; expected "str": "type[Element]"  [dict-item]
+ sphinx/transforms/__init__.py:227:5: error: Dict entry 3 has incompatible type "str": "type[index]"; expected "str": "type[Element]"  [dict-item]

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_groupby.py:656: error: List item 0 has incompatible type overloaded function; expected overloaded function  [list-item]
+ tests/test_groupby.py:656: error: List item 1 has incompatible type overloaded function; expected overloaded function  [list-item]
+ tests/test_groupby.py:855: error: List item 0 has incompatible type overloaded function; expected overloaded function  [list-item]
+ tests/test_groupby.py:855: error: List item 1 has incompatible type overloaded function; expected overloaded function  [list-item]
+ tests/test_groupby.py:1026: error: List item 0 has incompatible type overloaded function; expected overloaded function  [list-item]
+ tests/test_groupby.py:1026: error: List item 1 has incompatible type overloaded function; expected overloaded function  [list-item]
+ tests/test_series.py:891: error: List item 1 has incompatible type overloaded function; expected "Callable[[Iterable[SupportsRichComparisonT]], _SupportsSumNoDefaultT | Literal[0]]"  [list-item]
+ tests/test_series.py:909: error: List item 1 has incompatible type overloaded function; expected "Callable[[Iterable[SupportsRichComparisonT]], _SupportsSumNoDefaultT | Literal[0]]"  [list-item]
+ tests/test_series.py:3339: error: Argument 1 to "assert_never" has incompatible type "Series[float]"; expected "Never"  [arg-type]

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/lib/config.py: note: In member "__init__" of class "Parameter":
+ pwndbg/lib/config.py:74: error: Invalid index type "type[Any]" for "dict[type[object], int]"; expected type "type[object]"  [index]

dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/schema/__init__.py:43: error: Value of type "object" is not indexable  [index]
+ ddtrace/internal/schema/__init__.py:44: error: Value of type "object" is not indexable  [index]
+ ddtrace/internal/schema/__init__.py:45: error: Value of type "object" is not indexable  [index]
+ ddtrace/internal/schema/__init__.py:46: error: Value of type "object" is not indexable  [index]
+ ddtrace/internal/schema/__init__.py:47: error: Value of type "object" is not indexable  [index]
+ ddtrace/internal/schema/__init__.py:48: error: Value of type "object" is not indexable  [index]
+ ddtrace/internal/schema/__init__.py:49: error: Value of type "object" is not indexable  [index]
+ ddtrace/internal/schema/__init__.py:50: error: Value of type "object" is not indexable  [index]
+ ddtrace/_trace/utils_redis.py:35: error: Unused "type: ignore" comment  [unused-ignore]
+ ddtrace/_trace/utils_valkey.py:35: error: Unused "type: ignore" comment  [unused-ignore]

artigraph (https://github.com/artigraph/artigraph)
+ tests/arti/types/test_pydantic_adapters.py:99: error: Argument 1 to "get" of "dict" has incompatible type "type[Any]"; expected "type[object]"  [arg-type]

ibis (https://github.com/ibis-project/ibis)
+ ibis/common/tests/test_typing.py:114: error: Dict entry 2 has incompatible type "TypeVar": "tuple[str, type[bytes]]"; expected "TypeVar": "tuple[str, type[object]]"  [dict-item]

tornado (https://github.com/tornadoweb/tornado)
+ tornado/test/httpclient_test.py:502: error: List item 0 has incompatible type "type[dict[_KT, _VT]]"; expected "type[object]"  [list-item]
+ tornado/test/httpclient_test.py:504: error: Unsupported target for indexed assignment ("object")  [index]

discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/core.py:637: error: Unused "type: ignore" comment  [unused-ignore]

core (https://github.com/home-assistant/core)
+ homeassistant/components/androidtv_remote/config_flow.py:323: error: Unpacked dict entry 0 has incompatible type "dict[Any, type[str]]"; expected "SupportsKeysAndGetItem[Any, type[str]]"  [dict-item]

trio (https://github.com/python-trio/trio)
+ src/trio/_tests/test_highlevel_open_unix_stream.py:65: error: Too many arguments  [call-arg]
+ src/trio/_tests/test_highlevel_open_unix_stream.py:65: error: Argument 1 to "open_unix_socket" has incompatible type "object"; expected "str | bytes | PathLike[str] | PathLike[bytes]"  [arg-type]

bandersnatch (https://github.com/pypa/bandersnatch)
+ src/bandersnatch/tests/test_configuration.py: note: In member "test_single_config__default__mirror__setting__types" of class "TestBandersnatchConf":
+ src/bandersnatch/tests/test_configuration.py:106: error: Argument 1 has incompatible type "str | None"; expected "str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc"  [arg-type]

pandera (https://github.com/pandera-dev/pandera)
+ tests/geopandas/test_from_to_format_conversions.py:186: error: Item "str" of "str | None" has no attribute "to_csv"  [union-attr]
+ tests/geopandas/test_from_to_format_conversions.py:186: error: Item "None" of "str | None" has no attribute "to_csv"  [union-attr]
+ tests/geopandas/test_from_to_format_conversions.py:189: error: Item "str" of "str | None" has no attribute "to_csv"  [union-attr]
+ tests/geopandas/test_from_to_format_conversions.py:189: error: Item "None" of "str | None" has no attribute "to_csv"  [union-attr]
+ tests/core/test_pydantic_dtype.py:77: error: List item 0 has incompatible type "type[SeriesSchema]"; expected "type[ArraySchema[Any]]"  [list-item]
+ tests/core/test_pydantic_dtype.py:77: error: List item 1 has incompatible type "type[Column]"; expected "type[ArraySchema[Any]]"  [list-item]
+ tests/core/test_pydantic_dtype.py:77: error: List item 2 has incompatible type "type[Index]"; expected "type[ArraySchema[Any]]"  [list-item]
+ tests/core/test_from_to_format_conversions.py:184: error: Item "str" of "str | None" has no attribute "to_csv"  [union-attr]
+ tests/core/test_from_to_format_conversions.py:184: error: Item "None" of "str | None" has no attribute "to_csv"  [union-attr]
+ tests/core/test_from_to_format_conversions.py:187: error: Item "str" of "str | None" has no attribute "to_csv"  [union-attr]
+ tests/core/test_from_to_format_conversions.py:187: error: Item "None" of "str | None" has no attribute "to_csv"  [union-attr]
+ tests/core/test_from_to_format_conversions.py:194: error: Item "str" of "str | None" has no attribute "to_json"  [union-attr]
+ tests/core/test_from_to_format_conversions.py:194: error: Item "None" of "str | None" has no attribute "to_json"  [union-attr]
+ tests/core/test_checks.py:273: error: List item 0 has incompatible type "type[SeriesSchema]"; expected "type[ArraySchema[Any]]"  [list-item]
+ tests/core/test_checks.py:273: error: List item 1 has incompatible type "type[Index]"; expected "type[ArraySchema[Any]]"  [list-item]
+ tests/modin/test_schemas_on_modin.py:78: error: Dict entry 0 has incompatible type "type[DataFrameSchema]": "Any"; expected "type[BaseSchema]": "Any"  [dict-item]
+ tests/modin/test_schemas_on_modin.py:79: error: Dict entry 1 has incompatible type "type[SeriesSchema]": "Any"; expected "type[BaseSchema]": "Any"  [dict-item]
+ tests/modin/test_schemas_on_modin.py:80: error: Dict entry 2 has incompatible type "type[Column]": "Any"; expected "type[BaseSchema]": "Any"  [dict-item]
+ tests/modin/test_schemas_on_modin.py:108: error: List item 0 has incompatible type "type[SeriesSchema]"; expected "type[ArraySchema[Any]]"  [list-item]
+ tests/modin/test_schemas_on_modin.py:108: error: List item 1 has incompatible type "type[Column]"; expected "type[ArraySchema[Any]]"  [list-item]
+ tests/modin/test_schemas_on_modin.py:134: error: List item 0 has incompatible type "type[Index]"; expected "type[BaseSchema]"  [list-item]
+ tests/modin/test_schemas_on_modin.py:134: error: List item 1 has incompatible type "type[MultiIndex]"; expected "type[BaseSchema]"  [list-item]

scikit-learn (https://github.com/scikit-learn/scikit-learn): 8.51x slower (126.4s -> 1075.9s in a single noisy sample)
- sklearn/neighbors/tests/test_graph.py:84: error: List item 0 has incompatible type "type[KNeighborsTransformer]"; expected "type[NeighborsBase]"  [list-item]
+ sklearn/_loss/tests/test_loss.py:1016: error: List item 0 has incompatible type "tuple[HalfSquaredError, overloaded function, str]"; expected "tuple[BaseLoss, overloaded function, str]"  [list-item]
+ sklearn/_loss/tests/test_loss.py:1019: error: List item 3 has incompatible type "tuple[HalfPoissonLoss, overloaded function, str]"; expected "tuple[BaseLoss, overloaded function, str]"  [list-item]
+ sklearn/_loss/tests/test_loss.py:1020: error: List item 4 has incompatible type "tuple[HalfGammaLoss, overloaded function, str]"; expected "tuple[BaseLoss, overloaded function, str]"  [list-item]
+ sklearn/_loss/tests/test_loss.py:1021: error: List item 5 has incompatible type "tuple[HalfTweedieLoss, overloaded function, str]"; expected "tuple[BaseLoss, overloaded function, str]"  [list-item]
+ sklearn/_loss/tests/test_loss.py:1022: error: List item 6 has incompatible type "tuple[HalfBinomialLoss, overloaded function, str]"; expected "tuple[BaseLoss, overloaded function, str]"  [list-item]
+ sklearn/utils/tests/test_sparsefuncs.py:774: error: List item 0 has incompatible type "tuple[int, overloaded function, overloaded function, builtins.bool]"; expected "tuple[float, overloaded function, overloaded function, builtins.bool]"  [list-item]
+ sklearn/utils/tests/test_sparsefuncs.py:774: error: List item 1 has incompatible type "tuple[float, overloaded function, overloaded function, builtins.bool]"; expected "tuple[float, overloaded function, overloaded function, builtins.bool]"  [list-item]
- sklearn/svm/tests/test_svm.py:590: error: List item 1 has incompatible type "tuple[type[NuSVC], str]"; expected "tuple[type[BaseSVC], str]"  [list-item]
- sklearn/svm/tests/test_svm.py:609: error: List item 1 has incompatible type "tuple[type[NuSVC], dict[str, list[float]]]"; expected "tuple[type[BaseSVC], dict[str, list[float]]]"  [list-item]
- sklearn/svm/tests/test_svm.py:1186: error: List item 0 has incompatible type "type[SVC]"; expected "type[BaseSVC]"  [list-item]
- sklearn/svm/tests/test_svm.py:1198: error: List item 0 has incompatible type "type[SVC]"; expected "type[BaseSVC]"  [list-item]
- sklearn/neighbors/tests/test_neighbors.py:334: error: List item 0 has incompatible type "type[KNeighborsClassifier]"; expected "type[NeighborsBase]"  [list-item]
- sklearn/neighbors/tests/test_neighbors.py:335: error: List item 1 has incompatible type "type[KNeighborsRegressor]"; expected "type[NeighborsBase]"  [list-item]
- sklearn/linear_model/tests/test_least_angle.py:209: error: List item 0 has incompatible type "type[Lars]"; expected "type[Lars]"  [list-item]
- sklearn/linear_model/tests/test_least_angle.py:209: error: List item 1 has incompatible type "type[LarsCV]"; expected "type[Lars]"  [list-item]
- sklearn/ensemble/tests/test_stacking.py:565: error: List item 1 has incompatible type "tuple[type[StackingRegressor], type[DummyRegressor], str, LinearRegression, Any, Any]"; expected "tuple[ABCMeta, type[BaseEstimator], str, BaseEstimator, Any, Any]"  [list-item]
- sklearn/ensemble/tests/test_gradient_boosting.py:1346: error: List item 2 has incompatible type "tuple[type[GradientBoostingRegressor], Any, type[DummyRegressor]]"; expected "tuple[ABCMeta, Any, type[BaseEstimator]]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:32: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:54: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:80: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:108: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:137: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:157: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py:183: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py:64: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py:955: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], HalfSquaredError, Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], BaseLoss, Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py:972: error: List item 1 has incompatible type "tuple[type[HistGradientBoostingRegressor], Any, Any]"; expected "tuple[type[BaseHistGradientBoosting], Any, Any]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py:1456: error: List item 0 has incompatible type "type[HistGradientBoostingClassifier]"; expected "type[BaseHistGradientBoosting]"  [list-item]
- sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py:1511: error: List item 0 has incompatible type "type[HistGradientBoostingClassifier]"; expected "type[BaseHistGradientBoosting]"  [list-item]
- sklearn/model_selection/tests/test_split.py:430: error: List item 0 has incompatible type "type[StratifiedKFold]"; expected "type[_BaseKFold]"  [list-item]
- sklearn/model_selection/tests/test_split.py:457: error: List item 0 has incompatible type "type[StratifiedKFold]"; expected "type[_BaseKFold]"  [list-item]
- sklearn/model_selection/tests/test_split.py:499: error: List item 0 has incompatible type "type[StratifiedKFold]"; expected "type[_BaseKFold]"  [list-item]
- sklearn/model_selection/tests/test_split.py:542: error: List item 0 has incompatible type "type[KFold]"; expected "type[_BaseKFold]"  [list-item]
- sklearn/model_selection/tests/test_split.py:542: error: List item 1 has incompatible type "type[StratifiedKFold]"; expected "type[_BaseKFold]"  [list-item]
- sklearn/model_selection/tests/test_split.py:1627: error: List item 0 has incompatible type "type[GroupKFold]"; expected "type[_BaseKFold]"  [list-item]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatible ParamSpecs are not reported as issue
1 participant