[ty] Fix Self specialization for bound methods on union-bounded typevars#24425
Draft
charliermarsh wants to merge 3 commits intomainfrom
Draft
[ty] Fix Self specialization for bound methods on union-bounded typevars#24425charliermarsh wants to merge 3 commits intomainfrom
Self specialization for bound methods on union-bounded typevars#24425charliermarsh wants to merge 3 commits intomainfrom
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 87.72%. The percentage of expected errors that received a diagnostic held steady at 82.85%. The number of fully passing files held steady at 74/132. |
Memory usage reportSummary
Significant changesClick to expand detailed breakdownsphinx
trio
flake8
prefect
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
5 | 38 | 2 |
invalid-return-type |
1 | 1 | 9 |
invalid-assignment |
1 | 6 | 1 |
no-matching-overload |
0 | 6 | 0 |
possibly-missing-implicit-call |
2 | 0 | 0 |
not-iterable |
0 | 1 | 0 |
unresolved-attribute |
0 | 0 | 1 |
unsupported-operator |
0 | 1 | 0 |
| Total | 9 | 53 | 13 |
Raw diff (75 changes)
aiohttp (https://github.com/aio-libs/aiohttp)
- aiohttp/client.py:1534:16 error[invalid-return-type] Return type does not match returned value: expected `_RetType_co@_BaseRequestContextManager`, found `ClientResponse | Unknown`
+ aiohttp/client.py:1534:16 error[invalid-return-type] Return type does not match returned value: expected `_RetType_co@_BaseRequestContextManager`, found `ClientResponse | _RetType_co@_BaseRequestContextManager`
- aiohttp/client.py:1534:22 error[invalid-argument-type] Argument to bound method `__aenter__` is incorrect: Argument type `_RetType_co@_BaseRequestContextManager` does not satisfy upper bound `ClientWebSocketResponse[_DecodeText@ClientWebSocketResponse]` of type variable `Self`
- aiohttp/client.py:1542:15 error[invalid-argument-type] Argument to bound method `__aexit__` is incorrect: Argument type `_RetType_co@_BaseRequestContextManager` does not satisfy upper bound `ClientWebSocketResponse[_DecodeText@ClientWebSocketResponse]` of type variable `Self`
core (https://github.com/home-assistant/core)
- homeassistant/components/asuswrt/helpers.py:44:16 error[invalid-return-type] Return type does not match returned value: expected `T@translate_to_legacy`, found `dict[Unknown, object]`
+ homeassistant/components/asuswrt/helpers.py:44:16 error[invalid-return-type] Return type does not match returned value: expected `T@translate_to_legacy`, found `dict[str, Any]`
- homeassistant/components/asuswrt/helpers.py:44:17 error[no-matching-overload] No overload of bound method `get` matches arguments
hydpy (https://github.com/hydpy-dev/hydpy)
- hydpy/auxs/iuhtools.py:516:13 error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]] | tuple[ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]], ...], /) -> ndarray[tuple[Any, ...], dtype[float64]], (key: SupportsIndex | tuple[SupportsIndex, ...], /) -> Any, (key: SupportsIndex | slice[Any, Any, Any] | EllipsisType | ... omitted 5 union elements, /) -> ndarray[tuple[Any, ...], dtype[float64]], (key: str, /) -> ndarray[tuple[int] | tuple[Any, ...], dtype[Any]], (key: list[str], /) -> ndarray[tuple[int] | tuple[Any, ...], Unknown]]` cannot be called with key of type `bool` on object of type `VectorFloatFlex@__call__`
- hydpy/auxs/iuhtools.py:516:13 error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]] | tuple[ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]], ...], /) -> ndarray[tuple[Any, ...], dtype[float64]], (key: SupportsIndex | tuple[SupportsIndex, ...], /) -> Any, (key: SupportsIndex | slice[Any, Any, Any] | EllipsisType | ... omitted 5 union elements, /) -> ndarray[tuple[Any, ...], dtype[float64]], (key: str, /) -> ndarray[tuple[int] | tuple[Any, ...], dtype[Any]], (key: list[str], /) -> ndarray[tuple[int] | tuple[Any, ...], Unknown]]` cannot be called with key of type `ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]` on object of type `VectorFloatFlex@__call__`
+ hydpy/auxs/iuhtools.py:516:13 warning[possibly-missing-implicit-call] Method `__getitem__` of type `VectorFloatFlex@__call__` may be missing
+ hydpy/auxs/iuhtools.py:516:13 warning[possibly-missing-implicit-call] Method `__getitem__` of type `VectorFloatFlex@__call__` may be missing
+ hydpy/auxs/iuhtools.py:516:13 error[invalid-assignment] Object of type `Any | ndarray[tuple[Any, ...], dtype[float64]]` is not assignable to `VectorFloatFlex@__call__`
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/algorithms.py:223:12 error[invalid-return-type] Return type does not match returned value: expected `ArrayLikeT@_reconstruct_data`, found `Unknown | ndarray[tuple[Any, ...], Unknown]`
- pandas/core/arrays/datetimes.py:3106:21 error[invalid-assignment] Object of type `Timestamp` is not assignable to `_TimestampNoneT1@_maybe_normalize_endpoints`
- pandas/core/arrays/datetimes.py:3109:19 error[invalid-assignment] Object of type `Timestamp` is not assignable to `_TimestampNoneT2@_maybe_normalize_endpoints`
- pandas/core/dtypes/cast.py:388:16 error[invalid-return-type] Return type does not match returned value: expected `NumpyIndexT@maybe_upcast_numeric_to_64bit`, found `Unknown | Index`
+ pandas/core/dtypes/cast.py:388:16 error[invalid-return-type] Return type does not match returned value: expected `NumpyIndexT@maybe_upcast_numeric_to_64bit`, found `ndarray[tuple[Any, ...], Unknown] | Index`
- pandas/core/dtypes/cast.py:388:16 error[no-matching-overload] No overload of bound method `astype` matches arguments
- pandas/core/dtypes/cast.py:390:16 error[invalid-return-type] Return type does not match returned value: expected `NumpyIndexT@maybe_upcast_numeric_to_64bit`, found `Unknown | Index`
+ pandas/core/dtypes/cast.py:390:16 error[invalid-return-type] Return type does not match returned value: expected `NumpyIndexT@maybe_upcast_numeric_to_64bit`, found `ndarray[tuple[Any, ...], Unknown] | Index`
- pandas/core/dtypes/cast.py:390:16 error[no-matching-overload] No overload of bound method `astype` matches arguments
- pandas/core/dtypes/cast.py:392:16 error[invalid-return-type] Return type does not match returned value: expected `NumpyIndexT@maybe_upcast_numeric_to_64bit`, found `Unknown | Index`
+ pandas/core/dtypes/cast.py:392:16 error[invalid-return-type] Return type does not match returned value: expected `NumpyIndexT@maybe_upcast_numeric_to_64bit`, found `ndarray[tuple[Any, ...], Unknown] | Index`
- pandas/core/dtypes/cast.py:392:16 error[no-matching-overload] No overload of bound method `astype` matches arguments
- pandas/core/resample.py:3208:12 error[invalid-return-type] Return type does not match returned value: expected `FreqIndexT@_asfreq_compat`, found `PeriodIndex | DatetimeIndex | TimedeltaIndex`
+ pandas/core/resample.py:3208:12 error[invalid-return-type] Return type does not match returned value: expected `FreqIndexT@_asfreq_compat`, found `(FreqIndexT@_asfreq_compat & PeriodIndex) | DatetimeIndex | TimedeltaIndex`
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/templating.py:92:47 error[invalid-argument-type] Argument to function `find_placeholders` is incorrect: Argument type `object` does not satisfy constraints (`str`, `int`, `int | float`, `bool`, `dict[Any, Any]`, `list[Any]`, `None`) of type variable `T`
- src/prefect/utilities/templating.py:224:29 error[no-matching-overload] No overload of function `apply_values` matches arguments
- src/prefect/utilities/templating.py:232:17 error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `Unknown & ~<class 'NotSet'>` on object of type `dict[str, Any]`
- src/prefect/utilities/templating.py:234:17 error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `object` on object of type `dict[str, Any]`
- src/prefect/utilities/templating.py:330:29 error[no-matching-overload] No overload of bound method `get` matches arguments
- src/prefect/utilities/templating.py:339:13 error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `Unknown` on object of type `dict[str, Any]`
- src/prefect/utilities/templating.py:456:16 error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `dict[object, Unknown]`
+ src/prefect/utilities/templating.py:456:16 error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `dict[Any, Unknown]`
scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- src/scikit_build_core/metadata/__init__.py:89:24 error[invalid-argument-type] Argument is incorrect: Expected `str`, found `object`
+ src/scikit_build_core/metadata/__init__.py:89:35 error[invalid-argument-type] Argument is incorrect: Expected `str`, found `str | list[str] | dict[str, str]`
- src/scikit_build_core/metadata/__init__.py:89:35 error[invalid-argument-type] Argument is incorrect: Expected `str`, found `object`
- src/scikit_build_core/metadata/__init__.py:107:16 error[invalid-return-type] Return type does not match returned value: expected `T@_process_dynamic_metadata`, found `dict[object, dict[str, str]]`
+ src/scikit_build_core/metadata/__init__.py:107:16 error[invalid-return-type] Return type does not match returned value: expected `T@_process_dynamic_metadata`, found `dict[str, dict[str, str]]`
- src/scikit_build_core/metadata/__init__.py:108:51 error[unresolved-attribute] Object of type `object` has no attribute `items`
+ src/scikit_build_core/metadata/__init__.py:108:51 error[unresolved-attribute] Attribute `items` is not defined on `str`, `list[str]` in union `str | list[str] | dict[str, str]`
- src/scikit_build_core/metadata/__init__.py:117:16 error[invalid-return-type] Return type does not match returned value: expected `T@_process_dynamic_metadata`, found `dict[object, list[str]]`
+ src/scikit_build_core/metadata/__init__.py:117:16 error[invalid-return-type] Return type does not match returned value: expected `T@_process_dynamic_metadata`, found `dict[str, list[str]]`
- src/scikit_build_core/metadata/__init__.py:117:40 error[not-iterable] Object of type `object` is not iterable
spack (https://github.com/spack/spack)
- lib/spack/spack/vendor/markupsafe/__init__.py:248:13 error[invalid-assignment] Invalid subscript assignment with key of type `Any` and value of type `Markup` on object of type `_ListOrDict@_escape_argspec`
xarray (https://github.com/pydata/xarray)
- xarray/computation/rolling.py:199:9 error[unsupported-operator] Operator `/=` is not supported between objects of type `T_Xarray@Rolling` and `Unknown`
- xarray/computation/rolling.py:1216:20 error[invalid-return-type] Return type does not match returned value: expected `T_Xarray@Coarsen`, found `DataArray`
- xarray/core/coordinates.py:1214:69 error[invalid-argument-type] Method `__getitem__` of type `(bound method T_Xarray@assert_coordinate_consistent.__getitem__(key: Any) -> T_Xarray@assert_coordinate_consistent) | (Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_Xarray@assert_coordinate_consistent])` cannot be called with key of type `Unknown` on object of type `T_Xarray@assert_coordinate_consistent`
- xarray/core/coordinates.py:1217:51 error[invalid-argument-type] Method `__getitem__` of type `(bound method T_Xarray@assert_coordinate_consistent.__getitem__(key: Any) -> T_Xarray@assert_coordinate_consistent) | (Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_Xarray@assert_coordinate_consistent])` cannot be called with key of type `Unknown` on object of type `T_Xarray@assert_coordinate_consistent`
- xarray/core/groupby.py:688:25 error[invalid-argument-type] Argument to bound method `transpose` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:688:25 error[invalid-argument-type] Argument to bound method `transpose` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:712:27 error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:712:27 error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:776:20 error[invalid-argument-type] Argument to bound method `_shuffle` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:776:20 error[invalid-argument-type] Argument to bound method `_shuffle` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:781:20 error[invalid-argument-type] Argument to bound method `_from_temp_dataset` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:843:16 error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:843:16 error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:871:23 error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:871:23 error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:963:24 error[invalid-argument-type] Method `__getitem__` of type `(bound method T_Xarray@GroupBy.__getitem__(key: Any) -> T_Xarray@GroupBy) | (Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_Xarray@GroupBy])` cannot be called with key of type `Unknown` on object of type `T_Xarray@GroupBy`
- xarray/core/groupby.py:964:35 error[invalid-argument-type] Method `__getitem__` of type `(bound method T_Xarray@GroupBy.__getitem__(key: Any) -> T_Xarray@GroupBy) | (Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_Xarray@GroupBy])` cannot be called with key of type `Unknown` on object of type `T_Xarray@GroupBy`
- xarray/core/groupby.py:1148:13 error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:1148:13 error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:1227:15 error[invalid-argument-type] Argument to bound method `transpose` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:1227:15 error[invalid-argument-type] Argument to bound method `transpose` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/indexes.py:1929:23 error[invalid-assignment] Object of type `Index` is not assignable to `T_PandasOrXarrayIndex@Indexes`
+ xarray/core/indexes.py:1929:23 error[invalid-assignment] Object of type `PandasIndex | (T_PandasOrXarrayIndex@Indexes & Index)` is not assignable to `T_PandasOrXarrayIndex@Indexes`
- xarray/core/resample.py:107:16 error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:107:16 error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:129:23 error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:129:23 error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:151:16 error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:151:16 error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:178:16 error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:178:16 error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:206:16 error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:206:16 error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:245:16 error[invalid-argument-type] Argument to bound method `interp` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:245:16 error[invalid-argument-type] Argument to bound method `interp` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/indexes/nd_point_index.py:302:38 error[invalid-argument-type] Argument to bound method `equals` is incorrect: Argument type `object` does not satisfy upper bound `TreeAdapter` of type variable `Self`
+ xarray/plot/facetgrid.py:172:43 error[invalid-argument-type] Argument to bound method `to_index` is incorrect: Expected `DataArray`, found `T_DataArrayOrSet@FacetGrid`
+ xarray/plot/facetgrid.py:173:43 error[invalid-argument-type] Argument to bound method `to_index` is incorrect: Expected `DataArray`, found `T_DataArrayOrSet@FacetGrid`
+ xarray/plot/facetgrid.py:231:26 error[invalid-argument-type] Argument to bound method `to_numpy` is incorrect: Expected `DataArray`, found `T_DataArrayOrSet@FacetGrid`
+ xarray/plot/facetgrid.py:232:26 error[invalid-argument-type] Argument to bound method `to_numpy` is incorrect: Expected `DataArray`, found `T_DataArrayOrSet@FacetGrid`
+ xarray/plot/facetgrid.py:236:44 error[invalid-argument-type] Argument to bound method `to_numpy` is incorrect: Expected `DataArray`, found `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:861:38 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Any` on object of type `T_DataArrayOrSet@FacetGrid`
+ xarray/plot/facetgrid.py:861:38 error[invalid-argument-type] Argument to function `label_from_attrs` is incorrect: Expected `DataArray | None`, found `T_DataArrayOrSet@FacetGrid`
Merging this PR will not alter performance
Comparing Footnotes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.