Document that nested Any makes overload matching ambiguous - #21897
Open
hasancankeles wants to merge 4 commits into
Open
Document that nested Any makes overload matching ambiguous#21897hasancankeles wants to merge 4 commits into
hasancankeles wants to merge 4 commits into
Conversation
Fixes python#21768. Sequence[Any] matching both Sequence[int] and object is ambiguous under the typing spec's overload call evaluation rules, so the Any result is intended. Clarify the docs and lock the behavior in with tests.
The reporter's first-match expectation is unsound: a Sequence[str] inhabits Sequence[Any] and selects the object overload (int). The spec step-5 three-overload example and the existing list[int]/list[str] matrix also require Any. Nested Any still does not collapse when only one overload remains.
The nested-Any overload rule is unchanged from mypy 2.2.0 through current main. Broaden the regression tests to dict values, tuples, methods, and full typeshed (collections.abc.Sequence). Record that type aliases still first-match because alias Any is a special form (python#15630); that is not this issue and is not a backport candidate.
This comment has been minimized.
This comment has been minimized.
Alias targets store a written Any as TypeOfAny.special_form, so has_any_type ignored Nested = Sequence[Any] and picked the first overload. That contradicted the new docs and the spec (aliases are transparent). Count special-form Any only while expanding aliases. Docs now include an alias example. Tests cover nested and bare Any aliases, including the python#15630 identity-check repro.
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: spark (https://github.com/apache/spark)
+ python/pyspark/pandas/series.py:7490: error: Unexpected keyword argument "length" for overloaded function "to_string" of "DataFrame" [call-overload]
colour (https://github.com/colour-science/colour)
- colour/algebra/common.py:614: error: Unsupported operand types for * ("ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]" and "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]") [operator]
- colour/algebra/common.py:614: error: Invalid index type "tuple[EllipsisType, None]" for "floating[_16Bit]"; expected type "tuple[()]" [index]
- colour/algebra/common.py:614: error: Invalid index type "tuple[EllipsisType, None]" for "floating[_32Bit]"; expected type "tuple[()]" [index]
- colour/algebra/common.py:614: error: Invalid index type "tuple[EllipsisType, None]" for "float64"; expected type "tuple[()]" [index]
- colour/temperature/krystek1985.py:117: error: No overload variant of "minimize" matches argument types "Callable[[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]], ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]], floating[_16Bit] | floating[_32Bit] | float64]", "list[int]", "tuple[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]]", "dict[str, Collection[str]]" [call-overload]
+ colour/temperature/krystek1985.py:117: error: No overload variant of "minimize" matches argument types "Callable[[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]], ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]], floating[_16Bit] | floating[_32Bit] | float64]", "list[int]", "tuple[Any]", "dict[str, Collection[str]]" [call-overload]
- colour/temperature/kang2002.py:112: error: No overload variant of "minimize" matches argument types "Callable[[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]], ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]], floating[_16Bit] | floating[_32Bit] | float64]", "list[int]", "tuple[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]]", "dict[str, Collection[str]]" [call-overload]
+ colour/temperature/kang2002.py:112: error: No overload variant of "minimize" matches argument types "Callable[[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]], ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]], floating[_16Bit] | floating[_32Bit] | float64]", "list[int]", "tuple[Any]", "dict[str, Collection[str]]" [call-overload]
- colour/phenomena/tmm.py:180: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[generic[Any]]]" and "ndarray[tuple[Any, ...], dtype[generic[Any]]]") [operator]
+ colour/appearance/hunt.py:607: error: Incompatible return value type (got "floating[_16Bit] | floating[_32Bit] | float64 | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]", expected "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]") [return-value]
- colour/continuous/signal.py:838: error: No overload variant of "__le__" of "number" matches argument type "Buffer" [operator]
- colour/continuous/signal.py:838: note: Possible overload variants:
- colour/continuous/signal.py:838: note: def __le__(self, complex | number[Any, Any] | numpy.bool[builtins.bool], /) -> numpy.bool[builtins.bool]
- colour/continuous/signal.py:838: note: def __le__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex] | _NestedSequence[_SupportsGE], /) -> ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]
- colour/continuous/signal.py:838: note: def __le__(self, _SupportsGE, /) -> numpy.bool[builtins.bool]
- colour/continuous/signal.py:838: error: Unsupported operand types for <= ("floating[_16Bit]" and "_NestedSequence[complex | bytes | str]") [operator]
- colour/continuous/signal.py:838: error: Unsupported operand types for <= ("floating[_32Bit]" and "_NestedSequence[complex | bytes | str]") [operator]
- colour/continuous/signal.py:838: error: Unsupported operand types for <= ("float64" and "_NestedSequence[complex | bytes | str]") [operator]
- colour/continuous/signal.py:838: error: No overload variant of "__le__" of "number" matches argument type "slice[Any, Any, Any]" [operator]
- colour/continuous/signal.py:838: note: Both left and right operands are unions
- colour/continuous/signal.py:839: error: No overload variant of "__ge__" of "number" matches argument type "Buffer" [operator]
- colour/continuous/signal.py:839: note: Possible overload variants:
- colour/continuous/signal.py:839: note: def __ge__(self, complex | number[Any, Any] | numpy.bool[builtins.bool], /) -> numpy.bool[builtins.bool]
- colour/continuous/signal.py:839: note: def __ge__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex] | _NestedSequence[_SupportsLE], /) -> ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]
- colour/continuous/signal.py:839: note: def __ge__(self, _SupportsLE, /) -> numpy.bool[builtins.bool]
- colour/continuous/signal.py:839: error: Unsupported operand types for >= ("floating[_16Bit]" and "_NestedSequence[complex | bytes | str]") [operator]
- colour/continuous/signal.py:839: error: Unsupported operand types for >= ("floating[_32Bit]" and "_NestedSequence[complex | bytes | str]") [operator]
- colour/continuous/signal.py:839: error: Unsupported operand types for >= ("float64" and "_NestedSequence[complex | bytes | str]") [operator]
- colour/continuous/signal.py:839: error: No overload variant of "__ge__" of "number" matches argument type "slice[Any, Any, Any]" [operator]
- colour/continuous/signal.py:839: note: Both left and right operands are unions
- colour/colorimetry/tristimulus_values.py:480: error: No overload variant of "__mul__" of "ndarray" matches argument type "object" [operator]
- colour/colorimetry/tristimulus_values.py:480: note: Possible overload variants:
- colour/colorimetry/tristimulus_values.py:480: note: def __mul__(self, int | numpy.bool[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[floating[Any]]]
- colour/colorimetry/tristimulus_values.py:480: note: def __mul__(self, _SupportsArray[dtype[numpy.bool[builtins.bool]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool]]]] | builtins.bool | _NestedSequence[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[floating[Any]]]
- colour/colorimetry/tristimulus_values.py:480: note: def __mul__(self, _SupportsArray[dtype[floating[_64Bit]]] | _NestedSequence[_SupportsArray[dtype[floating[_64Bit]]]], /) -> ndarray[tuple[Any, ...], dtype[float64]]
- colour/colorimetry/tristimulus_values.py:480: note: def __mul__(self, _SupportsArray[dtype[complexfloating[_64Bit, _64Bit]]] | _NestedSequence[_SupportsArray[dtype[complexfloating[_64Bit, _64Bit]]]], /) -> ndarray[tuple[Any, ...], dtype[complex128]]
- colour/colorimetry/tristimulus_values.py:480: note: def __mul__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]]] | float | _NestedSequence[float], /) -> ndarray[tuple[Any, ...], dtype[floating[Any]]]
- colour/colorimetry/tristimulus_values.py:480: note: def __mul__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex], /) -> ndarray[tuple[Any, ...], dtype[complexfloating[Any, Any]]]
- colour/colorimetry/tristimulus_values.py:480: note: def __mul__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex], /) -> ndarray[tuple[Any, ...], dtype[number[Any, Any]]]
- colour/colorimetry/tristimulus_values.py:480: note: def __mul__(self, _SupportsArray[dtype[timedelta64[Any]]] | _NestedSequence[_SupportsArray[dtype[timedelta64[Any]]]], /) -> ndarray[tuple[Any, ...], dtype[timedelta64[Any]]]
- colour/colorimetry/tristimulus_values.py:480: note: def __mul__(self, _SupportsArray[dtype[object_]] | _NestedSequence[_SupportsArray[dtype[object_]]], /) -> Any
- colour/temperature/planck1900.py:120: error: No overload variant of "minimize" matches argument types "Callable[[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]], ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]], floating[_16Bit] | floating[_32Bit] | float64]", "list[int]", "tuple[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]]", "dict[str, Collection[str]]" [call-overload]
+ colour/temperature/planck1900.py:120: error: No overload variant of "minimize" matches argument types "Callable[[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]], ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]], floating[_16Bit] | floating[_32Bit] | float64]", "list[int]", "tuple[Any]", "dict[str, Collection[str]]" [call-overload]
- colour/temperature/mccamy1992.py:160: error: No overload variant of "minimize" matches argument types "Callable[[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]], ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]], floating[_16Bit] | floating[_32Bit] | float64]", "Any", "tuple[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]]", "dict[str, Collection[str]]" [call-overload]
+ colour/temperature/mccamy1992.py:160: error: No overload variant of "minimize" matches argument types "Callable[[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]], ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]], floating[_16Bit] | floating[_32Bit] | float64]", "Any", "tuple[Any]", "dict[str, Collection[str]]" [call-overload]
- colour/temperature/hernandez1999.py:176: error: No overload variant of "minimize" matches argument types "Callable[[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]], ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]], floating[_16Bit] | floating[_32Bit] | float64]", "Any", "tuple[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]]", "dict[str, Collection[str]]" [call-overload]
+ colour/temperature/hernandez1999.py:176: error: No overload variant of "minimize" matches argument types "Callable[[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]], ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]], floating[_16Bit] | floating[_32Bit] | float64]", "Any", "tuple[Any]", "dict[str, Collection[str]]" [call-overload]
- colour/temperature/cie_d.py:113: error: No overload variant of "minimize" matches argument types "Callable[[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]], ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]], floating[_16Bit] | floating[_32Bit] | float64]", "list[int]", "tuple[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]]", "dict[str, Collection[str]]" [call-overload]
+ colour/temperature/cie_d.py:113: error: No overload variant of "minimize" matches argument types "Callable[[ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]], ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]], floating[_16Bit] | floating[_32Bit] | float64]", "list[int]", "tuple[Any]", "dict[str, Collection[str]]" [call-overload]
- colour/plotting/common.py:1369: error: Incompatible types in assignment (expression has type "ColourSwatch", variable has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]") [assignment]
- colour/plotting/common.py:1380: error: "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]" has no attribute "RGB" [attr-defined]
- colour/plotting/common.py:1411: error: "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]" has no attribute "name" [attr-defined]
- colour/plotting/common.py:1415: error: "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]" has no attribute "name" [attr-defined]
+ colour/plotting/section.py:262: error: Unused "type: ignore" comment [unused-ignore]
- colour/phenomena/tests/test_tmm.py:287: error: Unsupported operand types for >= ("ndarray[tuple[Any, ...], dtype[generic[Any]]]" and "int") [operator]
- colour/phenomena/tests/test_tmm.py:288: error: Unsupported operand types for <= ("ndarray[tuple[Any, ...], dtype[generic[Any]]]" and "int") [operator]
- colour/models/rgb/transfer_functions/tests/test_aces.py:84: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64 | signedinteger[_8Bit] | signedinteger[_16Bit] | <6 more items>]]", variable has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | ndarray[tuple[Any, ...], dtype[signedinteger[_8Bit] | signedinteger[_16Bit] | signedinteger[_32Bit] | signedinteger[_64Bit] | unsignedinteger[_8Bit] | unsignedinteger[_16Bit] | unsignedinteger[_32Bit] | unsignedinteger[_64Bit]]]") [assignment]
Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/_internal/__init__.py:724: error: Item "list[tuple[list[str], MessageCommand[Any]]]" of "_TreeT | list[tuple[list[str], MessageCommand[Any]]]" has no attribute "get" [union-attr]
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/series/test_truediv.py:149: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/series/test_truediv.py:152: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/series/test_truediv.py:155: error: Expression is of type "Any", not "Never" [assert-type]
+ tests/series/test_truediv.py:195: error: Expression is of type "Any", not "Never" [assert-type]
+ tests/series/test_truediv.py:205: error: Expression is of type "Any", not "Never" [assert-type]
+ tests/series/test_sub.py:246: error: Expression is of type "Any", not "Series[Timedelta]" [assert-type]
+ tests/series/test_mul.py:80: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/series/test_mul.py:81: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/series/test_mul.py:82: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/series/test_mul.py:83: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/series/test_floordiv.py:124: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/series/test_floordiv.py:125: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/series/test_floordiv.py:126: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/series/test_floordiv.py:135: error: Expression is of type "Any", not "Never" [assert-type]
+ tests/series/test_floordiv.py:171: error: Expression is of type "Any", not "Never" [assert-type]
+ tests/series/test_floordiv.py:180: error: Expression is of type "Series[Any]", not "Series[Timedelta]" [assert-type]
+ tests/series/test_add.py:83: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/series/test_add.py:84: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/series/test_add.py:85: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/series/test_add.py:86: error: Expression is of type "Any", not "Series[Any]" [assert-type]
+ tests/indexes/test_truediv.py:61: error: Expression is of type "Any", not "Index[Any]" [assert-type]
+ tests/indexes/test_mul.py:60: error: Expression is of type "Any", not "Index[Any]" [assert-type]
+ tests/indexes/test_mul.py:62: error: Expression is of type "Any", not "Index[Any]" [assert-type]
+ tests/indexes/test_mul.py:63: error: Expression is of type "Any", not "Index[Any]" [assert-type]
+ tests/indexes/test_floordiv.py:84: error: Expression is of type "Any", not "Index[Any]" [assert-type]
+ tests/indexes/test_floordiv.py:85: error: Expression is of type "Any", not "Index[Any]" [assert-type]
+ tests/indexes/test_floordiv.py:86: error: Expression is of type "Any", not "Index[Any]" [assert-type]
+ tests/indexes/test_add.py:56: error: Expression is of type "Any", not "Index[Any]" [assert-type]
+ tests/indexes/test_add.py:57: error: Expression is of type "Any", not "Index[Any]" [assert-type]
+ tests/indexes/test_add.py:58: error: Expression is of type "Any", not "Index[Any]" [assert-type]
+ tests/indexes/test_add.py:59: error: Expression is of type "Any", not "Index[Any]" [assert-type]
+ tests/scalars/test_scalars.py:1939: error: Expression is of type "Any", not "ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]" [assert-type]
+ tests/scalars/test_scalars.py:1944: error: Expression is of type "Any", not "ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]" [assert-type]
+ tests/indexes/test_indexes.py:627: error: Expression is of type "IntervalIndex[Any]", not "IntervalIndex[Interval[int]]" [assert-type]
+ tests/indexes/test_indexes.py:635: error: Expression is of type "IntervalIndex[Any]", not "IntervalIndex[Interval[float]]" [assert-type]
+ tests/indexes/test_indexes.py:738: error: Expression is of type "IntervalIndex[Any]", not "IntervalIndex[Interval[int]]" [assert-type]
+ tests/indexes/test_indexes.py:749: error: Expression is of type "IntervalIndex[Any]", not "IntervalIndex[Interval[float]]" [assert-type]
+ tests/arrays/test_timedeltas.py:60: error: Expression is of type "Any", not "TimedeltaArray" [assert-type]
+ tests/arrays/test_categorical.py:58: error: Expression is of type "Categorical[Any]", not "Categorical[str]" [assert-type]
+ tests/series/float/test_dtypes.py:26: error: Expression is of type "Series[Any]", not "Series[float]" [assert-type]
+ tests/indexes/float/test_dtypes.py:30: error: Expression is of type "Any", not "Index[float]" [assert-type]
+ tests/arrays/test_integer.py:73: error: Expression is of type "Any", not "IntegerArray" [assert-type]
+ tests/arrays/test_floating.py:85: error: Expression is of type "Any", not "FloatingArray" [assert-type]
+ tests/arrays/test_datetime_array.py:354: error: Expression is of type "Any", not "DatetimeArray" [assert-type]
+ tests/arrays/test_boolean.py:60: error: Expression is of type "Any", not "BooleanArray" [assert-type]
+ tests/arrays/test_base_string_.py:65: error: Expression is of type "Any", not "BaseStringArray[None]" [assert-type]
trio (https://github.com/python-trio/trio)
+ src/trio/_socket.py:760: error: Type of decorated function contains type "Any" ("Callable[[SocketType, Iterable[Buffer], Iterable[tuple[int, int, Buffer]], int, Any | None], Coroutine[Any, Any, int]]") [misc]
+ src/trio/_socket.py:1288: error: Type of decorated function contains type "Any" ("Callable[[_SocketType, Iterable[Buffer], Iterable[tuple[int, int, Buffer]], int, Any | None], Coroutine[Any, Any, int]]") [misc]
+ src/trio/_core/_run.py:2713: error: Type of decorated function contains type "Any" ("Callable[[Runner, def (*args: *PosArgT) -> Awaitable[object], tuple[*PosArgT], bool], Generator[float, list[tuple[int, int]], None]]") [misc]
+ src/trio/_core/_tests/test_io.py:96: error: Function is untyped after decorator transformation [misc]
+ src/trio/_core/_tests/test_io.py:166: error: Function is untyped after decorator transformation [misc]
+ src/trio/_core/_tests/test_io.py:179: error: Function is untyped after decorator transformation [misc]
+ src/trio/_core/_tests/test_io.py:195: error: Function is untyped after decorator transformation [misc]
+ src/trio/_core/_tests/test_io.py:222: error: Function is untyped after decorator transformation [misc]
+ src/trio/_core/_tests/test_io.py:254: error: Function is untyped after decorator transformation [misc]
+ src/trio/_tests/test_subprocess.py:123: error: Function is untyped after decorator transformation [misc]
+ src/trio/_tests/test_subprocess.py:141: error: Function is untyped after decorator transformation [misc]
+ src/trio/_tests/test_subprocess.py:161: error: Function is untyped after decorator transformation [misc]
+ src/trio/_tests/test_subprocess.py:176: error: Function is untyped after decorator transformation [misc]
+ src/trio/_tests/test_subprocess.py:196: error: Function is untyped after decorator transformation [misc]
+ src/trio/_tests/test_subprocess.py:224: error: Function is untyped after decorator transformation [misc]
+ src/trio/_tests/test_subprocess.py:259: error: Function is untyped after decorator transformation [misc]
+ src/trio/_tests/test_subprocess.py:425: error: Function is untyped after decorator transformation [misc]
+ src/trio/_tests/test_subprocess.py:509: error: Function is untyped after decorator transformation [misc]
+ src/trio/_tests/test_subprocess.py:540: error: Function is untyped after decorator transformation [misc]
+ src/trio/_tests/test_subprocess.py:562: error: Function is untyped after decorator transformation [misc]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/algorithms.py:683: error: Item "SequenceNotStr[Any]" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | Index | Series | SequenceNotStr[Any] | range" has no attribute "dtype" [union-attr]
+ pandas/core/algorithms.py:683: error: Item "range" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | Index | Series | SequenceNotStr[Any] | range" has no attribute "dtype" [union-attr]
+ pandas/core/algorithms.py:683: error: Argument 1 to "np_find_common_type" has incompatible type "ExtensionDtype | dtype[Any] | Any"; expected "dtype[Any]" [arg-type]
+ pandas/core/algorithms.py:685: error: Argument 1 to "_may_lose_precision_as_float64" has incompatible type "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | Index | Series | SequenceNotStr[Any] | range"; expected "ndarray[tuple[Any, ...], dtype[Any]]" [arg-type]
+ pandas/core/algorithms.py:707: error: Item "builtins.bool" of "builtins.bool | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | NDFrame" has no attribute "any" [union-attr]
+ pandas/core/algorithms.py:719: error: Item "SequenceNotStr[Any]" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | Index | Series | SequenceNotStr[Any] | range" has no attribute "astype" [union-attr]
+ pandas/core/algorithms.py:719: error: Item "range" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | Index | Series | SequenceNotStr[Any] | range" has no attribute "astype" [union-attr]
+ pandas/core/arrays/base.py:3173: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/io/parsers/base_parser.py:530: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/io/parsers/base_parser.py:532: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/io/formats/format.py:1264: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/core/internals/managers.py:600: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/core/indexes/base.py:6116: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/core/groupby/groupby.py:4553: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/core/resample.py:2835: error: Unused "type: ignore" comment [unused-ignore]
jax (https://github.com/google/jax)
- jax/experimental/mosaic/gpu/mma.py:158: error: Incompatible types in assignment (expression has type "ndarray[tuple[()], Any]", variable has type "list[Any]") [assignment]
+ jax/experimental/mosaic/gpu/mma.py:158: error: Incompatible types in assignment (expression has type "ndarray[Any, Any]", variable has type "list[Any]") [assignment]
- jax/_src/third_party/scipy/special.py:304: note: Left operand is of type "Array | ndarray[tuple[Any, ...], dtype[Any]] | ndarray[tuple[Any, ...], dtype[number[Any, Any]]] | ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]] | <7 more items>"
+ jax/_src/third_party/scipy/special.py:304: note: Left operand is of type "Array | ndarray[tuple[Any, ...], dtype[Any]] | Any | ndarray[tuple[Any, ...], dtype[number[Any, Any]]] | ndarray[tuple[Any, ...], dtype[float64]] | <7 more items>"
meson (https://github.com/mesonbuild/meson)
+ mesonbuild/interpreter/interpreter.py:2082:13: error: Returning Any from function declared to return "Executable | StaticLibrary | SharedLibrary | SharedModule | BothLibraries | Jar" [no-any-return]
static-frame (https://github.com/static-frame/static-frame)
+ static_frame/core/util.py:2656: error: Returning Any from function declared to return "ndarray[Any, Any]" [no-any-return]
+ static_frame/core/util.py:2698: error: Returning Any from function declared to return "ndarray[Any, Any]" [no-any-return]
+ static_frame/core/util.py:2961: error: Returning Any from function declared to return "ndarray[Any, Any]" [no-any-return]
+ static_frame/core/rank.py:166: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/node_fill_value.py:211: error: Returning Any from function declared to return "Frame[Any, Any, *tuple[Any, ...]] | Series[Any, Any]" [no-any-return]
+ static_frame/core/container_util.py:1782: error: Returning Any from function declared to return "Hashable | int | integer[Any] | builtins.bool | numpy.bool[builtins.bool] | float | <9 more items> | None" [no-any-return]
+ static_frame/core/series.py:3391: error: Returning Any from function declared to return "TLabel | ndarray[Any, Any]" [no-any-return]
scipy-stubs (https://github.com/scipy/scipy-stubs)
+ tests/spatial/test_distance.pyi:85: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[floating[_32Bit]]]" [assert-type]
+ tests/spatial/test_distance.pyi:89: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[floating[_32Bit]]]" [assert-type]
+ tests/spatial/test_distance.pyi:137: error: Expression is of type "Any", not "float64" [assert-type]
+ tests/spatial/test_distance.pyi:140: error: Expression is of type "Any", not "float64" [assert-type]
+ tests/spatial/test_distance.pyi:141: error: Expression is of type "Any", not "complex128" [assert-type]
+ tests/spatial/test_distance.pyi:142: error: Expression is of type "Any", not "complex128" [assert-type]
+ tests/spatial/test_distance.pyi:143: error: Expression is of type "Any", not "complex128" [assert-type]
+ tests/spatial/test_distance.pyi:148: error: Expression is of type "Any", not "float64" [assert-type]
+ tests/spatial/test_distance.pyi:149: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:150: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:151: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:152: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:153: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:168: error: Expression is of type "Any", not "float64" [assert-type]
+ tests/spatial/test_distance.pyi:169: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:170: error: Expression is of type "Any", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:171: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:172: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:173: error: Expression is of type "Any", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:174: error: Expression is of type "Any", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:175: error: Expression is of type "Any", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:176: error: Expression is of type "Any", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:179: error: Expression is of type "Any", not "float64" [assert-type]
+ tests/spatial/test_distance.pyi:180: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:181: error: Expression is of type "Any", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:182: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:183: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:184: error: Expression is of type "Any", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:185: error: Expression is of type "Any", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:186: error: Expression is of type "Any", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:187: error: Expression is of type "Any", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:190: error: Expression is of type "Any", not "float64" [assert-type]
+ tests/spatial/test_distance.pyi:191: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:192: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:193: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/spatial/test_distance.pyi:194: error: Expression is of type "Any", not "complex128" [assert-type]
+ tests/spatial/test_distance.pyi:195: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[complex128]]" [assert-type]
+ tests/spatial/test_distance.pyi:196: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[complex128]]" [assert-type]
+ tests/spatial/test_distance.pyi:197: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[complex128]]" [assert-type]
+ tests/spatial/test_distance.pyi:198: error: Expression is of type "Any", not "complex128" [assert-type]
+ tests/spatial/test_distance.pyi:199: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[complex128]]" [assert-type]
+ tests/spatial/test_distance.pyi:200: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[complex128]]" [assert-type]
+ tests/spatial/test_distance.pyi:201: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[complex128]]" [assert-type]
+ tests/spatial/test_distance.pyi:202: error: Expression is of type "Any", not "complex128" [assert-type]
+ tests/spatial/test_distance.pyi:203: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[complex128]]" [assert-type]
+ tests/spatial/test_distance.pyi:204: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[complex128]]" [assert-type]
+ tests/spatial/test_distance.pyi:205: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[complex128]]" [assert-type]
+ tests/sparse/linalg/test__minres.pyi:25: error: Expression is of type "tuple[Any, ...]", not "tuple[ndarray[tuple[int], dtype[floating[_32Bit]]], int]" [assert-type]
+ tests/sparse/linalg/test__minres.pyi:27: error: Expression is of type "tuple[Any, ...]", not "tuple[ndarray[tuple[int], dtype[complexfloating[_32Bit, _32Bit]]], int]" [assert-type]
+ tests/sparse/linalg/test__minres.pyi:28: error: Expression is of type "tuple[Any, ...]", not "tuple[ndarray[tuple[int], dtype[complex128]], int]" [assert-type]
+ tests/sparse/linalg/test__matfuncs.pyi:138: error: Expression is of type "Any", not "dok_array[signedinteger[_16Bit], tuple[int, int]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:33: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:34: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:35: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:37: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:38: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:39: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:41: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:42: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:43: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:45: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:46: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:47: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:49: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:50: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:51: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:53: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:54: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:55: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:57: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:58: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:59: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:61: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:62: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:63: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:65: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:66: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:67: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:69: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:70: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:71: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:73: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:74: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:75: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:77: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:78: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__expm_multiply.pyi:79: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:58: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:59: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:62: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[complex128]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:63: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[complex128]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:66: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:67: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[floating[_32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:70: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[complexfloating[_32Bit, _32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:71: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[complexfloating[_32Bit, _32Bit]]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:85: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:86: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:87: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[complex128]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:88: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[complex128]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:91: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:92: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:93: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[complex128]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:94: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[complex128]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:116: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:117: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:118: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type]
+ tests/sparse/linalg/test__dsolve.pyi:121: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[complex128]]" [assert-type]
+ tests/ndimage/test__morphology.pyi:54: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[numpy.bool[builtins.bool]]]" [assert-type]
+ tests/ndimage/test__morphology.pyi:55: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int], dtype[numpy.bool[builtins.bool]]]" [assert-type]
+ tests/ndimage/test__morphology.pyi:57: error: Expression is of type "tuple[Any, ...]", not "tuple[ndarray[tuple[int], dtype[numpy.bool[builtins.bool]]], list[int]]" [assert-type]
+ tests/ndimage/test__morphology.pyi:58: error: Expression is of type "tuple[Any, ...]", not "tuple[ndarray[tuple[int, int], dtype[numpy.bool[builtins.bool]]], list[int]]" [assert-type]
... (truncated 4355 lines) ...
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #21768. Also covers the overload half of #15630.
Decision
The docs said nested
Anyis ambiguous. A type alias that expands to the same type (Nested = Sequence[Any]) still first-matched, because alias targets store writtenAnyasTypeOfAny.special_formandhas_any_typeignored that.reveal_typeeven printsSequence[Any]. Shipping that wording would have promised behavior mypy did not give.Two options:
(2) is the safer product path: the user-facing rule stays one sentence, and it matches both the spec and a direct
Sequence[Any]annotation. The implementation is narrow: countspecial_formAny only while expanding aTypeAliasType. Other special-form Anys (incomplete types,_, NewType placeholders) are unchanged.Proof
On 2.2.0 / 2.3.1 / unfixed main,
Nested = Sequence[Any]first-matches (str). With this change, old-style aliases,TypeAlias, and PEP 695 aliases all returnAny, same as a writtenSequence[Any].The #15630 repro (
TypeSpec = Any;my_origin(spec) is Unionunder--strict) no longer reports[comparison-overlap]. 2.3.1 still reports it.Local tests:
check-overloading.test: 283 passed, 1 skippedcollections.abc.SequenceThe #21768 call (
Sequence[Any]vsSequence[int]/object) is stillAny. This does not pick the first overload for that case.Not a backport
This is a behavior change for alias arguments (first-match →
Any). 2.2 and 2.3 still first-match. There is norelease-2.2/release-2.3branch onorigin, and this should not be cherry-picked onto a stable release without its own review.What this PR changes
Anyis ambiguous, including via a type alias, with examples.HasAnyTypecounts special-form Any only inside alias expansion.Any, dict/tuple/methods, inhabitation, spec three-overload, full stubs, nested aliases, and the Wrong overload resolution with alias to Any #15630 identity check.