8000 TYP: allow inplace division of ``NDArray[timedelta64]`` by floats · numpy/numpy@4125f0a · GitHub
[go: up one dir, main page]

Skip to content

Commit 4125f0a

Browse files
committed
TYP: allow inplace division of NDArray[timedelta64] by floats
1 parent c807e09 commit 4125f0a

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

numpy/__init__.pyi

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3440,27 +3440,23 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
34403440

34413441
#
34423442
@overload
3443-
def __itruediv__(self: NDArray[floating], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
3443+
def __itruediv__(self: NDArray[floating | timedelta64], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
34443444
@overload
34453445
def __itruediv__(self: NDArray[complexfloating], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
34463446
@overload
3447-
def __itruediv__(self: NDArray[timedelta64], other: _ArrayLikeInt, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
3448-
@overload
34493447
def __itruediv__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
34503448

34513449
# keep in sync with `__imod__`
34523450
@overload
34533451
def __ifloordiv__(
34543452
self: NDArray[unsignedinteger],
34553453
other: _ArrayLikeUInt_co | _IntLike_co,
3456-
/
3454+
/,
34573455
) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
34583456
@overload
34593457
def __ifloordiv__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
34603458
@overload
3461-
def __ifloordiv__(self: NDArray[floating], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
3462-
@overload
3463-
def __ifloordiv__(self: NDArray[timedelta64], other: _ArrayLikeInt, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
3459+
def __ifloordiv__(self: NDArray[floating | timedelta64], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
34643460
@overload
34653461
def __ifloordiv__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
34663462

numpy/typing/tests/data/pass/arithmetic.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,13 @@ def __rpow__(self, value: Any) -> Object:
252252

253253
AR_LIKE_m // AR_m
254254

255+
AR_m /= f
256+
AR_m //= f
257+
AR_m /= AR_f
258+
AR_m /= AR_LIKE_f
259+
AR_m //= AR_f
260+
AR_m //= AR_LIKE_f
261+
255262
AR_O // AR_LIKE_b
256263
AR_O // AR_LIKE_u
257264
AR_O // AR_LIKE_i

0 commit comments

Comments
 (0)
0