Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jorenham
Copy link
Member

closes #28701

@jorenham jorenham added 09 - Backport-Candidate PRs tagged should be backported 41 - Static typing labels Apr 14, 2025
@jorenham
Copy link
Member Author

CI failure seems unrelated

Copy link

Diff from mypy_primer, showing the effect of this PR on type check results on a corpus of open source code:

hydpy (https://github.com/hydpy-dev/hydpy)
- hydpy/core/testtools.py:1492: error: Incompatible return value type (got "ndarray[tuple[int, ...], dtype[floating[Any]]]", expected "ndarray[tuple[int, ...], dtype[float64]]")  [return-value]
- hydpy/core/parametertools.py:1540: error: Incompatible return value type (got "ndarray[tuple[int, ...], dtype[floating[Any]]]", expected "ndarray[tuple[int, ...], dtype[float64]]")  [return-value]
- hydpy/core/parametertools.py:1540: error: Incompatible return value type (got "float | ndarray[tuple[int, ...], dtype[floating[Any]]]", expected "float | ndarray[tuple[int, ...], dtype[float64]]")  [return-value]
- hydpy/core/parametertools.py:1567: error: Incompatible return value type (got "ndarray[tuple[int, ...], dtype[floating[Any]]]", expected "ndarray[tuple[int, ...], dtype[float64]]")  [return-value]
- hydpy/core/parametertools.py:1567: error: Incompatible return value type (got "float | ndarray[tuple[int, ...], dtype[floating[Any]]]", expected "float | ndarray[tuple[int, ...], dtype[float64]]")  [return-value]
- hydpy/auxs/armatools.py:722: error: Incompatible types in assignment (expression has type "ndarray[tuple[int, ...], dtype[floating[Any]]]", variable has type "Sequence[float] | ndarray[tuple[int, ...], dtype[float64]]")  [assignment]

@charris charris merged commit 5147e4d into numpy:main Apr 14, 2025
74 of 75 checks passed
@charris
Copy link
Member

charris commented Apr 14, 2025

Thanks Joren.

@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Apr 14, 2025
@jorenham jorenham deleted the typing/fix-28701 branch April 14, 2025 16:31
@s-banach
Copy link

Sorry to bother you guys.
Will type annotations eventually be able to say things like
"my_array / 2.0 has the same n_dimensions as my_array"?

@jorenham
Copy link
Member Author

Sorry to bother you guys. Will type annotations eventually be able to say things like "my_array / 2.0 has the same n_dimensions as my_array"?

yes; that's the plan :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TYP: Loosing np.float64 in numpy array type after division with a Python float
3 participants