GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||
GeezerVison is showing github.com — Handle overloaded method ambiguity caused by self-types by ilevkivskyi · Pull Request #22011 · python/mypy Conversation
Member
I think we should handle this consistently with overloaded functions, essentially It looks like there are no simple way to implement this properly. The only way I see requires a new attribute on
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
This comment has been minimized.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
The first overload with You might also be interested in a recent similar discussion for Pyrefly: pyrefly-org/pyrefly#4910 (comment) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@jorenham Specific fallback type may be more precise, this is true. Mypy already infers Anyway, my question is different: you mentioned that the bug I am fixing here (where bug == mypy randomly selecting first overload in case if |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Well, in the meantime I've worked around most of these cases where possible in NumPy's bundled stubs and in scipy-stubs (e.g. using the But it looks like this solution results in many The number of new primer errors for scipy-stubs isn't all too bad, so I can live with it. But the diff for Anyway, don't consider scipy-stubs a blocker for this. I've seen those |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@jorenham Now back to the main topic
Note |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There is a bunch of special-casing for `Any` types in binder. The goal of this special-casing is to limit the spread of `Any` types from legacy code with missing/imprecise types. This special-casing is quite ad-hoc, and thus should be limited only to imprecise kinds of `Any`. Note this should help with #22011
|
OK, |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
OK, primer now looks better. The |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
It is a common pattern (especially in numeric libraries) to have a fallback overload that has a relatively precise return type (i.e. not just `Any` or `list[Any]`). We should try to find and use that overload if there is an ambiguity caused by an argument that contains `Any`. This will likely cause some new errors, but this should limit the fallout from #22011
|
@jorenham After I merged #22060 situation with @Dr-Irv @cmp0xff There are still a lot of new the relevant lines are def test_mul_numpy_array(left_i: pd.Index) -> None: """Test pd.Index[Any] (int) * numpy arrays""" b = np.array([True, False, True], np.bool_) ... check(assert_type(left_i * b, pd.Index), pd.Index) I looked at the definition of Because of the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I'll try to look at this later today. But at a glance these all look like cases where the intended fallback overload returns a union that's not assignable to the other overloads, which doesn't really rhyme with the typing spec, so likely scipy-stubs' fault. If you're in a hurry getting this merged there's no need to consider this a blocker, as far as I'm concerned. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@jorenham Thanks!
No hurry, I just want to make sure I am not missing something. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
We want have Currently the first match would give us the desired result (because Index[Never] matches Index[Any]). Ideally we would like to simply write and without Upon Upon However in many cases |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I understand, but the current mypy behavior is inconsistent for self-types, if an overload match is caused by
OK, I think I understand. You would prefer that mypy infers |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It looks like there's a similar thing going on with scipy-stubs, which also relies on the "Never-trick". For example in https://github.com/scipy/scipy-stubs/blob/3d76a8e4d5dd2d602351dc0dcf5578ca4b948879/scipy-stubs/spatial/transform/_rotation.pyi#L196 it uses
Until Pyright also fixes this (see microsoft/pyright#10232), these |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@jorenham I was talking about special-casing a different |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Diff from mypy_primer, showing the effect of this PR on open source code: colour (https://github.com/colour-science/colour) - colour/models/rgb/transfer_functions/log.py:240: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]", variable has type "ndarray[tuple[Any, ...], dtype[float64]]") [assignment] + colour/appearance/llab.py:411: error: Argument "a" to "CAM_Specification_LLAB" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/llab.py:412: error: Argument "b" to "CAM_Specification_LLAB" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/atd95.py:305: error: Argument "A_1" to "CAM_Specification_ATD95" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/atd95.py:306: error: Argument "T_1" to "CAM_Specification_ATD95" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/atd95.py:307: error: Argument "D_1" to "CAM_Specification_ATD95" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/atd95.py:308: error: Argument "A_2" to "CAM_Specification_ATD95" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/atd95.py:309: error: Argument "T_2" to "CAM_Specification_ATD95" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/atd95.py:310: error: Argument "D_2" to "CAM_Specification_ATD95" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] - colour/models/hdr_ipt.py:145: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[float64]]", variable has type "float") [assignment] - colour/models/hdr_ipt.py:147: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[float64]]", variable has type "float") [assignment] - colour/models/hdr_ipt.py:149: error: Incompatible return value type (got "float", expected "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]") [return-value] - colour/models/hdr_cie_lab.py:142: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[float64]]", variable has type "float") [assignment] - colour/models/hdr_cie_lab.py:144: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[float64]]", variable has type "float") [assignment] - colour/models/hdr_cie_lab.py:146: error: Incompatible return value type (got "float", expected "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]") [return-value] - colour/colorimetry/illuminants.py:226: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]", variable has type "ndarray[tuple[Any, ...], dtype[float64]]") [assignment] - colour/colorimetry/illuminants.py:227: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]", variable has type "ndarray[tuple[Any, ...], dtype[float64]]") [assignment] + colour/notation/munsell/centore2014.py:434: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]", variable has type "floating[_16Bit] | floating[_32Bit] | float64") [assignment] + colour/notation/munsell/centore2014.py:435: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]", variable has type "floating[_16Bit] | floating[_32Bit] | float64") [assignment] - colour/notation/munsell/centore2014.py:714: error: Argument 1 to "hue_angle_to_hue" has incompatible type "ndarray[tuple[Any, ...], dtype[floating[Any]]]"; expected "float" [arg-type] + colour/notation/munsell/centore2014.py:714: error: Argument 1 to "hue_angle_to_hue" has incompatible type "ndarray[tuple[Any, ...], dtype[float64]]"; expected "float" [arg-type] - colour/notation/munsell/centore2014.py:741: error: Argument 1 to "append" of "list" has incompatible type "ndarray[tuple[Any, ...], dtype[floating[Any]]]"; expected "float" [arg-type] + colour/notation/munsell/centore2014.py:741: error: Argument 1 to "append" of "list" has incompatible type "ndarray[tuple[Any, ...], dtype[float64]]"; expected "float" [arg-type] - colour/notation/munsell/centore2014.py:742: error: Argument 1 to "append" of "list" has incompatible type "ndarray[tuple[Any, ...], dtype[floating[Any]]]"; expected "int" [arg-type] + colour/notation/munsell/centore2014.py:742: error: Argument 1 to "append" of "list" has incompatible type "ndarray[Any, dtype[Any]]"; expected "int" [arg-type] zulip (https://github.com/zulip/zulip) - zerver/lib/attachments.py:182: error: "Message" has no attribute "recipient_id" [attr-defined] - zerver/actions/user_groups.py:130: error: Argument 1 to "list" has incompatible type "QuerySet[UserProfile, dict[str, Any]]"; expected "Iterable[MemberGroupUserDict]" [arg-type] - zerver/actions/user_groups.py:135: error: Argument 1 to "list" has incompatible type "QuerySet[UserProfile, dict[str, Any]]"; expected "Iterable[MemberGroupUserDict]" [arg-type] - zerver/actions/user_groups.py:141: error: Argument 1 to "list" has incompatible type "QuerySet[UserProfile, dict[str, Any]]"; expected "Iterable[MemberGroupUserDict]" [arg-type] - zerver/actions/user_groups.py:144: error: Argument 1 to "list" has incompatible type "QuerySet[UserProfile, dict[str, Any]]"; expected "Iterable[MemberGroupUserDict]" [arg-type] pandas-stubs (https://github.com/pandas-dev/pandas-stubs) + tests/test_windowing.py:48: error: Returning Any from function declared to return "float" [no-any-return] + tests/test_resampler.py:39: error: Returning Any from function declared to return "float" [no-any-return] + tests/test_groupby.py:79: error: Returning Any from function declared to return "float" [no-any-return] + tests/series/test_truediv.py:155: error: Expression is of type "Series[float]", not "Never" [assert-type] + tests/series/test_truediv.py:195: error: Expression is of type "Series[float]", not "Never" [assert-type] + tests/series/test_truediv.py:205: error: Expression is of type "Series[float]", not "Never" [assert-type] + tests/series/test_truediv.py:241: error: Expression is of type "Series[float]", not "Never" [assert-type] + tests/series/test_truediv.py:261: error: Expression is of type "Series[float]", not "Never" [assert-type] + tests/series/test_truediv.py:272: error: Expression is of type "Series[float]", not "Never" [assert-type] + tests/series/test_floordiv.py:64: error: Expression is of type "Series[Any]", not "Series[Timedelta]" [assert-type] + tests/series/test_floordiv.py:135: error: Expression is of type "Series[int]", not "Never" [assert-type] + tests/series/test_floordiv.py:171: error: Expression is of type "Series[int]", 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_floordiv.py:203: error: Expression is of type "Series[int]", not "Never" [assert-type] + tests/series/test_floordiv.py:211: error: Expression is of type "Series[Any]", not "Series[Timedelta]" [assert-type] + tests/series/test_floordiv.py:221: error: Expression is of type "Series[int]", not "Never" [assert-type] + tests/series/test_floordiv.py:230: error: Expression is of type "Series[Any]", not "Series[Timedelta]" [assert-type] + tests/series/test_floordiv.py:277: error: Expression is of type "Series[Any]", not "Series[Timedelta]" [assert-type] + tests/series/test_agg.py:21: error: Expression is of type "Any", not "float" [assert-type] + tests/series/test_agg.py:26: error: Expression is of type "Any", not "float" [assert-type] + tests/series/test_agg.py:31: error: Expression is of type "Any", not "float" [assert-type] + tests/series/test_agg.py:36: error: Expression is of type "Any", not "float" [assert-type] + tests/test_timefuncs.py:1824: error: Expression is of type "Series[Any]", not "Series[Timestamp]" [assert-type] + tests/test_pandas.py:1702: error: Returning Any from function declared to return "float" [no-any-return] + tests/test_pandas.py:2017: error: Returning Any from function declared to return "float" [no-any-return] + tests/frame/test_groupby.py:640: error: Returning Any from function declared to return "float" [no-any-return] + tests/frame/test_frame.py:1154: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[Any]]" [assert-type] + tests/series/test_series.py:682: error: Expression is of type "Any", not "floating[Any]" [assert-type] + tests/series/test_series.py:2185: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[Any]]" [assert-type] scikit-learn (https://github.com/scikit-learn/scikit-learn) - sklearn/linear_model/tests/test_ransac.py:26: error: Argument 1 to "__iadd__" of "ndarray" has incompatible type "ndarray[tuple[Any, ...], dtype[float64]]"; expected "_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]]] | int | _NestedSequence[int]" [arg-type] - sklearn/linear_model/tests/test_ransac.py:28: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[number[Any, float]]]", variable has type "ndarray[tuple[int], dtype[signedinteger[_32Bit | _64Bit]]]") [assignment] - sklearn/linear_model/tests/test_ransac.py:29: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[number[Any, float]]]", variable has type "ndarray[tuple[Any, ...], dtype[floating[Any]]]") [assignment] pandas (https://github.com/pandas-dev/pandas) + pandas/core/util/hashing.py:437: error: Unused "type: ignore" comment [unused-ignore] xarray (https://github.com/pydata/xarray) + xarray/tests/test_typed_ops.py:28: error: Unused "type: ignore" comment [unused-ignore] + xarray/tests/test_typed_ops.py:79: error: Unused "type: ignore" comment [unused-ignore] rclip (https://github.com/yurijmikhalevich/rclip) + rclip/utils/preprocess.py:44: error: Incompatible return value type (got "ndarray[tuple[Any, ...], dtype[float64]]", expected "ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]") [return-value] static-frame (https://github.com/static-frame/static-frame) + static_frame/core/rank.py:166: error: Unused "type: ignore" comment [unused-ignore] scipy-stubs (https://github.com/scipy/scipy-stubs) + tests/spatial/test__rotation.pyi:151: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/interpolate/test_interpolate.pyi:43: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type] + tests/interpolate/test_cubic.pyi:75: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:539: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:564: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:685: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:736: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int, *tuple[Any, ...]], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:746: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int, *tuple[Any, ...]], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:843: error: Expression is of type "tuple[Any, ...]", not "tuple[float64, float64] | tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]" [assert-type] + tests/stats/test_multivariate.pyi:846: error: Expression is of type "tuple[Any, ...]", not "tuple[float64, float64] | tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]" [assert-type] + tests/stats/test_multivariate.pyi:850: error: Expression is of type "tuple[Any, ...]", not "tuple[float64, float64] | tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]" [assert-type] + tests/stats/test_multivariate.pyi:854: error: Expression is of type "tuple[Any, ...]", not "tuple[float64, float64] | tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]" [assert-type] + tests/stats/test_multivariate.pyi:893: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:907: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:923: error: Expression is of type "tuple[Any, ...]", not "tuple[float64, float64] | tuple[ndarray[tuple[Any, ...], dtype[float64]], float64] | tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]" [assert-type] |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
OK, there are still some failures in Anyway, I think there are just two choices I can give you: with special-casing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks. Here's the
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Of course we can, but the real question is whether we should. I started working on this issues (I mean #11347) because:
To clarify on the second, mypy is built on some fundamental principles, one of those is what is sometimes called as "gradual guarantee": replacing a precise type with def get_mean(s: Series[Timestamp]) -> Timestamp: return s.mean() This code type-checks, but replacing So no, I don't think we should make (3) return |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
This was recently changed in the typing spec, so that it now (also) allows types that are assignable to all overloads in case of gradual input: python/typing#2350 So for example |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
At this point I'd like to invite @Dr-Irv to join the discussion, who will be available in a few days. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sure, I oversimplified, but:
@cmp0xff OK, I can wait couple more days. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm not a real expert here on how things should work. But here are some principles that would help us:
Let me explain (2) with a few examples: If a user writes code like this (using an unparameterized generic): def myfunc(ind: pd.Index, b: bool) -> Index: result = ind*b reveal_type(result) return ind * b This relates to example 1 above - type checker should reveal the type as either just With respect to the second example, we'd like to detect when the user is doing division with a from datetime import timedelta from typing import reveal_type import pandas as pd def myfunc(s: pd.Series, td: timedelta): result = s / td reveal_type(result) Currently, mypy, pyright, and pyrefly all detect that And for the 3rd example, we want to support returning a result for the unparameterized from typing import reveal_type import pandas as pd def myfunc(s: pd.Series): result = s.mean() reveal_type(result) Currently, mypy, pyright, and pyrefly all reveal that the type is I think the issue for us with IMHO, it's easier to understand overloads if you just take them in order, and whichever one matches first is the result. If nothing matches, you report an error. We also want to be able to have a match that says "If Probably we are trying to do more than what the typing spec allows. Not sure any of this will help resolve the issue. My philosophy with pandas-stubs is to make it easy for non-typing experts to use the stubs. I do this with my team on a large code base that does not specify parameterized types for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@Dr-Irv OK, two things: Second (and probably more importantly) I think you are trying to solve a wrong problem. from __future__ import annotations import pandas as pd def myfunc(s: pd.Series[float], td: timedelta): # this works result = s / td The future import has been available for ~10 years now, so if anyone still doesn't write a precise type, we should seriously assume it is a "real" class Series[T=float]: ... # T = TypeVar("T", default=float) also works, if you want your stubs to be usable by older versions of mypy. So that all type-checkers will automatically interpret bare |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
While it is true that a user could declare the specific type parameter of Ideally, the typing spec would allow us to differentiate between a variable inferred as Right now, we've been using |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I understand that, but as I said, there are many possible proper solutions for this (assuming this is actually a problem):
Moreover, we already made a compromise by special-casing Btw on the distinction between I am going to merge this tomorrow unless there are strong objections from @JukkaL or @hauntsaninja |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
We actually are specifying a default of |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Diff from mypy_primer, showing the effect of this PR on open source code: colour (https://github.com/colour-science/colour) - colour/models/rgb/transfer_functions/log.py:240: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]", variable has type "ndarray[tuple[Any, ...], dtype[float64]]") [assignment] + colour/appearance/llab.py:411: error: Argument "a" to "CAM_Specification_LLAB" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/llab.py:412: error: Argument "b" to "CAM_Specification_LLAB" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/atd95.py:305: error: Argument "A_1" to "CAM_Specification_ATD95" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/atd95.py:306: error: Argument "T_1" to "CAM_Specification_ATD95" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/atd95.py:307: error: Argument "D_1" to "CAM_Specification_ATD95" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/atd95.py:308: error: Argument "A_2" to "CAM_Specification_ATD95" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/atd95.py:309: error: Argument "T_2" to "CAM_Specification_ATD95" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] + colour/appearance/atd95.py:310: error: Argument "D_2" to "CAM_Specification_ATD95" has incompatible type "floating[_16Bit] | floating[_32Bit] | float64"; expected "float | ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] | None" [arg-type] - colour/models/hdr_ipt.py:145: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[float64]]", variable has type "float") [assignment] - colour/models/hdr_ipt.py:147: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[float64]]", variable has type "float") [assignment] - colour/models/hdr_ipt.py:149: error: Incompatible return value type (got "float", expected "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]") [return-value] - colour/models/hdr_cie_lab.py:142: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[float64]]", variable has type "float") [assignment] - colour/models/hdr_cie_lab.py:144: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[float64]]", variable has type "float") [assignment] - colour/models/hdr_cie_lab.py:146: error: Incompatible return value type (got "float", expected "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]") [return-value] - colour/colorimetry/illuminants.py:226: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]", variable has type "ndarray[tuple[Any, ...], dtype[float64]]") [assignment] - colour/colorimetry/illuminants.py:227: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]", variable has type "ndarray[tuple[Any, ...], dtype[float64]]") [assignment] + colour/notation/munsell/centore2014.py:434: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]", variable has type "floating[_16Bit] | floating[_32Bit] | float64") [assignment] + colour/notation/munsell/centore2014.py:435: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]", variable has type "floating[_16Bit] | floating[_32Bit] | float64") [assignment] - colour/notation/munsell/centore2014.py:714: error: Argument 1 to "hue_angle_to_hue" has incompatible type "ndarray[tuple[Any, ...], dtype[floating[Any]]]"; expected "float" [arg-type] + colour/notation/munsell/centore2014.py:714: error: Argument 1 to "hue_angle_to_hue" has incompatible type "ndarray[tuple[Any, ...], dtype[float64]]"; expected "float" [arg-type] - colour/notation/munsell/centore2014.py:741: error: Argument 1 to "append" of "list" has incompatible type "ndarray[tuple[Any, ...], dtype[floating[Any]]]"; expected "float" [arg-type] + colour/notation/munsell/centore2014.py:741: error: Argument 1 to "append" of "list" has incompatible type "ndarray[tuple[Any, ...], dtype[float64]]"; expected "float" [arg-type] - colour/notation/munsell/centore2014.py:742: error: Argument 1 to "append" of "list" has incompatible type "ndarray[tuple[Any, ...], dtype[floating[Any]]]"; expected "int" [arg-type] + colour/notation/munsell/centore2014.py:742: error: Argument 1 to "append" of "list" has incompatible type "ndarray[Any, dtype[Any]]"; expected "int" [arg-type] zulip (https://github.com/zulip/zulip) - zerver/lib/attachments.py:182: error: "Message" has no attribute "recipient_id" [attr-defined] - zerver/actions/user_groups.py:142: error: Argument 1 to "list" has incompatible type "QuerySet[UserProfile, dict[str, Any]]"; expected "Iterable[MemberGroupUserDict]" [arg-type] - zerver/actions/user_groups.py:147: error: Argument 1 to "list" has incompatible type "QuerySet[UserProfile, dict[str, Any]]"; expected "Iterable[MemberGroupUserDict]" [arg-type] - zerver/actions/user_groups.py:153: error: Argument 1 to "list" has incompatible type "QuerySet[UserProfile, dict[str, Any]]"; expected "Iterable[MemberGroupUserDict]" [arg-type] - zerver/actions/user_groups.py:156: error: Argument 1 to "list" has incompatible type "QuerySet[UserProfile, dict[str, Any]]"; expected "Iterable[MemberGroupUserDict]" [arg-type] pandas-stubs (https://github.com/pandas-dev/pandas-stubs) + tests/test_windowing.py:48: error: Returning Any from function declared to return "float" [no-any-return] + tests/test_resampler.py:39: error: Returning Any from function declared to return "float" [no-any-return] + tests/test_groupby.py:86: error: Returning Any from function declared to return "float" [no-any-return] + tests/series/test_truediv.py:155: error: Expression is of type "Series[float]", not "Never" [assert-type] + tests/series/test_truediv.py:195: error: Expression is of type "Series[float]", not "Never" [assert-type] + tests/series/test_truediv.py:205: error: Expression is of type "Series[float]", not "Never" [assert-type] + tests/series/test_truediv.py:241: error: Expression is of type "Series[float]", not "Never" [assert-type] + tests/series/test_truediv.py:261: error: Expression is of type "Series[float]", not "Never" [assert-type] + tests/series/test_truediv.py:272: error: Expression is of type "Series[float]", not "Never" [assert-type] + tests/series/test_floordiv.py:64: error: Expression is of type "Series[Any]", not "Series[Timedelta]" [assert-type] + tests/series/test_floordiv.py:135: error: Expression is of type "Series[int]", not "Never" [assert-type] + tests/series/test_floordiv.py:171: error: Expression is of type "Series[int]", 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_floordiv.py:203: error: Expression is of type "Series[int]", not "Never" [assert-type] + tests/series/test_floordiv.py:211: error: Expression is of type "Series[Any]", not "Series[Timedelta]" [assert-type] + tests/series/test_floordiv.py:221: error: Expression is of type "Series[int]", not "Never" [assert-type] + tests/series/test_floordiv.py:230: error: Expression is of type "Series[Any]", not "Series[Timedelta]" [assert-type] + tests/series/test_floordiv.py:277: error: Expression is of type "Series[Any]", not "Series[Timedelta]" [assert-type] + tests/series/test_agg.py:21: error: Expression is of type "Any", not "float" [assert-type] + tests/series/test_agg.py:26: error: Expression is of type "Any", not "float" [assert-type] + tests/series/test_agg.py:31: error: Expression is of type "Any", not "float" [assert-type] + tests/series/test_agg.py:36: error: Expression is of type "Any", not "float" [assert-type] + tests/test_timefuncs.py:1815: error: Expression is of type "Series[Any]", not "Series[Timestamp]" [assert-type] + tests/test_pandas.py:1702: error: Returning Any from function declared to return "float" [no-any-return] + tests/test_pandas.py:2017: error: Returning Any from function declared to return "float" [no-any-return] + tests/frame/test_groupby.py:640: error: Returning Any from function declared to return "float" [no-any-return] + tests/frame/test_frame.py:1154: error: Expression is of type "Any", not "ndarray[tuple[int], dtype[Any]]" [assert-type] + tests/series/test_series.py:682: error: Expression is of type "Any", not "floating[Any]" [assert-type] + tests/series/test_series.py:2197: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[Any]]" [assert-type] scikit-learn (https://github.com/scikit-learn/scikit-learn) - sklearn/linear_model/tests/test_ransac.py:26: error: Argument 1 to "__iadd__" of "ndarray" has incompatible type "ndarray[tuple[Any, ...], dtype[float64]]"; expected "_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]]] | int | _NestedSequence[int]" [arg-type] - sklearn/linear_model/tests/test_ransac.py:28: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[number[Any, float]]]", variable has type "ndarray[tuple[int], dtype[signedinteger[_32Bit | _64Bit]]]") [assignment] - sklearn/linear_model/tests/test_ransac.py:29: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[number[Any, float]]]", variable has type "ndarray[tuple[Any, ...], dtype[floating[Any]]]") [assignment] pandas (https://github.com/pandas-dev/pandas) + pandas/core/util/hashing.py:439: error: Unused "type: ignore" comment [unused-ignore] freqtrade (https://github.com/freqtrade/freqtrade) - freqtrade/optimize/optimize_reports/optimize_reports.py:357: error: "float" has no attribute "round" [attr-defined] - freqtrade/optimize/backtesting.py:1606: error: List comprehension has incompatible type List[list[Any]]; expected List[tuple[Any, ...]] [misc] xarray (https://github.com/pydata/xarray) + xarray/tests/test_typed_ops.py:28: error: Unused "type: ignore" comment [unused-ignore] + xarray/tests/test_typed_ops.py:79: error: Unused "type: ignore" comment [unused-ignore] rclip (https://github.com/yurijmikhalevich/rclip) + rclip/utils/preprocess.py:44: error: Incompatible return value type (got "ndarray[tuple[Any, ...], dtype[float64]]", expected "ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]") [return-value] static-frame (https://github.com/static-frame/static-frame) + static_frame/core/rank.py:166: error: Unused "type: ignore" comment [unused-ignore] scipy-stubs (https://github.com/scipy/scipy-stubs) + tests/spatial/test__rotation.pyi:163: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/interpolate/test_interpolate.pyi:44: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type] + tests/interpolate/test_cubic.pyi:75: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:574: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:599: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:723: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:774: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int, *tuple[Any, ...]], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:784: error: Expression is of type "ndarray[Any, Any]", not "ndarray[tuple[int, int, *tuple[Any, ...]], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:887: error: Expression is of type "tuple[Any, ...]", not "tuple[float64, float64] | tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]" [assert-type] + tests/stats/test_multivariate.pyi:890: error: Expression is of type "tuple[Any, ...]", not "tuple[float64, float64] | tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]" [assert-type] + tests/stats/test_multivariate.pyi:894: error: Expression is of type "tuple[Any, ...]", not "tuple[float64, float64] | tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]" [assert-type] + tests/stats/test_multivariate.pyi:898: error: Expression is of type "tuple[Any, ...]", not "tuple[float64, float64] | tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]" [assert-type] + tests/stats/test_multivariate.pyi:937: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:951: error: Expression is of type "Any", not "float64 | ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/stats/test_multivariate.pyi:967: error: Expression is of type "tuple[Any, ...]", not "tuple[float64, float64] | tuple[ndarray[tuple[Any, ...], dtype[float64]], float64] | tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]" [assert-type] + tests/stats/test_distribution_infrastructure.pyi:150: error: Expression is of type "Any", not "ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/stats/test_distribution_infrastructure.pyi:156: error: Expression is of type "Any", not "ndarray[tuple[Any, ...], dtype[float64]]" [assert-type] + tests/sparse/test_spbase.pyi:260: error: Expression is of type "Any", not "_spbase[numpy.bool[builtins.bool], tuple[Any, ...]]" [assert-type] + tests/sparse/test_spbase.pyi:271: error: Expression is of type "Any", not "_spbase[numpy.bool[builtins.bool], tuple[Any, ...]]" [assert-type] + tests/sparse/test_matrix_io.pyi:85: error: Expression is of type "ndarray[tuple[int], dtype[Any]] | Any | matrix[tuple[int, int], dtype[Any]]", not "ndarray[tuple[int], dtype[Any]] | matrix[tuple[int, int], dtype[Any]]" [assert-type] + tests/misc/test_submodules_empty.pyi:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Overload ambiguity is ignored inself-annotated methods
There was an error while loading. Please reload this page.