Skip to content

fix: validate TypeVar upper bound when inferring self-type arguments in bind_self#21649

Closed
muhamedfazalps wants to merge 2 commits into
python:masterfrom
muhamedfazalps:fix/typevar-bound-self-param
Closed

fix: validate TypeVar upper bound when inferring self-type arguments in bind_self#21649
muhamedfazalps wants to merge 2 commits into
python:masterfrom
muhamedfazalps:fix/typevar-bound-self-param

Conversation

@muhamedfazalps

@muhamedfazalps muhamedfazalps commented Jun 26, 2026

Copy link
Copy Markdown

mypy_primer revealed regressions in spack, psycopg, optuna where the bound-based fallback was too aggressive. Reverting while I design a more precise fix.

…in bind_self

When a method has a self-parameter annotated with a TypeVar (e.g.,
self: list[SupportsRichComparisonT]), bind_self() infers the type
arguments by matching the actual object type against the self-parameter
type. Previously, these inferred types were applied without checking
whether they satisfy the TypeVar's upper bound.

This caused overloaded methods like list.sort() to silently accept
invalid type arguments. For example, mypy would not report an error
for calling sort() on list[int | None], even though None does not
satisfy the SupportsRichComparison bound.

The fix adds a validation step after infer_type_arguments() in bind_self()
that checks each inferred type against its TypeVar's upper bound. If an
inferred type violates the bound, the upper bound is used as a fallback,
consistent with the behavior of pre_validate_solutions() in solve.py.
@github-actions

Copy link
Copy Markdown
Contributor

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

spack (https://github.com/spack/spack)
+ lib/spack/spack/util/url.py:100: error: "tuple[str, str, str, str, str, str]" has no attribute "geturl"  [attr-defined]
+ lib/spack/spack/oci/opener.py:291: error: "tuple[str, str, str, str, str, str]" has no attribute "scheme"  [attr-defined]
+ lib/spack/spack/oci/opener.py:292: error: "tuple[str, str, str, str, str, str]" has no attribute "scheme"  [attr-defined]

psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/connection_async.py:165: error: "BaseConnection[Row]" has no attribute "row_factory"  [attr-defined]
+ psycopg/psycopg/connection_async.py:167: error: "BaseConnection[Row]" has no attribute "cursor_factory"  [attr-defined]
+ psycopg/psycopg/connection_async.py:171: error: Incompatible return value type (got "BaseConnection[Row]", expected "Self")  [return-value]
+ psycopg/psycopg/connection.py:144: error: "BaseConnection[Row]" has no attribute "row_factory"  [attr-defined]
+ psycopg/psycopg/connection.py:146: error: "BaseConnection[Row]" has no attribute "cursor_factory"  [attr-defined]
+ psycopg/psycopg/connection.py:150: error: Incompatible return value type (got "BaseConnection[Row]", expected "Self")  [return-value]
+ tests/typing_example.py:62: error: Incompatible types in assignment (expression has type "Cursor[Person]", variable has type "ServerCursor[Person]")  [assignment]
+ tests/typing_example.py:87: error: Incompatible types in assignment (expression has type "AsyncCursor[Person]", variable has type "AsyncServerCursor[Person]")  [assignment]
+ tests/test_cursor_server_async.py:40: error: "AsyncCursor[NamedTuple]" has no attribute "name"  [attr-defined]
+ tests/test_cursor_server.py:40: error: "Cursor[NamedTuple]" has no attribute "name"  [attr-defined]

optuna (https://github.com/optuna/optuna)
+ optuna/samplers/nsgaii/_crossovers/_undx.py:100: error: Argument 1 to "__imul__" of "ndarray" has incompatible type "floating[Any]"; expected "_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]]] | float | _NestedSequence[float]"  [arg-type]
+ optuna/storages/_rdb/models.py:281: error: Incompatible types in assignment (expression has type "Query[Row[tuple[int]]]", variable has type "RowReturningQuery[tuple[int]]")  [assignment]
+ optuna/storages/_rdb/models.py:283: error: Incompatible types in assignment (expression has type "Query[Row[tuple[int]]]", variable has type "RowReturningQuery[tuple[int]]")  [assignment]

spark (https://github.com/apache/spark)
+ python/pyspark/sql/connect/client/artifact.py:204: error: Incompatible types in assignment (expression has type "tuple[str, str, str, str, str, str]", variable has type "ParseResult")  [assignment]

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/badge.py:67: error: Incompatible return value type (got "AppBadge[PartialApp[str | None]]", expected "AppBadge[AppT]")  [return-value]
- steam/chat.py:428: error: Argument 1 to "append" of "list" has incompatible type "GroupMessage[PartialMember | GroupMember] | ClanMessage[PartialMember | ClanMember]"; expected "ChatMessageT"  [arg-type]
+ steam/chat.py:428: error: Argument 1 to "append" of "list" has incompatible type "ChatMessage[PartialMember | GroupMember, GroupMember, GroupChannel] | ChatMessage[PartialMember | ClanMember, ClanMember, ClanChannel]"; expected "ChatMessageT"  [arg-type]
+ steam/clan.py:460: error: "ChatGroup[ClanMember, ClanChannel, Any]" has no attribute "_load"  [attr-defined]
+ steam/state.py:1086: error: Incompatible types in assignment (expression has type "ChatGroup[GroupMember, GroupChannel, Any]", target has type "Group")  [assignment]
+ steam/state.py:1176: error: Incompatible types in assignment (expression has type "ChatGroup[GroupMember, GroupChannel, Any]", target has type "Group")  [assignment]

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/events/worker.py:136: error: Incompatible return value type (got "_QueueServiceBase[Event]", expected "Self")  [return-value]
+ src/prefect/events/worker.py:165: error: Incompatible return value type (got "_QueueServiceBase[Event]", expected "Self")  [return-value]
+ src/prefect/logging/handlers.py:107: error: Incompatible return value type (got "_QueueServiceBase[dict[str, Any]]", expected "Self")  [return-value]
+ src/prefect/_internal/observers.py:133: error: Argument 1 to "add_done_callback" of "Future" has incompatible type "Callable[[Task[None]], Any]"; expected "Callable[[Future[None]], object]"  [arg-type]
+ src/prefect/_internal/observers.py:394: error: Argument 1 to "add_done_callback" of "Future" has incompatible type "Callable[[Task[None]], Any]"; expected "Callable[[Future[None]], object]"  [arg-type]
+ src/prefect/runner/storage.py:300: error: "tuple[str, str, str, str, str, str]" has no attribute "netloc"  [attr-defined]
+ src/prefect/runner/storage.py:303: error: "tuple[str, str, str, str, str, str]" has no attribute "_replace"  [attr-defined]
+ src/prefect/runner/storage.py:304: error: "tuple[str, str, str, str, str, str]" has no attribute "netloc"  [attr-defined]
- src/prefect/concurrency/_asyncio.py:55: error: Argument 1 to "send" of "FutureQueueService" has incompatible type "tuple[int, Literal['concurrency', 'rate_limit'], float | None, int | None]"; expected "tuple[int, Literal['concurrency', 'rate_limit'], float | None, int | None, Any]"  [arg-type]
- src/prefect/concurrency/_asyncio.py:99: error: Argument 1 to "send" of "FutureQueueService" has incompatible type "tuple[int, Literal['concurrency', 'rate_limit'], float | None, int | None, float, bool, ConcurrencyLeaseHolder | None]"; expected "tuple[int, Literal['concurrency', 'rate_limit'], float | None, int | None, float, bool, ConcurrencyLeaseHolder | None, Any]"  [arg-type]
- src/prefect/concurrency/_asyncio.py:112: error: R? has no attribute "json"  [attr-defined]
- src/prefect/concurrency/v1/_asyncio.py:45: error: Argument 1 to "send" of "FutureQueueService" has incompatible type "tuple[UUID, float | None]"; expected "tuple[UUID, float | None, Any]"  [arg-type]
- src/prefect/concurrency/v1/_asyncio.py:84: error: Argument 1 to "send" of "FutureQueueService" has incompatible type "tuple[UUID, float | None]"; expected "tuple[UUID, float | None, Any]"  [arg-type]

openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/plugins/upstream/utils.py: note: In member "canonical_url" of class "Request":
+ openlibrary/plugins/upstream/utils.py:1474: error: Incompatible types in assignment (expression has type "tuple[str, str, str, str, str, str]", variable has type "ParseResult")  [assignment]
+ openlibrary/plugins/upstream/addbook.py: note: In function "encode_url_path":
+ openlibrary/plugins/upstream/addbook.py:195: error: Incompatible types in assignment (expression has type "tuple[str, str, str, str, str, str]", variable has type "ParseResult")  [assignment]

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/client_ws.py:198:41: error: Argument 1 to "add_done_callback" of "Future" has incompatible type "Callable[[Task[None]], None]"; expected "Callable[[Future[None]], object]"  [arg-type]
+ aiohttp/web_ws.py:222:41: error: Argument 1 to "add_done_callback" of "Future" has incompatible type "Callable[[Task[None]], None]"; expected "Callable[[Future[None]], object]"  [arg-type]

colour (https://github.com/colour-science/colour)
- 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/phenomena/tmm.py:180: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[number[Any, Any]]]" and "ndarray[tuple[Any, ...], dtype[generic[Any]]]")  [operator]
+ colour/models/rgb/transfer_functions/rimm_romm_rgb.py:364: error: No overload variant of "__mul__" of "floating" matches argument type "ndarray[tuple[Any, ...], dtype[float64]]"  [operator]
+ colour/models/rgb/transfer_functions/rimm_romm_rgb.py:364: note: Possible overload variants:
+ colour/models/rgb/transfer_functions/rimm_romm_rgb.py:364: note:     def __mul__(self, int | floating[_16Bit] | unsignedinteger[_8Bit] | signedinteger[_8Bit] | numpy.bool[builtins.bool], /) -> floating[_16Bit]
+ colour/models/rgb/transfer_functions/rimm_romm_rgb.py:364: note:     def __mul__(self, integer[Any] | floating[Any], /) -> floating[Any]
+ colour/models/rgb/transfer_functions/rimm_romm_rgb.py:364: note:     def __mul__(self, float, /) -> floating[_16Bit]
+ colour/models/rgb/transfer_functions/rimm_romm_rgb.py:364: note:     def __mul__(self, complex, /) -> complexfloating[Any, Any]
+ colour/models/rgb/transfer_functions/rimm_romm_rgb.py:364: note:     def __mul__(self, int | floating[_16Bit] | unsignedinteger[_8Bit] | signedinteger[_8Bit] | numpy.bool[builtins.bool] | floating[_32Bit], /) -> floating[_32Bit]
+ colour/models/rgb/transfer_functions/rimm_romm_rgb.py:364: note:     def __mul__(self, float, /) -> floating[_32Bit]
+ colour/models/rgb/transfer_functions/rimm_romm_rgb.py:364: note: Both left and right operands are unions
+ colour/appearance/hunt.py:658: error: No overload variant of "__truediv__" of "floating" matches argument type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]"  [operator]
+ colour/appearance/hunt.py:658: note: Possible overload variants:
+ colour/appearance/hunt.py:658: note:     def __truediv__(self, int | floating[_16Bit] | unsignedinteger[_8Bit] | signedinteger[_8Bit] | numpy.bool[builtins.bool], /) -> floating[_16Bit]
+ colour/appearance/hunt.py:658: note:     def __truediv__(self, integer[Any] | floating[Any], /) -> floating[Any]
+ colour/appearance/hunt.py:658: note:     def __truediv__(self, float, /) -> floating[_16Bit]
+ colour/appearance/hunt.py:658: note:     def __truediv__(self, complex, /) -> complexfloating[Any, Any]
+ colour/appearance/hunt.py:658: note:     def __truediv__(self, int | floating[_16Bit] | unsignedinteger[_8Bit] | signedinteger[_8Bit] | numpy.bool[builtins.bool] | floating[_32Bit], /) -> floating[_32Bit]
+ colour/appearance/hunt.py:658: note:     def __truediv__(self, float, /) -> floating[_32Bit]
+ colour/appearance/hunt.py:658: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]" and "floating[_16Bit]")  [operator]
+ colour/appearance/hunt.py:658: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]" and "floating[_32Bit]")  [operator]
+ colour/appearance/hunt.py:658: note: Both left and right operands are unions
+ colour/appearance/hke.py:292: error: No overload variant of "__truediv__" of "floating" matches argument type "ndarray[tuple[Any, ...], dtype[floating[Any]]]"  [operator]
+ colour/appearance/hke.py:292: note: Possible overload variants:
+ colour/appearance/hke.py:292: note:     def __truediv__(self, int | floating[_16Bit] | unsignedinteger[_8Bit] | signedinteger[_8Bit] | numpy.bool[builtins.bool], /) -> floating[_16Bit]
+ colour/appearance/hke.py:292: note:     def __truediv__(self, integer[Any] | floating[Any], /) -> floating[Any]
+ colour/appearance/hke.py:292: note:     def __truediv__(self, float, /) -> floating[_16Bit]
+ colour/appearance/hke.py:292: note:     def __truediv__(self, complex, /) -> complexfloating[Any, Any]
+ colour/appearance/hke.py:292: note:     def __truediv__(self, int | floating[_16Bit] | unsignedinteger[_8Bit] | signedinteger[_8Bit] | numpy.bool[builtins.bool] | floating[_32Bit], /) -> floating[_32Bit]
+ colour/appearance/hke.py:292: note:     def __truediv__(self, float, /) -> floating[_32Bit]
+ colour/appearance/hke.py:292: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[floating[Any]]]" and "floating[_16Bit]")  [operator]
+ colour/appearance/hke.py:292: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[floating[Any]]]" and "floating[_32Bit]")  [operator]
+ colour/appearance/hke.py:292: note: Both left and right operands are unions
+ colour/adaptation/cie1994.py:333: error: No overload variant of "__truediv__" of "floating" matches argument type "ndarray[tuple[Any, ...], dtype[floating[Any]]]"  [operator]
+ colour/adaptation/cie1994.py:333: note: Possible overload variants:
+ colour/adaptation/cie1994.py:333: note:     def __truediv__(self, int | floating[_16Bit] | unsignedinteger[_8Bit] | signedinteger[_8Bit] | numpy.bool[builtins.bool], /) -> floating[_16Bit]
+ colour/adaptation/cie1994.py:333: note:     def __truediv__(self, integer[Any] | floating[Any], /) -> floating[Any]
+ colour/adaptation/cie1994.py:333: note:     def __truediv__(self, float, /) -> floating[_16Bit]
+ colour/adaptation/cie1994.py:333: note:     def __truediv__(self, complex, /) -> complexfloating[Any, Any]
+ colour/adaptation/cie1994.py:333: note:     def __truediv__(self, int | floating[_16Bit] | unsignedinteger[_8Bit] | signedinteger[_8Bit] | numpy.bool[builtins.bool] | floating[_32Bit], /) -> floating[_32Bit]
+ colour/adaptation/cie1994.py:333: note:     def __truediv__(self, float, /) -> floating[_32Bit]
+ colour/adaptation/cie1994.py:333: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[floating[Any]]]" and "floating[_16Bit]")  [operator]
+ colour/adaptation/cie1994.py:333: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[floating[Any]]]" and "floating[_32Bit]")  [operator]
+ colour/adaptation/cie1994.py:333: note: Both left and right operands are unions
+ colour/adaptation/cie1994.py:365: error: No overload variant of "__truediv__" of "floating" matches argument type "ndarray[tuple[Any, ...], dtype[floating[Any]]]"  [operator]
+ colour/adaptation/cie1994.py:365: note: Possible overload variants:
+ colour/adaptation/cie1994.py:365: note:     def __truediv__(self, int | floating[_16Bit] | unsignedinteger[_8Bit] | signedinteger[_8Bit] | numpy.bool[builtins.bool], /) -> floating[_16Bit]
+ colour/adaptation/cie1994.py:365: note:     def __truediv__(self, integer[Any] | floating[Any], /) -> floating[Any]
+ colour/adaptation/cie1994.py:365: note:     def __truediv__(self, float, /) -> floating[_16Bit]
+ colour/adaptation/cie1994.py:365: note:     def __truediv__(self, complex, /) -> complexfloating[Any, Any]
+ colour/adaptation/cie1994.py:365: note:     def __truediv__(self, int | floating[_16Bit] | unsignedinteger[_8Bit] | signedinteger[_8Bit] | numpy.bool[builtins.bool] | floating[_32Bit], /) -> floating[_32Bit]
+ colour/adaptation/cie1994.py:365: note:     def __truediv__(self, float, /) -> floating[_32Bit]
+ colour/adaptation/cie1994.py:365: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[floating[Any]]]" and "floating[_16Bit]")  [operator]
+ colour/adaptation/cie1994.py:365: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[floating[Any]]]" and "floating[_32Bit]")  [operator]
+ colour/adaptation/cie1994.py:365: note: Both left and right operands are unions
+ colour/colorimetry/generation.py:566: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]" and "floating[_16Bit]")  [operator]
+ colour/colorimetry/generation.py:566: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]" and "floating[_32Bit]")  [operator]
+ colour/colorimetry/generation.py:566: note: Right operand is of type "floating[_16Bit] | floating[_32Bit] | float64"
+ colour/io/fichet2021.py:755: error: Argument 1 to "__itruediv__" of "ndarray" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]]] | float | _NestedSequence[float]"  [arg-type]
+ colour/appearance/kim2009.py:352: error: Unsupported operand types for * ("ndarray[tuple[Any, ...], dtype[float64]]" and "floating[_16Bit]")  [operator]
+ colour/appearance/kim2009.py:352: error: Unsupported operand types for * ("ndarray[tuple[Any, ...], dtype[float64]]" and "floating[_32Bit]")  [operator]
+ colour/appearance/kim2009.py:352: note: Right operand is of type "floating[_16Bit] | floating[_32Bit] | float64"
+ colour/appearance/kim2009.py:542: error: Unsupported operand types for + ("ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]" and "floating[_16Bit]")  [operator]
+ colour/appearance/kim2009.py:542: error: Unsupported operand types for + ("ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]" and "floating[_32Bit]")  [operator]
+ colour/appearance/kim2009.py:542: note: Right operand is of type "floating[_16Bit] | floating[_32Bit] | float64"
+ colour/characterisation/aces_it.py:1226: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[floating[Any]]]" and "floating[_16Bit]")  [operator]
+ colour/characterisation/aces_it.py:1226: error: Unsupported operand types for / ("ndarray[tuple[Any, ...], dtype[floating[Any]]]" and "floating[_32Bit]")  [operator]
+ colour/characterisation/aces_it.py:1226: note: Right operand is of type "floating[_16Bit] | floating[_32Bit] | float64"
+ colour/plotting/section.py:229: error: Argument 1 to "linspace" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64 | floating[Any]"; expected "float | integer[Any] | numpy.bool[builtins.bool]"  [arg-type]
+ colour/plotting/section.py:229: error: Argument 2 to "linspace" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64 | floating[Any]"; expected "float | integer[Any] | numpy.bool[builtins.bool]"  [arg-type]
+ colour/plotting/section.py:230: error: Argument 1 to "linspace" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64 | floating[Any]"; expected "float | integer[Any] | numpy.bool[builtins.bool]"  [arg-type]
+ colour/plotting/section.py:230: error: Argument 2 to "linspace" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64 | floating[Any]"; expected "float | integer[Any] | numpy.bool[builtins.bool]"  [arg-type]
- colour/plotting/quality.py:221: note:     def __sub__(self, int | numpy.bool[builtins.bool], /) -> ndarray[tuple[int], dtype[integer[Any] | floating[Any] | datetime64[Any] | timedelta64[Any]]]
+ colour/plotting/quality.py:221: note:     def __sub__(self, int | numpy.bool[builtins.bool], /) -> ndarray[tuple[int], dtype[number[Any, Any]]]
- colour/plotting/quality.py:221: note:     def __sub__(self, _SupportsArray[dtype[numpy.bool[builtins.bool]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool]]]] | builtins.bool | _NestedSequence[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[integer[Any] | floating[Any] | datetime64[Any] | timedelta64[Any]]]
+ colour/plotting/quality.py:221: note:     def __sub__(self, _SupportsArray[dtype[numpy.bool[builtins.bool]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool]]]] | builtins.bool | _NestedSequence[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[number[Any, Any]]]
- colour/models/rgb/transfer_functions/tests/test_linear.py:52: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[generic[Any]]]", variable has type "floating[_16Bit] | floating[_32Bit] | float64")  [assignment]
+ colour/models/rgb/transfer_functions/tests/test_linear.py:52: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[generic[float]]]", variable has type "floating[_16Bit] | floating[_32Bit] | float64")  [assignment]
+ colour/models/rgb/transfer_functions/tests/test_linear.py:54: error: Argument 1 to "assert_allclose" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | timedelta64[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | timedelta64[Any]]]] | int | _NestedSequence[int]"  [arg-type]
+ colour/models/rgb/transfer_functions/tests/test_linear.py:54: error: Argument 2 to "assert_allclose" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | timedelta64[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | timedelta64[Any]]]] | int | _NestedSequence[int]"  [arg-type]
- colour/models/rgb/transfer_functions/tests/test_linear.py:58: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[generic[Any]]]", variable has type "floating[_16Bit] | floating[_32Bit] | float64")  [assignment]
+ colour/models/rgb/transfer_functions/tests/test_linear.py:58: error: Incompatible types in assignment (expression has type "ndarray[tuple[int, int], dtype[generic[float]]]", variable has type "floating[_16Bit] | floating[_32Bit] | float64")  [assignment]
+ colour/models/rgb/transfer_functions/tests/test_linear.py:60: error: Argument 1 to "assert_allclose" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | timedelta64[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | timedelta64[Any]]]] | int | _NestedSequence[int]"  [arg-type]
+ colour/models/rgb/transfer_functions/tests/test_linear.py:60: error: Argument 2 to "assert_allclose" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | timedelta64[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | timedelta64[Any]]]] | int | _NestedSequence[int]"  [arg-type]
- colour/models/rgb/transfer_functions/tests/test_linear.py:64: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[generic[Any]]]", variable has type "floating[_16Bit] | floating[_32Bit] | float64")  [assignment]
+ colour/models/rgb/transfer_functions/tests/test_linear.py:64: error: Incompatible types in assignment (expression has type "ndarray[tuple[int, int, int], dtype[generic[float]]]", variable has type "floating[_16Bit] | floating[_32Bit] | float64")  [assignment]
+ colour/models/rgb/transfer_functions/tests/test_linear.py:66: error: Argument 1 to "assert_allclose" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | timedelta64[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | timedelta64[Any]]]] | int | _NestedSequence[int]"  [arg-type]
+ colour/models/rgb/transfer_functions/tests/test_linear.py:66: error: Argument 2 to "assert_allclose" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | timedelta64[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | timedelta64[Any]]]] | int | _NestedSequence[int]"  [arg-type]
+ colour/io/tests/test_ocio.py:114: error: Argument 1 to "assert_allclose" has incompatible type "float | floating[Any]"; expected "_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex] | _SupportsArray[dtype[object_]] | _NestedSequence[_SupportsArray[dtype[object_]]]"  [arg-type]

... (truncated 19 lines) ...

altair (https://github.com/vega/altair)
+ altair/datasets/_readimpl.py:403: error: Incompatible return value type (got "narwhals.dataframe.DataFrame[pandas.core.frame.DataFrame]", expected "narwhals.stable.v1.DataFrame[pandas.core.frame.DataFrame]")  [return-value]
+ altair/datasets/_readimpl.py:502: error: Incompatible return value type (got "_Tabular[ChunkedArray[Any]]", expected "Table")  [return-value]
+ altair/datasets/_reader.py:295: error: Argument 1 to "_dataset_names" has incompatible type "narwhals.dataframe.LazyFrame[IntoLazyFrameT]"; expected "narwhals.stable.v1.LazyFrame[Any]"  [arg-type]
+ altair/datasets/_reader.py:296: error: Argument 1 to "_dataset_names" has incompatible type "narwhals.dataframe.LazyFrame[IntoLazyFrameT]"; expected "narwhals.stable.v1.LazyFrame[Any]"  [arg-type]
+ altair/datasets/_reader.py:345: error: Incompatible return value type (got "narwhals.dataframe.LazyFrame[IntoLazyFrameT]", expected "narwhals.stable.v1.LazyFrame[IntoLazyFrameT]")  [return-value]
+ altair/utils/core.py:504: error: Incompatible return value type (got "narwhals.dataframe.DataFrame[TIntoDataFrame]", expected "narwhals.stable.v1.DataFrame[TIntoDataFrame]")  [return-value]

zulip (https://github.com/zulip/zulip)
+ zerver/views/sentry.py:45: error: "tuple[str, str, str, str, str]" has no attribute "geturl"  [attr-defined]
+ zerver/lib/url_encoding.py:219: error: "tuple[str, str, str, str, str]" has no attribute "geturl"  [attr-defined]
+ zerver/lib/markdown/__init__.py:793: error: "tuple[str, str, str, str, str]" has no attribute "geturl"  [attr-defined]
+ zerver/lib/markdown/__init__.py:853: error: "tuple[str, str, str, str, str]" has no attribute "geturl"  [attr-defined]
+ zerver/lib/markdown/__init__.py:2541: error: Incompatible types in assignment (expression has type "tuple[str, str, str, str, str]", variable has type "SplitResult")  [assignment]
+ zerver/lib/markdown/__init__.py:2542: error: "tuple[str, str, str, str, str]" has no attribute "geturl"  [attr-defined]
+ zerver/tests/test_upload_s3.py:720: error: "tuple[str, str, str, str, str]" has no attribute "geturl"  [attr-defined]
+ zerver/tests/test_upload_s3.py:807: error: "tuple[str, str, str, str, str]" has no attribute "geturl"  [attr-defined]

scrapy (https://github.com/scrapy/scrapy)
+ tests/AsyncCrawlerProcess/twisted_reactor_custom_settings_select.py:29: error: Argument 1 to "add_done_callback" of "Future" has incompatible type "Callable[[Task[None]], None]"; expected "Callable[[Future[None]], object]"  [arg-type]
+ tests/AsyncCrawlerProcess/reactorless_custom_settings.py:35: error: Argument 1 to "add_done_callback" of "Future" has incompatible type "Callable[[Task[None]], None]"; expected "Callable[[Future[None]], object]"  [arg-type]
+ scrapy/commands/genspider.py:44: error: Incompatible types in assignment (expression has type "tuple[str, str, str, str, str, str]", variable has type "ParseResult")  [assignment]
+ scrapy/core/downloader/handlers/_base_streaming.py:315: error: Returning Any from function declared to return "str | None"  [no-any-return]
+ scrapy/core/downloader/handlers/_base_streaming.py:315: error: "tuple[str, str, str, str, str]" has no attribute "geturl"  [attr-defined]

comtypes (https://github.com/enthought/comtypes)
- comtypes/hints.pyi:236: error: Invariant type variable "_T_Inst" used in protocol where contravariant one is expected  [misc]
- comtypes/hints.pyi:236: error: Invariant type variable "_R_Get" used in protocol where covariant one is expected  [misc]

urllib3 (https://github.com/urllib3/urllib3)
+ dummyserver/testcase.py:211: error: Incompatible types in assignment (expression has type "_BaseExitStack[bool | None]", variable has type "ExitStack[bool | None]")  [assignment]
+ dummyserver/testcase.py:272: error: Incompatible types in assignment (expression has type "_BaseExitStack[bool | None]", variable has type "ExitStack[bool | None]")  [assignment]

django-stubs (https://github.com/typeddjango/django-stubs)
+ django-stubs/db/models/fields/related.pyi:278: error: Signature of "__get__" incompatible with supertype "ForeignObject"  [override]
+ django-stubs/db/models/fields/related.pyi:278: note:      Superclass:
+ django-stubs/db/models/fields/related.pyi:278: note:          @overload
+ django-stubs/db/models/fields/related.pyi:278: note:          def __get__(self, instance: None, owner: Any) -> ForwardManyToOneDescriptor[ForeignObject[_ST, _GT]]
+ django-stubs/db/models/fields/related.pyi:278: note:          @overload
+ django-stubs/db/models/fields/related.pyi:278: note:          def __get__(self, instance: Model, owner: Any) -> _GT
+ django-stubs/db/models/fields/related.pyi:278: note:          @overload
+ django-stubs/db/models/fields/related.pyi:278: note:          def __get__(self, instance: Any, owner: Any) -> ForeignObject[_ST, _GT]
+ django-stubs/db/models/fields/related.pyi:278: note:      Subclass:
+ django-stubs/db/models/fields/related.pyi:278: note:          @overload
+ django-stubs/db/models/fields/related.pyi:278: note:          def __get__(self, instance: None, owner: Any) -> ForwardOneToOneDescriptor[OneToOneField[_ST, _GT]]
+ django-stubs/db/models/fields/related.pyi:278: note:          @overload
+ django-stubs/db/models/fields/related.pyi:278: note:          def __get__(self, instance: Model, owner: Any) -> _GT
+ django-stubs/db/models/fields/related.pyi:278: note:          @overload
+ django-stubs/db/models/fields/related.pyi:278: note:          def __get__(self, instance: Any, owner: Any) -> OneToOneField[_ST, _GT]
+ django-stubs/http/request.pyi:239: error: Unused "type: ignore" comment  [unused-ignore]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/models/link.py:609: error: Argument "parsed" to "_CleanResult" has incompatible type "tuple[str, str, str, str, str]"; expected "SplitResult"  [arg-type]

discord.py (https://github.com/Rapptz/discord.py)
+ discord/ext/commands/core.py:1653: error: "Command[CogT, P, T]" has no attribute "add_command"  [attr-defined]
+ discord/ext/commands/core.py:1654: error: Incompatible return value type (got "Command[CogT, P, T]", expected "Self")  [return-value]
+ discord/ext/commands/hybrid.py:567: error: Argument 1 of "_ensure_assignment_on_copy" is incompatible with supertype "discord.ext.commands.core.Command"; supertype defines the argument type as "Command[CogT, P, T]"  [override]
+ discord/ext/commands/hybrid.py:567: note: This violates the Liskov substitution principle
+ discord/ext/commands/hybrid.py:567: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
+ discord/ext/commands/hybrid.py:570: error: "Command[CogT, P, T]" has no attribute "app_command"  [attr-defined]
+ discord/ext/commands/hybrid.py:572: error: "Command[CogT, P, T]" has no attribute "app_command"  [attr-defined]
+ discord/ext/commands/hybrid.py:573: error: "Command[CogT, P, T]" has no attribute "app_command"  [attr-defined]
+ discord/ext/commands/hybrid.py:574: error: Incompatible return value type (got "Command[CogT, P, T]", expected "Self")  [return-value]
+ discord/ext/commands/hybrid.py:739: error: Argument 1 of "_ensure_assignment_on_copy" is incompatible with supertype "discord.ext.commands.core.Command"; supertype defines the argument type as "Command[CogT, P, T]"  [override]
+ discord/ext/commands/hybrid.py:739: note: This violates the Liskov substitution principle
+ discord/ext/commands/hybrid.py:739: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
+ discord/ext/commands/hybrid.py:741: error: "Command[CogT, P, T]" has no attribute "fallback"; maybe "callback" or "_callback"?  [attr-defined]
+ discord/ext/commands/hybrid.py:742: error: Incompatible return value type (got "Command[CogT, P, T]", expected "Self")  [return-value]
+ discord/ext/commands/hybrid.py:751: error: "Command[CogT, P, T]" has no attribute "app_command"  [attr-defined]
+ discord/ext/commands/hybrid.py:754: error: "Command[CogT, P, T]" has no attribute "app_command"  [attr-defined]
+ discord/ext/commands/hybrid.py:757: error: "Command[CogT, P, T]" has no attribute "_fallback_command"  [attr-defined]
+ discord/ext/commands/hybrid.py:758: error: "Command[CogT, P, T]" has no attribute "_fallback_command"  [attr-defined]
+ discord/ext/commands/hybrid.py:760: error: Incompatible return value type (got "Command[CogT, P, T]", expected "Self")  [return-value]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/dependencies/reloaders.py:417: error: Argument 1 to "add_done_callback" of "Future" has incompatible type "Callable[[Task[None]], None]"; expected "Callable[[Future[None]], object]"  [arg-type]
+ tanjun/schedules.py:361: error: Argument 1 to "add_done_callback" of "Future" has incompatible type "Callable[[Task[None]], None]"; expected "Callable[[Future[None]], object]"  [arg-type]
+ tanjun/schedules.py:1081: error: Argument 1 to "add_done_callback" of "Future" has incompatible type "Callable[[Task[None]], None]"; expected "Callable[[Future[None]], object]"  [arg-type]
+ tanjun/commands/slash.py:1064: error: "PartialCommand[SlashContext]" has no attribute "_parent"  [attr-defined]
+ tanjun/commands/slash.py:1065: error: Incompatible return value type (got "PartialCommand[SlashContext]", expected "Self")  [return-value]
+ tanjun/commands/message.py:300: error: "PartialCommand[MessageContext]" has no attribute "_callback"  [attr-defined]
+ tanjun/commands/message.py:301: error: "PartialCommand[MessageContext]" has no attribute "_names"  [attr-defined]
+ tanjun/commands/message.py:302: error: "PartialCommand[MessageContext]" has no attribute "_parent"  [attr-defined]
+ tanjun/commands/message.py:303: error: "PartialCommand[MessageContext]" has no attribute "_parser"  [attr-defined]
+ tanjun/commands/message.py:304: error: Incompatible return value type (got "PartialCommand[MessageContext]", expected "Self")  [return-value]
+ tanjun/commands/message.py:454: error: "MessageCommand[_MessageCallbackSigT]" has no attribute "_commands"  [attr-defined]
+ tanjun/commands/message.py:455: error: Incompatible return value type (got "MessageCommand[_MessageCallbackSigT]", expected "Self")  [return-value]
+ tanjun/commands/menu.py:668: error: "PartialCommand[MenuContext]" has no attribute "_parent"  [attr-defined]
+ tanjun/commands/menu.py:669: error: Incompatible return value type (got "PartialCommand[MenuContext]", expected "Self")  [return-value]

pandera (https://github.com/pandera-dev/pandera)
+ tests/pandas/test_schemas.py:1350: error: Argument 2 has incompatible type "pandera.api.dataframe.container.DataFrameSchema[DataFrame]"; expected "pandera.api.pandas.container.DataFrameSchema"  [arg-type]

pylint (https://github.com/pycqa/pylint)
+ pylint/lint/pylinter.py:457: error: "_BaseExitStack[bool | None]" has no attribute "close"  [attr-defined]

artigraph (https://github.com/artigraph/artigraph)
+ tests/arti/storage/test_gcs_storage.py:25: error: "Storage[GCSFilePartition]" has no attribute "qualified_path"  [attr-defined]
+ tests/arti/storage/test_gcs_storage.py:35: error: "Storage[GCSFilePartition]" has no attribute "qualified_path"  [attr-defined]
+ tests/arti/storage/test_storage.py:82: error: "Storage[MockStoragePartition]" has no attribute "path"  [attr-defined]
+ tests/arti/storage/test_storage.py:83: error: "Storage[MockStoragePartition]" has no attribute "path"  [attr-defined]
+ tests/arti/storage/test_storage.py:135: error: "Storage[MockStoragePartition]" has no attribute "path"  [attr-defined]
+ tests/arti/storage/test_storage.py:171: error: "Storage[TablePartition]" has no attribute "dataset"  [attr-defined]
+ tests/arti/storage/test_storage.py:172: error: "Storage[TablePartition]" has no attribute "name"  [attr-defined]
+ tests/arti/storage/test_local_storage.py:45: error: Argument 1 to "generate_partition_files" has incompatible type "Storage[LocalFilePartition]"; expected "LocalFile"  [arg-type]
+ tests/arti/storage/test_local_storage.py:75: error: Argument 1 to "generate_partition_files" has incompatible type "Storage[LocalFilePartition]"; expected "LocalFile"  [arg-type]
+ tests/arti/storage/test_local_storage.py:101: error: Argument 1 to "generate_partition_files" has incompatible type "Storage[LocalFilePartition]"; expected "LocalFile"  [arg-type]
+ tests/arti/storage/test_literal_storage.py:20: error: "Storage[StringLiteralPartition]" has no attribute "value"  [attr-defined]

dulwich (https://github.com/dulwich/dulwich)
+ dulwich/client.py:5152: error: "tuple[str, str, str, str, str, str]" has no attribute "_replace"  [attr-defined]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/datastructures/mixins.py:317: error: Incompatible return value type (got "dict[K, V]", expected "Self")  [return-value]
+ src/werkzeug/datastructures/structures.py:671: error: Unused "type: ignore" comment  [unused-ignore]
+ src/werkzeug/datastructures/structures.py:722: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_datastructures.py:819: error: Result type of | incompatible in assignment  [misc]

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ pandas-stubs/core/indexes/range.pyi:68: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas-stubs/core/indexes/range.pyi:85: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas-stubs/core/indexes/category.pyi:43: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:142: error: Expression is of type "Any", not "DataFrame"  [assert-type]
+ tests/test_resampler.py:142: error: No overload variant of "pipe" of "BaseGroupBy" matches argument type "Callable[[DatetimeIndexResampler[DataFrame]], DataFrame]"  [call-overload]
+ tests/test_resampler.py:142: note: Possible overload variants:
+ tests/test_resampler.py:142: note:     def [P, T] pipe(self, func: Callable[[BaseGroupBy[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:142: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:148: error: Expression is of type "Any", not "DataFrame"  [assert-type]
+ tests/test_resampler.py:148: error: No overload variant of "pipe" of "BaseGroupBy" matches argument type "Callable[[DatetimeIndexResampler[DataFrame]], DataFrame]"  [call-overload]
+ tests/test_resampler.py:148: note: Possible overload variants:
+ tests/test_resampler.py:148: note:     def [P, T] pipe(self, func: Callable[[BaseGroupBy[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:148: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:154: error: Expression is of type "Any", not "Series[Any]"  [assert-type]
+ tests/test_resampler.py:154: error: No overload variant of "pipe" of "BaseGroupBy" matches argument type "Callable[[DatetimeIndexResampler[DataFrame]], Series[Any]]"  [call-overload]
+ tests/test_resampler.py:154: note: Possible overload variants:
+ tests/test_resampler.py:154: note:     def [P, T] pipe(self, func: Callable[[BaseGroupBy[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:154: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:160: error: Expression is of type "Any", not "float"  [assert-type]
+ tests/test_resampler.py:160: error: No overload variant of "pipe" of "BaseGroupBy" matches argument type "Callable[[DatetimeIndexResampler[DataFrame]], float]"  [call-overload]
+ tests/test_resampler.py:160: note: Possible overload variants:
+ tests/test_resampler.py:160: note:     def [P, T] pipe(self, func: Callable[[BaseGroupBy[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:160: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:175: error: Argument 1 to "pipe" of "BaseGroupBy" has incompatible type "def j(DatetimeIndexResampler[DataFrame], int, /, arg1: list[float], arg2: str, *, kw: tuple[int]) -> DataFrame"; expected "def (BaseGroupBy[DataFrame], int, /, arg1: list[float], arg2: str, *, kw: tuple[int]) -> DataFrame"  [arg-type]
+ tests/test_resampler.py:181: error: Argument 1 to "pipe" of "BaseGroupBy" has incompatible type "def j(DatetimeIndexResampler[DataFrame], int, /, arg1: list[float], arg2: str, *, kw: tuple[int]) -> DataFrame"; expected "def (BaseGroupBy[DataFrame], int, /, arg1: list[float], arg2: str, *, kw: tuple[int]) -> DataFrame"  [arg-type]
+ tests/test_resampler.py:188: error: Argument 1 to "pipe" of "BaseGroupBy" has incompatible type "def j(DatetimeIndexResampler[DataFrame], int, /, arg1: list[float], arg2: str, *, kw: tuple[int]) -> DataFrame"; expected "def (BaseGroupBy[DataFrame], int, /, arg1: list[float], arg2: str, *, kw: tuple[int]) -> DataFrame"  [arg-type]
+ tests/test_resampler.py:195: error: Argument 1 to "pipe" of "BaseGroupBy" has incompatible type "def j(DatetimeIndexResampler[DataFrame], int, /, arg1: list[float], arg2: str, *, kw: tuple[int]) -> DataFrame"; expected "def (BaseGroupBy[DataFrame], int, /, arg1: list[float], arg2: str, *, kw: tuple[int]) -> DataFrame"  [arg-type]
+ tests/test_resampler.py:202: error: Argument 1 to "pipe" of "BaseGroupBy" has incompatible type "def j(DatetimeIndexResampler[DataFrame], int, /, arg1: list[float], arg2: str, *, kw: tuple[int]) -> DataFrame"; expected "def (BaseGroupBy[DataFrame], int, /, arg1: list[float], arg2: str, *, kw: tuple[int]) -> DataFrame"  [arg-type]
+ tests/test_resampler.py:209: error: Argument 1 to "pipe" of "BaseGroupBy" has incompatible type "def j(DatetimeIndexResampler[DataFrame], int, /, arg1: list[float], arg2: str, *, kw: tuple[int]) -> DataFrame"; expected "def (BaseGroupBy[DataFrame], int, /, arg1: list[float], arg2: str, *, kw: tuple[int]) -> DataFrame"  [arg-type]
+ tests/test_resampler.py:342: error: Expression is of type "Any", not "Series[Any]"  [assert-type]
+ tests/test_resampler.py:342: error: No overload variant of "pipe" of "BaseGroupBy" matches argument type "Callable[[DatetimeIndexResampler[Series[Any]]], Series[Any]]"  [call-overload]
+ tests/test_resampler.py:342: note: Possible overload variants:
+ tests/test_resampler.py:342: note:     def [P, T] pipe(self, func: Callable[[BaseGroupBy[Series[Any]], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:342: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:348: error: Expression is of type "Any", not "float"  [assert-type]
+ tests/test_resampler.py:348: error: No overload variant of "pipe" of "BaseGroupBy" matches argument type "Callable[[DatetimeIndexResampler[Series[Any]]], float]"  [call-overload]
+ tests/test_resampler.py:348: note: Possible overload variants:
+ tests/test_resampler.py:348: note:     def [P, T] pipe(self, func: Callable[[BaseGroupBy[Series[Any]], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:348: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:354: error: Expression is of type "Any", not "DataFrame"  [assert-type]
+ tests/test_resampler.py:354: error: No overload variant of "pipe" of "BaseGroupBy" matches argument type "Callable[[DatetimeIndexResampler[Series[Any]]], DataFrame]"  [call-overload]
+ tests/test_resampler.py:354: note: Possible overload variants:
+ tests/test_resampler.py:354: note:     def [P, T] pipe(self, func: Callable[[BaseGroupBy[Series[Any]], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:354: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_groupby.py:203: error: Expression is of type "_GroupByMixin[DataFrame]", not "DatetimeIndexResamplerGroupby[DataFrame] | PeriodIndexResamplerGroupby[DataFrame] | TimedeltaIndexResamplerGroupby[DataFrame]"  [assert-type]
+ tests/test_groupby.py:207: error: Expression is of type "_GroupByMixin[DataFrame]", not "DatetimeIndexResamplerGroupby[DataFrame] | PeriodIndexResamplerGroupby[DataFrame] | TimedeltaIndexResamplerGroupby[DataFrame]"  [assert-type]
+ tests/test_groupby.py:246: error: Expression is of type "Any", not "DataFrame"  [assert-type]
+ tests/test_groupby.py:246: error: No overload variant of "pipe" of "BaseGroupBy" matches argument type "Callable[[Resampler[DataFrame]], DataFrame]"  [call-overload]
+ tests/test_groupby.py:246: note: Possible overload variants:
+ tests/test_groupby.py:246: note:     def [P, T] pipe(self, func: Callable[[BaseGroupBy[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_groupby.py:246: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_groupby.py:252: error: Expression is of type "Any", not "Series[Any]"  [assert-type]
+ tests/test_groupby.py:252: error: No overload variant of "pipe" of "BaseGroupBy" matches argument type "Callable[[Resampler[DataFrame]], Series[Any]]"  [call-overload]
+ tests/test_groupby.py:252: note: Possible overload variants:
+ tests/test_groupby.py:252: note:     def [P, T] pipe(self, func: Callable[[BaseGroupBy[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_groupby.py:252: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_groupby.py:258: error: Expression is of type "Any", not "float"  [assert-type]
+ tests/test_groupby.py:258: error: No overload variant of "pipe" of "BaseGroupBy" matches argument type "Callable[[Resampler[DataFrame]], float]"  [call-overload]
+ tests/test_groupby.py:258: note: Possible overload variants:
+ tests/test_groupby.py:258: note:     def [P, T] pipe(self, func: Callable[[BaseGroupBy[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_groupby.py:258: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_groupby.py:380: error: Expression is of type "Any", not "float"  [assert-type]
+ tests/test_groupby.py:380: error: No overload variant of "pipe" of "BaseGroupBy" matches argument type "Callable[[Resampler[Series[Any]]], float]"  [call-overload]
+ tests/test_groupby.py:380: note: Possible overload variants:
+ tests/test_groupby.py:380: note:     def [P, T] pipe(self, func: Callable[[BaseGroupBy[Series[float]], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_groupby.py:380: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_groupby.py:520: error: Expression is of type "BaseWindow[DataFrame]", not "RollingGroupby[DataFrame]"  [assert-type]
+ tests/test_groupby.py:526: error: Expression is of type "BaseWindow[DataFrame]", not "RollingGroupby[DataFrame]"  [assert-type]
+ tests/test_groupby.py:530: error: Expression is of type "BaseWindow[DataFrame]", not "RollingGroupby[DataFrame]"  [assert-type]
+ tests/test_groupby.py:697: error: Expression is of type "BaseWindow[DataFrame]", not "ExpandingGroupby[DataFrame]"  [assert-type]
+ tests/test_groupby.py:703: error: Expression is of type "BaseWindow[DataFrame]", not "ExpandingGroupby[DataFrame]"  [assert-type]
+ tests/test_groupby.py:707: error: Expression is of type "BaseWindow[DataFrame]", not "ExpandingGroupby[DataFrame]"  [assert-type]
+ tests/test_groupby.py:804: error: Expression is of type "BaseWindow[DataFrame]", not "ExponentialMovingWindowGroupby[DataFrame]"  [assert-type]
+ tests/test_groupby.py:810: error: Expression is of type "BaseWindow[DataFrame]", not "ExponentialMovingWindowGroupby[DataFrame]"  [assert-type]
+ tests/test_groupby.py:814: error: Expression is of type "BaseWindow[DataFrame]", not "ExponentialMovingWindowGroupby[DataFrame]"  [assert-type]
+ tests/series/test_cumul.py:24: error: Expression is of type "Series[Any]", not "Series[int]"  [assert-type]
+ tests/series/test_cumul.py:24: error: Invalid self argument "Series[int]" to attribute function "cumprod" with type "def cumprod(self: Series[Never], axis: Literal['index', 0] = ..., skipna: bool = ..., *args: Any, **kwargs: Any) -> Series[Any]"  [misc]
+ tests/series/test_cumul.py:29: error: Expression is of type "Series[Any]", not "Series[float]"  [assert-type]
+ tests/series/test_cumul.py:29: error: Invalid self argument "Series[float]" to attribute function "cumprod" with type "def cumprod(self: Series[Never], axis: Literal['index', 0] = ..., skipna: bool = ..., *args: Any, **kwargs: Any) -> Series[Any]"  [misc]
+ tests/series/test_cumul.py:35: error: Expression is of type "Series[Any]", not "Series[complex]"  [assert-type]
+ tests/series/test_cumul.py:35: error: Invalid self argument "Series[complex]" to attribute function "cumprod" with type "def cumprod(self: Series[Never], axis: Literal['index', 0] = ..., skipna: bool = ..., *args: Any, **kwargs: Any) -> Series[Any]"  [misc]
+ tests/series/timestamp/test_add.py:31: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/series/timestamp/test_add.py:35: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/series/timestamp/test_add.py:39: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/series/timestamp/test_add.py:43: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/series/timestamp/test_add.py:75: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/series/timestamp/test_add.py:79: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/series/timestamp/test_add.py:83: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/series/timestamp/test_add.py:87: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/series/timestamp/test_add.py:97: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/series/timestamp/test_add.py:99: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/series/timestamp/test_add.py:101: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/series/timestamp/test_add.py:102: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/series/timestamp/test_add.py:105: error: Unused "type: ignore" comment  [unused-ignore]

... (truncated 534 lines) ...```

mypy_primer revealed regressions in spack, psycopg, optuna where
the bound-based fallback was too aggressive and caused type narrowing.
Reverting until a more precise fix can be designed.
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.

1 participant