Repository navigation
Correctly handle TypeOfAny.from_another_any - #15497
ilevkivskyi wants to merge 2 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
|
And of course this uncovered a big can of worms: currently The only reasonable solution I see here is to introduce a new kind of |
|
Diff from mypy_primer, showing the effect of this PR on open source code: pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/arrays/interval.py:1019: error: Incompatible types in assignment (expression has type "DatetimeArray | TimedeltaArray | ndarray[Any, Any]", variable has type "ndarray[Any, dtype[Any]]") [assignment]
+ pandas/core/arrays/sparse/array.py:1879: error: Incompatible types in assignment (expression has type "ExtensionArray | ndarray[Any, Any]", variable has type "ndarray[Any, Any]") [assignment]
+ pandas/core/window/rolling.py:1683: error: "bool" has no attribute "astype" [attr-defined]
+ pandas/core/window/rolling.py:1730: error: "bool" has no attribute "astype" [attr-defined]
+ pandas/core/groupby/groupby.py:5349: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "list[Any]") [assignment]
+ pandas/core/groupby/generic.py:793: error: Incompatible types in assignment (expression has type "list[ndarray[Any, dtype[_SCT]]]", variable has type "list[ndarray[Any, dtype[signedinteger[Any]]]]") [assignment]
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
- tests/test_pandas.py:245: error: Expression is of type "Any", not "Series[bool]" [assert-type]
+ tests/test_pandas.py:245: error: Expression is of type "DataFrame", not "Series[bool]" [assert-type]
optuna (https://github.com/optuna/optuna)
+ optuna/importance/_fanova/_tree.py:64: error: Incompatible types in assignment (expression has type "tuple[Any, ...]", variable has type "list[Any]") [assignment]
schemathesis (https://github.com/schemathesis/schemathesis)
+ src/schemathesis/specs/openapi/schemas.py: note: In member "get_operation_by_reference" of class "BaseOpenAPISchema":
+ src/schemathesis/specs/openapi/schemas.py:315: error: Argument 2 to "chain" has incompatible type "Dict[str, Any]"; expected "Iterable[Dict[str, Any]]" [arg-type]
scrapy (https://github.com/scrapy/scrapy)
+ scrapy/http/request/form.py:52: error: Argument 1 to "_set_url" of "Request" has incompatible type "Literal[b'']"; expected "str" [arg-type]
|
Fixes #15253
The fix is trivial so I am not going to wait for a review, will just check the primer. Also I am trying something new here: adding a unit test.