[ty] Simplify intersections with bounded covariant generics - #27243
Draft
sharkdp wants to merge 1 commit into
Draft
[ty] Simplify intersections with bounded covariant generics#27243sharkdp wants to merge 1 commit into
sharkdp wants to merge 1 commit into
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 96.84%. The percentage of expected errors that received a diagnostic held steady at 92.11%. The number of fully passing files held steady at 99/133. |
Memory usage reportMemory usage unchanged ✅ |
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
unresolved-attribute |
0 | 4 | 0 |
invalid-argument-type |
0 | 0 | 1 |
no-matching-overload |
0 | 1 | 0 |
| Total | 0 | 5 | 1 |
Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.
Raw diff:
colour (https://github.com/colour-science/colour)
- colour/continuous/multi_signals.py:1492:44 error[invalid-argument-type] Argument to `Signal.__init__` is incorrect: Argument type `(_SupportsArray[dtype[Any]] & Top[Series[Any]] & ~Signal & ~MultiSignals & ~tuple[object, ...] & ~Top[list[Unknown]] & ~ndarray[tuple[object, ...], dtype[object]] & ~Iterator[object] & ~ValuesView[object] & ~Top[dict[Unknown, Unknown]]) | (_NestedSequence[_SupportsArray[dtype[Any]]] & Top[Series[Any]] & ~Signal & ~MultiSignals & ~tuple[object, ...] & ~Top[list[Unknown]] & ~ndarray[tuple[object, ...], dtype[object]] & ~Iterator[object] & ~ValuesView[object] & ~Top[dict[Unknown, Unknown]]) | (DataFrame & Top[Series[Any]] & ~Signal & ~MultiSignals & ~tuple[object, ...] & ~Top[list[Unknown]] & ~ndarray[tuple[object, ...], dtype[object]] & ~Iterator[object] & ~ValuesView[object] & ~Top[dict[Unknown, Unknown]]) | (Sequence[Unknown] & Top[Series[Any]] & ~Signal & ~MultiSignals & ~tuple[object, ...] & ~Top[list[Unknown]] & ~ndarray[tuple[object, ...], dtype[object]] & ~Iterator[object] & ~ValuesView[object] & ~Top[dict[Unknown, Unknown]]) | (Series[Any] & ~Signal & ~MultiSignals & ~tuple[object, ...] & ~Top[list[Unknown]] & ~ndarray[tuple[object, ...], dtype[object]] & ~Iterator[object] & ~ValuesView[object] & ~Top[dict[Unknown, Unknown]])` does not satisfy upper bound `Signal` of type variable `Self`
+ colour/continuous/multi_signals.py:1492:44 error[invalid-argument-type] Argument to `Signal.__init__` is incorrect: Argument type `(DataFrame & Top[Series[Any]] & ~Signal & ~MultiSignals & ~tuple[object, ...] & ~Top[list[Unknown]] & ~ndarray[tuple[object, ...], dtype[object]] & ~Iterator[object] & ~ValuesView[object] & ~Top[dict[Unknown, Unknown]]) | (Sequence[Unknown] & Top[Series[Any]] & ~Signal & ~MultiSignals & ~tuple[object, ...] & ~Top[list[Unknown]] & ~ndarray[tuple[object, ...], dtype[object]] & ~Iterator[object] & ~ValuesView[object] & ~Top[dict[Unknown, Unknown]]) | (Series[Any] & ~Signal & ~MultiSignals & ~tuple[object, ...] & ~Top[list[Unknown]] & ~ndarray[tuple[object, ...], dtype[object]] & ~Iterator[object] & ~ValuesView[object] & ~Top[dict[Unknown, Unknown]])` does not satisfy upper bound `Signal` of type variable `Self`
pandas (https://github.com/pandas-dev/pandas)
- pandas/core/array_algos/take.py:124:16 error[no-matching-overload] No overload of bound method `ndarray.take` matches arguments
xarray (https://github.com/pydata/xarray)
- xarray/core/variable.py:963:30 error[unresolved-attribute] Attribute `shape` is not defined on `_SupportsArray[dtype[Any]]`, `_NestedSequence[_SupportsArray[dtype[Any]]]` in union `(T_DuckArray@_copy & ~None) | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]]`
- xarray/core/variable.py:965:35 error[unresolved-attribute] Attribute `shape` is not defined on `_SupportsArray[dtype[Any]]`, `_NestedSequence[_SupportsArray[dtype[Any]]]` in union `(T_DuckArray@_copy & ~None) | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]]`
- xarray/core/variable.py:2920:30 error[unresolved-attribute] Attribute `shape` is not defined on `_SupportsArray[dtype[Any]]`, `_NestedSequence[_SupportsArray[dtype[Any]]]` in union `(T_DuckArray@copy & ~None) | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]]`
- xarray/core/variable.py:2922:35 error[unresolved-attribute] Attribute `shape` is not defined on `_SupportsArray[dtype[Any]]`, `_NestedSequence[_SupportsArray[dtype[Any]]]` in union `(T_DuckArray@copy & ~None) | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]]`
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.
Summary
Recognize that a gradual specialization of a bounded covariant generic is a subtype of its own upper bound. For example,
Bounded[Any] & ~Bounded[UpperBound]simplifies toNeverwhenBoundedis covariant and its type variable has a declared upper bound.Related to astral-sh/ty#4103.
Test Plan