8000 TYP: Type ``MaskedArray.put``, ``np.ma.put``, ``np.ma.putmask`` by MarcoGorelli · Pull Request #28745 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

TYP: Type MaskedArray.put, np.ma.put, np.ma.putmask #28745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 17, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'main' into ma-put
  • Loading branch information
MarcoGorelli authored Apr 17, 2025
commit 1a988e0775b95fd2a8b2c77dfa79af6aa67c5a21
10 changes: 10 additions & 0 deletions numpy/typing/tests/data/reveal/ma.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,13 @@ assert_type(np.ma.put(MAR_f4, 4, 999), None)
assert_type(np.ma.put(MAR_f4, 4, 999, mode='clip'), None)

assert_type(np.ma.putmask(MAR_f4, [True, False], [0, 1]), None)

assert_type(MAR_f4.filled(float('nan')), NDArray[np.float32])
assert_type(MAR_i8.filled(), NDArray[np.int64])
assert_type(MAR_1d.filled(), np.ndarray[tuple[int], np.dtype[Any]])

assert_type(np.ma.filled(MAR_f4, float('nan')), NDArray[np.float32])
assert_type(np.ma.filled([[1,2,3]]), NDArray[Any])
# PyRight detects this one correctly, but mypy doesn't.
# https://github.com/numpy/numpy/pull/28742#discussion_r2048968375
assert_type(np.ma.filled(MAR_1d), np.ndarray[tuple[int], np.dtype[Any]]) # type: ignore[assert-type]
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0