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

Fix binding difference between callables and callback protocols #15993

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

Conversation

hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Aug 30, 2023

Fixes #15926 (comment), fixes #16200

@github-actions

This comment has been minimized.

@hauntsaninja hauntsaninja marked this pull request as draft August 30, 2023 02:39
@github-actions

This comment has been minimized.

@ilevkivskyi
Copy link
Member

Hm, it looks like all new errors are technically correct. NumPy stubs take into account current (inconsistent) mypy's behavior. I am not sure what is the best way forward: even if we fix the NumPy stubs, everyone who doesn't pin mypy will get errors until they update NumPy stubs, and vice versa.

@RonnyPfannschmidt
Copy link

would it be feasible to have a per module configuration option that helps to annotate whether or not to do the check,

that way one could opt-in to the new way and the numpy specs could gradually fix their types

ideally this would warn in a way that helps people figure what flags to set at either definition or usage site

@RonnyPfannschmidt
Copy link

im working around this using a Concatenate and mypy_extensions.Arg for now

@RonnyPfannschmidt
Copy link

i thik i now understand the underlying issue

its structurally incorrect to do the first parameters strop off

instead its necessary to be aware of the method descriptor protocol and applying it

so any callable protocol would need a __get__ that returns the correct method version for the callable

and for callables its also a bug to pretend they bind, in particular when __call__ using objects would be valid pass ins that do in fact not run any __get__

i'd like if there was a typing helper for this so one could spell Binding/nonBinding locations for those

@RonnyPfannschmidt
Copy link

i learned that the workaround with mypy_extensions no longer works

Copy link
Contributor

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

arviz (https://github.com/arviz-devs/arviz)
+ arviz/tests/base_tests/test_stats.py:384: error: Too many arguments for "__call__" of "_FloatOp"  [call-arg]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/_numba/kernels/min_max_.py:123: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/_numba/kernels/min_max_.py:123: note: Possible overload variants:
+ pandas/core/_numba/kernels/min_max_.py:123: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/_numba/kernels/min_max_.py:123: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/util/_validators.py:441: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/util/_validators.py:441: note: Possible overload variants:
+ pandas/util/_validators.py:441: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/util/_validators.py:441: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/util/_validators.py:441: note: Left operand is of type "int | integer[Any]"
+ pandas/util/_validators.py:442: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ pandas/util/_validators.py:442: note: Left operand is of type "int | integer[Any]"
+ pandas/core/util/hashing.py:77: error: Too many arguments for "__call__" of "_UnsignedIntOp"  [call-arg]
+ pandas/core/nanops.py:723: error: No overload variant of "__call__" of "_ComparisonOpGT" matches argument type "int"  [operator]
+ pandas/core/nanops.py:723: note: Possible overload variants:
+ pandas/core/nanops.py:723: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/nanops.py:723: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/nanops.py:723: note: Left operand is of type "floating[Any] | ndarray[tuple[int, ...], dtype[floating[Any]]]"
+ pandas/core/nanops.py:1273: error: Too many arguments for "__call__" of "_FloatOp"  [call-arg]
+ pandas/core/nanops.py:1273: note: Left operand is of type "floating[Any] | ndarray[tuple[int, ...], dtype[floating[Any]]]"
+ pandas/core/nanops.py:1281: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/nanops.py:1281: note: Possible overload variants:
+ pandas/core/nanops.py:1281: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/nanops.py:1281: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/nanops.py:1281: note: Left operand is of type "floating[Any] | ndarray[tuple[int, ...], dtype[floating[Any]]]"
+ pandas/core/nanops.py:1284: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/nanops.py:1284: note: Possible overload variants:
+ pandas/core/nanops.py:1284: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/nanops.py:1284: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/nanops.py:1284: note: Left operand is of type "floating[Any] | ndarray[tuple[int, ...], dtype[floating[Any]]]"
+ pandas/core/nanops.py:1354: error: Too many arguments for "__call__" of "_FloatOp"  [call-arg]
+ pandas/core/nanops.py:1354: note: Left operand is of type "floating[Any] | ndarray[tuple[int, ...], dtype[floating[Any]]]"
+ pandas/core/nanops.py:1355: error: Too many arguments for "__call__" of "_FloatOp"  [call-arg]
+ pandas/core/nanops.py:1355: note: Left operand is of type "floating[Any] | ndarray[tuple[int, ...], dtype[floating[Any]]]"
+ pandas/core/nanops.py:1356: error: Too many arguments for "__call__" of "_FloatOp"  [call-arg]
+ pandas/core/nanops.py:1356: note: Left operand is of type "floating[Any] | ndarray[tuple[int, ...], dtype[floating[Any]]]"
+ pandas/core/nanops.py:1368: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/nanops.py:1368: note: Possible overload variants:
+ pandas/core/nanops.py:1368: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/nanops.py:1368: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/nanops.py:1368: note: Left operand is of type "floating[Any] | ndarray[tuple[int, ...], dtype[floating[Any]]]"
+ pandas/core/nanops.py:1382: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/nanops.py:1382: note: Possible overload variants:
+ pandas/core/nanops.py:1382: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/nanops.py:1382: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/nanops.py:1382: note: Left operand is of type "floating[Any] | ndarray[tuple[int, ...], dtype[floating[Any]]]"
+ pandas/core/nanops.py:1570: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/nanops.py:1570: note: Possible overload variants:
+ pandas/core/nanops.py:1570: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/nanops.py:1570: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/dtypes/cast.py:1803: error: Unsupported operand types for <= ("int" and "integer[Any]")  [operator]
+ pandas/core/dtypes/cast.py:1803: note: Right operand is of type "int | integer[Any] | float"
+ pandas/core/dtypes/cast.py:1803: error: No overload variant of "__call__" of "_ComparisonOpLE" matches argument type "int"  [operator]
+ pandas/core/dtypes/cast.py:1803: note: Possible overload variants:
+ pandas/core/dtypes/cast.py:1803: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/dtypes/cast.py:1803: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/dtypes/cast.py:1803: note: Left operand is of type "int | integer[Any] | float"
+ pandas/core/missing.py:250: error: Unsupported operand types for - ("int" and "signedinteger[_32Bit | _64Bit]")  [operator]
+ pandas/core/missing.py:980: error: Unsupported operand types for - ("int" and "signedinteger[_32Bit | _64Bit]")  [operator]
+ pandas/core/missing.py:985: error: Too many arguments for "__call__" of "_SignedIntOp"  [call-arg]
+ pandas/core/arrays/_ranges.py:127: error: Too many arguments for "__call__" of "_UnsignedIntOp"  [call-arg]
+ pandas/core/arrays/_ranges.py:141: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/arrays/_ranges.py:141: note: Possible overload variants:
+ pandas/core/arrays/_ranges.py:141: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/arrays/_ranges.py:141: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/arrays/_ranges.py:141: error: Unsupported operand types for <= ("int" and "unsignedinteger[_64Bit]")  [operator]
+ pandas/core/arrays/_ranges.py:169: error: Too many arguments for "__call__" of "_SignedIntOp"  [call-arg]
+ pandas/core/arrays/_ranges.py:172: error: Too many arguments for "__call__" of "_SignedIntOp"  [call-arg]
+ pandas/core/arrays/_ranges.py:192: error: Too many arguments for "__call__" of "_UnsignedIntOp"  [call-arg]
+ pandas/core/arrays/_ranges.py:194: error: No overload variant of "__call__" of "_ComparisonOpGT" matches argument type "unsignedinteger[_64Bit]"  [operator]
+ pandas/core/arrays/_ranges.py:194: note: Possible overload variants:
+ pandas/core/arrays/_ranges.py:194: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/arrays/_ranges.py:194: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/arrays/_ranges.py:195: error: No overload variant of "__call__" of "_ComparisonOpLE" matches argument type "unsignedinteger[_64Bit]"  [operator]
+ pandas/core/arrays/_ranges.py:195: note: Possible overload variants:
+ pandas/core/arrays/_ranges.py:195: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/arrays/_ranges.py:195: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/arrays/_ranges.py:195: error: Too many arguments for "__call__" of "_UnsignedIntOp"  [call-arg]
+ pandas/core/arrays/masked.py:214: error: Unsupported operand types for - ("int" and "signedinteger[_32Bit | _64Bit]")  [operator]
+ pandas/core/arrays/masked.py:219: error: Too many arguments for "__call__" of "_SignedIntOp"  [call-arg]
+ pandas/core/arrays/datetimelike.py:1373: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ pandas/core/arrays/datetimelike.py:1373: note: Left operand is of type "int | integer[Any]"
+ pandas/core/arrays/datetimelike.py:1431: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ pandas/core/arrays/datetimelike.py:1431: note: Left operand is of type "int | integer[Any]"
+ pandas/io/parsers/readers.py:641: error: No overload variant of "__call__" of "_ComparisonOpGE" matches argument type "int"  [operator]
+ pandas/io/parsers/readers.py:641: note: Possible overload variants:
+ pandas/io/parsers/readers.py:641: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/io/parsers/readers.py:641: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/io/parsers/readers.py:641: note: Left operand is of type "int | integer[Any]"
+ pandas/io/parsers/python_parser.py:1550: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/io/parsers/python_parser.py:1550: note: Possible overload variants:
+ pandas/io/parsers/python_parser.py:1550: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/io/parsers/python_parser.py:1550: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/io/parsers/python_parser.py:1550: note: Left operand is of type "int | integer[Any]"
+ pandas/core/indexing.py:1653: error: No overload variant of "__call__" of "_ComparisonOpGE" matches argument type "int"  [operator]
+ pandas/core/indexing.py:1653: note: Possible overload variants:
+ pandas/core/indexing.py:1653: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/indexing.py:1653: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/indexing.py:1653: note: Left operand is of type "int | integer[Any]"
+ pandas/core/indexing.py:1692: error: No overload variant of "__call__" of "_ComparisonOpGE" matches argument type "int"  [operator]
+ pandas/core/indexing.py:1692: note: Possible overload variants:
+ pandas/core/indexing.py:1692: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/indexing.py:1692: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/indexing.py:1692: note: Left operand is of type "int | integer[Any]"
+ pandas/core/indexing.py:1692: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/generic.py:4162: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ pandas/core/generic.py:4162: note: Left operand is of type "int | integer[Any]"
+ pandas/core/window/rolling.py:173: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/window/rolling.py:173: note: Possible overload variants:
+ pandas/core/window/rolling.py:173: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/window/rolling.py:173: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/window/rolling.py:173: note: Left operand is of type "int | integer[Any]"
+ pandas/core/window/rolling.py:175: error: Unsupported operand types for > ("int" and "integer[Any]")  [operator]
+ pandas/core/window/rolling.py:175: error: No overload variant of "__call__" of "_ComparisonOpGT" matches argument type "int"  [operator]
+ pandas/core/window/rolling.py:175: note: Possible overload variants:
+ pandas/core/window/rolling.py:175: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/window/rolling.py:175: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/window/rolling.py:175: error: No overload variant of "__call__" of "_ComparisonOpGT" matches argument type "integer[Any]"  [operator]
+ pandas/core/window/rolling.py:175: note: Both left and right operands are unions
+ pandas/core/window/rolling.py:207: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/window/rolling.py:207: note: Possible overload variants:
+ pandas/core/window/rolling.py:207: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/window/rolling.py:207: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/window/rolling.py:207: note: Left operand is of type "int | integer[Any]"
+ pandas/core/window/rolling.py:1141: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/window/rolling.py:1141: note: Possible overload variants:
+ pandas/core/window/rolling.py:1141: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/window/rolling.py:1141: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/window/rolling.py:1141: note: Left operand is of type "int | integer[Any]"
+ pandas/core/window/rolling.py:1905: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/window/rolling.py:1905: note: Possible overload variants:
+ pandas/core/window/rolling.py:1905: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/window/rolling.py:1905: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/window/rolling.py:1905: note: Left operand is of type "int | integer[Any]"
+ pandas/core/reshape/tile.py:362: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ pandas/core/reshape/tile.py:362: note: Left operand is of type "int | integer[Any]"
+ pandas/core/reshape/tile.py:366: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ pandas/core/reshape/tile.py:366: note: Left operand is of type "int | integer[Any]"
+ pandas/core/reshape/merge.py:2383: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/reshape/merge.py:2383: note: Possible overload variants:
+ pandas/core/reshape/merge.py:2383: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/reshape/merge.py:2383: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/reshape/merge.py:2383: note: Left operand is of type "int | integer[Any]"
+ pandas/core/indexes/range.py:1038: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ pandas/core/indexes/range.py:1038: note: Left operand is of type "int | integer[Any]"
+ pandas/core/indexes/range.py:1199: error: Unsupported operand types for // ("int" and "integer[Any]")  [operator]
+ pandas/core/indexes/range.py:1199: note: Right operand is of type "int | integer[Any]"
+ pandas/core/indexes/range.py:1200: error: Unsupported operand types for // ("int" and "integer[Any]")  [operator]
+ pandas/core/indexes/range.py:1200: note: Right operand is of type "int | integer[Any]"
+ pandas/core/indexes/range.py:1205: error: Unsupported operand types for // ("int" and "integer[Any]")  [operator]
+ pandas/core/indexes/range.py:1205: note: Right operand is of type "int | integer[Any]"
+ pandas/core/indexes/multi.py:1693: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ pandas/core/indexes/multi.py:1693: note: Possible overload variants:
+ pandas/core/indexes/multi.py:1693: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ pandas/core/indexes/multi.py:1693: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ pandas/core/indexes/multi.py:1693: note: Left operand is of type "int | integer[Any]"
+ pandas/core/indexes/multi.py:1694: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ pandas/core/indexes/multi.py:1694: note: Left operand is of type "int | integer[Any]"

... (truncated 33 lines) ...

xarray (https://github.com/pydata/xarray)
+ xarray/core/indexing.py: note: In function "_decompose_outer_indexer":
+ xarray/core/indexing.py:1226: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ xarray/core/indexing.py:1226: note: Possible overload variants:
+ xarray/core/indexing.py:1226: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ xarray/core/indexing.py:1226: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ xarray/core/indexing.py:1226: note: Left operand is of type "int | integer[Any]"
+ xarray/core/indexing.py:1227: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ xarray/core/indexing.py:1227: note: Left operand is of type "int | integer[Any]"
+ xarray/coding/times.py: note: In function "_eagerly_encode_cf_datetime":
+ xarray/coding/times.py:909: error: No overload variant of "__call__" of "_ComparisonOpGT" matches argument type "timedelta64[timedelta | int | None]"  [operator]
+ xarray/coding/times.py:909: note: Possible overload variants:
+ xarray/coding/times.py:909: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ xarray/coding/times.py:909: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ xarray/coding/times.py: note: In function "_eagerly_encode_cf_timedelta":
+ xarray/coding/times.py:1034: error: No overload variant of "__call__" of "_ComparisonOpGT" matches argument type "timedelta64[timedelta | int | None]"  [operator]
+ xarray/coding/times.py:1034: note: Possible overload variants:
+ xarray/coding/times.py:1034: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ xarray/coding/times.py:1034: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ xarray/core/dataset.py: note: In member "dropna" of class "Dataset":
+ xarray/core/dataset.py:6606: error: Too many arguments for "__call__" of "_SignedIntOp"  [call-arg]
+ xarray/core/dataset.py: note: At top level:
+ xarray/core/dataset.py:9137: error: Unused "type: ignore" comment  [unused-ignore]
+ xarray/core/dataset.py: note: In member "polyfit" of class "Dataset":
+ xarray/core/dataset.py:9137: error: Unsupported operand types for * ("int" and "floating[Any]")  [operator]
+ xarray/core/dataset.py:9137: note: Error code "operator" not covered by "type: ignore" comment
+ xarray/core/dataset.py: note: At top level:

spark (https://github.com/apache/spark)
+ python/pyspark/pandas/indexing.py:1654: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ python/pyspark/pandas/indexing.py:1654: note: Possible overload variants:
+ python/pyspark/pandas/indexing.py:1654: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ python/pyspark/pandas/indexing.py:1654: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ python/pyspark/pandas/indexing.py:1654: note: Left operand is of type "int | signedinteger[_64Bit] | signedinteger[_32Bit]"
+ python/pyspark/pandas/indexing.py:1667: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ python/pyspark/pandas/indexing.py:1667: note: Possible overload variants:
+ python/pyspark/pandas/indexing.py:1667: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ python/pyspark/pandas/indexing.py:1667: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ python/pyspark/pandas/indexing.py:1667: note: Left operand is of type "int | signedinteger[_64Bit] | signedinteger[_32Bit]"
+ python/pyspark/ml/linalg/__init__.py:632: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ python/pyspark/ml/linalg/__init__.py:632: note: Possible overload variants:
+ python/pyspark/ml/linalg/__init__.py:632: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ python/pyspark/ml/linalg/__init__.py:632: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ python/pyspark/ml/linalg/__init__.py:637: error: No overload variant of "__call__" of "_ComparisonOpGE" matches argument type "int"  [operator]
+ python/pyspark/ml/linalg/__init__.py:637: note: Possible overload variants:
+ python/pyspark/ml/linalg/__init__.py:637: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ python/pyspark/ml/linalg/__init__.py:637: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_scalars.py:894: error: Expression is of type "builtins.bool", not "numpy.bool[builtins.bool]"  [assert-type]
+ tests/test_scalars.py:895: error: Expression is of type "builtins.bool", not "numpy.bool[builtins.bool]"  [assert-type]
+ tests/test_scalars.py:962: error: Expression is of type "builtins.bool", not "numpy.bool[builtins.bool]"  [assert-type]
+ tests/test_scalars.py:963: error: Expression is of type "builtins.bool", not "numpy.bool[builtins.bool]"  [assert-type]
+ tests/test_scalars.py:1286: error: Expression is of type "builtins.bool", not "numpy.bool[builtins.bool]"  [assert-type]
+ tests/test_scalars.py:1287: error: Expression is of type "builtins.bool", not "numpy.bool[builtins.bool]"  [assert-type]
+ tests/test_scalars.py:1330: error: Expression is of type "builtins.bool", not "numpy.bool[builtins.bool]"  [assert-type]
+ tests/test_scalars.py:1331: error: Expression is of type "builtins.bool", not "numpy.bool[builtins.bool]"  [assert-type]

materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/feature_benchmark/filter.py:31: error: Unsupported operand types for * ("int" and "floating[Any]")  [operator]

jax (https://github.com/google/jax)
+ jax/_src/nn/initializers.py:257: error: Too many arguments for "__call__" of "_BoolOp"  [call-arg]
+ jax/_src/nn/initializers.py:257: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ jax/_src/nn/initializers.py:257: note: Left operand is of type "Array | ndarray[Any, Any] | numpy.bool[builtins.bool] | number[Any, int | float | complex] | builtins.bool | int | float | complex"
+ jax/_src/numpy/reductions.py:770: error: Too many arguments for "__call__" of "_BoolOp"  [call-arg]
+ jax/_src/numpy/reductions.py:770: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ jax/_src/numpy/reductions.py:770: note: Left operand is of type "Array | ndarray[Any, Any] | numpy.bool[builtins.bool] | number[Any, int | float | complex] | int | float | complex"
+ jax/_src/numpy/reductions.py:771: error: Too many arguments for "__call__" of "_BoolOp"  [call-arg]
+ jax/_src/numpy/reductions.py:771: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ jax/_src/numpy/reductions.py:771: note: Left operand is of type "Array | ndarray[Any, Any] | numpy.bool[builtins.bool] | number[Any, int | float | complex] | builtins.bool | int | float | complex"
+ jax/_src/numpy/fft.py:1205: error: Too many arguments for "__call__" of "_BoolOp"  [call-arg]
+ jax/_src/numpy/fft.py:1205: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ jax/_src/numpy/fft.py:1205: note: Left operand is of type "Array | ndarray[Any, Any] | numpy.bool[builtins.bool] | number[Any, int | float | complex] | builtins.bool | int | float | complex"
+ jax/_src/numpy/fft.py:1248: error: Too many arguments for "__call__" of "_BoolOp"  [call-arg]
+ jax/_src/numpy/fft.py:1248: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ jax/_src/numpy/fft.py:1248: note: Left operand is of type "Array | ndarray[Any, Any] | numpy.bool[builtins.bool] | number[Any, int | float | complex] | builtins.bool | int | float | complex"
+ jax/_src/lax/slicing.py:3050: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ jax/_src/lax/slicing.py:3050: note: Possible overload variants:
+ jax/_src/lax/slicing.py:3050: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ jax/_src/lax/slicing.py:3050: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ jax/_src/lax/slicing.py:3050: note: Left operand is of type "int | integer[Any]"
+ jax/_src/lax/slicing.py:3054: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ jax/_src/lax/slicing.py:3054: note: Possible overload variants:
+ jax/_src/lax/slicing.py:3054: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ jax/_src/lax/slicing.py:3054: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ jax/_src/lax/slicing.py:3054: note: Left operand is of type "int | integer[Any]"
+ jax/_src/numpy/lax_numpy.py:4030: error: Too many arguments for "__call__" of "_BoolTrueDiv"  [call-arg]
+ jax/_src/numpy/lax_numpy.py:4030: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ jax/_src/numpy/lax_numpy.py:4030: note: Left operand is of type "Array | ndarray[Any, Any] | numpy.bool[builtins.bool] | number[Any, int | float | complex] | builtins.bool | int | float | complex"
+ jax/_src/numpy/lax_numpy.py:4031: error: Too many arguments for "__call__" of "_BoolTrueDiv"  [call-arg]
+ jax/_src/numpy/lax_numpy.py:4031: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ jax/_src/numpy/lax_numpy.py:4031: note: Left operand is of type "Array | ndarray[Any, Any] | numpy.bool[builtins.bool] | number[Any, int | float | complex] | builtins.bool | int | float | complex"
+ jax/_src/numpy/lax_numpy.py:7494: error: Unsupported operand types for * ("int" and "numpy.bool[builtins.bool]")  [operator]
+ jax/_src/numpy/lax_numpy.py:7494: error: Unsupported operand types for * ("int" and "number[Any, int | float | complex]")  [operator]
+ jax/_src/numpy/lax_numpy.py:7494: note: Both left and right operands are unions
+ jax/_src/numpy/lax_numpy.py:11923: error: No overload variant of "__call__" of "_ComparisonOpGE" matches argument type "int"  [operator]
+ jax/_src/numpy/lax_numpy.py:11923: note: Possible overload variants:
+ jax/_src/numpy/lax_numpy.py:11923: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ jax/_src/numpy/lax_numpy.py:11923: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ jax/_src/numpy/lax_numpy.py:11923: note: Left operand is of type "integer[Any] | int"
+ jax/_src/nn/functions.py:220: error: Too many arguments for "__call__" of "_BoolOp"  [call-arg]
+ jax/_src/nn/functions.py:220: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ jax/_src/nn/functions.py:220: note: Left operand is of type "Array | ndarray[Any, Any] | numpy.bool[builtins.bool] | number[Any, int | float | complex] | builtins.bool | int | float | complex"
+ jax/_src/nn/functions.py:767: error: Too many arguments for "__call__" of "_BoolOp"  [call-arg]
+ jax/_src/nn/functions.py:767: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ jax/_src/nn/functions.py:767: note: Left operand is of type "Array | ndarray[Any, Any] | numpy.bool[builtins.bool] | number[Any, int | float | complex] | builtins.bool | int | float | complex"
+ jax/_src/scipy/signal.py:796: error: Unsupported operand types for / ("int" and "numpy.bool[builtins.bool]")  [operator]
+ jax/_src/scipy/signal.py:796: error: Unsupported operand types for / ("int" and "number[Any, int | float | complex]")  [operator]
+ jax/_src/scipy/signal.py:796: note: Right operand is of type "Array | ndarray[Any, Any] | numpy.bool[builtins.bool] | number[Any, int | float | complex] | builtins.bool | int | float | complex"
+ jax/_src/scipy/signal.py:798: error: Unsupported operand types for / ("int" and "numpy.bool[builtins.bool]")  [operator]
+ jax/_src/scipy/signal.py:798: error: Unsupported operand types for / ("int" and "number[Any, int | float | complex]")  [operator]
+ jax/_src/scipy/signal.py:798: note: Right operand is of type "Array | ndarray[Any, Any] | numpy.bool[builtins.bool] | number[Any, int | float | complex] | builtins.bool | int | float | complex"
+ jax/_src/scipy/signal.py:821: error: Unsupported operand types for / ("float" and "numpy.bool[builtins.bool]")  [operator]
+ jax/_src/scipy/signal.py:821: error: Unsupported operand types for / ("float" and "number[Any, int | float | complex]")  [operator]
+ jax/_src/scipy/signal.py:821: note: Right operand is of type "Array | ndarray[Any, Any] | numpy.bool[builtins.bool] | number[Any, int | float | complex] | builtins.bool | int | float | complex"
+ jax/experimental/roofline/roofline.py:157: error: Too many arguments for "__call__" of "_SignedIntOp"  [call-arg]
+ jax/_src/pallas/utils.py:63: error: Too many arguments for "__call__" of "_SignedIntOp"  [call-arg]
+ jax/experimental/roofline/rooflines.py:73: error: Unsupported operand types for / ("int" and "signedinteger[_64Bit]")  [operator]
+ jax/_src/internal_test_util/test_harnesses.py:3424: error: No overload variant of "__call__" of "_ComparisonOpGE" matches argument type "int"  [operator]
+ jax/_src/internal_test_util/test_harnesses.py:3424: note: Possible overload variants:
+ jax/_src/internal_test_util/test_harnesses.py:3424: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ jax/_src/internal_test_util/test_harnesses.py:3424: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ jax/experimental/sparse/test_util.py:161: error: Unsupported operand types for * ("int" and "signedinteger[_64Bit]")  [operator]
+ jax/experimental/sparse/test_util.py:161: error: Unsupported operand types for * ("float" and "signedinteger[_64Bit]")  [operator]
+ jax/experimental/sparse/test_util.py:161: note: Left operand is of type "int | float"

schemathesis (https://github.com/schemathesis/schemathesis)
-   File "/tmp/mypy_primer/old_mypy/venv/bin/mypy", line 8, in <module>
+   File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
-   File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
+   File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
-   File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 119, in main
+   File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 119, in main
-   File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 203, in run_build
+   File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 203, in run_build
-   File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 191, in build
+   File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 191, in build
-   File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 267, in _build
+   File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 267, in _build
-   File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 2947, in dispatch
+   File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 2947, in dispatch
-   File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 976, in write_deps_cache
+   File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 976, in write_deps_cache

antidote (https://github.com/Finistere/antidote)
+ tests/test_examples.py:37: error: Invalid self argument "Files" to attribute function "read" with type "Callable[[str], str]"  [misc]
+ tests/test_examples.py:37: error: Too many arguments for "__call__" of "InjectedMethod"  [call-arg]
+ tests/test_examples.py:41: error: Invalid self argument "Files" to attribute function "read" with type "Callable[[str], str]"  [misc]
+ tests/test_examples.py:41: error: Too many arguments for "__call__" of "InjectedMethod"  [call-arg]
+ tests/core/test_inject.py:517: error: Attribute function "method" with type "Callable[[], object]" does not accept self argument  [misc]
+ tests/core/test_inject.py:519: error: Invalid self argument "Conf" to attribute function "get" with type "Callable[[str], object]"  [misc]
+ tests/core/test_inject.py:519: error: Too many arguments for "__call__" of "InjectedMethod"  [call-arg]
+ tests/core/test_inject.py:522: error: Attribute function "method" with type "Callable[[], object]" does not accept self argument  [misc]
+ tests/core/test_inject.py:523: error: Invalid self argument "Conf" to attribute function "get" with type "Callable[[str], object]"  [misc]
+ tests/core/test_inject.py:523: error: Unexpected keyword argument "key" for "__call__" of "InjectedMethod"  [call-arg]
+ src/antidote/core/__init__.py:1305: note: "__call__" of "InjectedMethod" defined here

scipy (https://github.com/scipy/scipy)
+ scipy/stats/_multicomp.py:99: error: Unsupported operand types for - ("int" and "floating[Any]")  [operator]
+ scipy/stats/_multicomp.py:99: error: Unsupported operand types for - ("int" and "integer[Any]")  [operator]
+ scipy/stats/_multicomp.py:99: note: Right operand is of type "float | floating[Any] | integer[Any]"
+ scipy/stats/_multicomp.py:121: error: Too many arguments for "__call__" of "_FloatOp"  [call-arg]
+ scipy/stats/_multicomp.py:121: error: Too many arguments for "__call__" of "_NumberOp"  [call-arg]
+ scipy/stats/_multicomp.py:121: note: Left operand is of type "float | floating[Any] | integer[Any]"
+ scipy/stats/_multicomp.py:160: error: Unsupported operand types for < ("int" and "floating[Any]")  [operator]
+ scipy/stats/_multicomp.py:160: error: Unsupported operand types for < ("int" and "integer[Any]")  [operator]
+ scipy/stats/_multicomp.py:160: note: Right operand is of type "float | floating[Any] | integer[Any]"
+ scipy/stats/_multicomp.py:160: error: No overload variant of "__call__" of "_ComparisonOpLT" matches argument type "int"  [operator]
+ scipy/stats/_multicomp.py:160: note: Possible overload variants:
+ scipy/stats/_multicomp.py:160: note:     def __call__(self) -> numpy.bool[builtins.bool]
+ scipy/stats/_multicomp.py:160: note:     def __call__(self) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]
+ scipy/stats/_multicomp.py:160: note: Left operand is of type "float | floating[Any] | integer[Any]"
+ scipy/spatial/tests/test_qhull.py:62: error: Unsupported operand types for - ("int" and "floating[_64Bit]")  [operator]
+ scipy/interpolate/tests/test_bary_rational.py:34: error: Unsupported operand types for * ("float" and "floating[_64Bit]")  [operator]

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.

hinting method decorators with protocols fails to remove the self attribute when binding
3 participants