Skip to content

Commit 1886180

Browse files
committed
Add support of python built-in function divmod()
1 parent 7e46493 commit 1886180

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

dpnp/dpnp_array.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@ def __copy__(self):
214214

215215
# '__deepcopy__',
216216
# '__dir__',
217-
# '__divmod__',
217+
218+
def __divmod__(self, other, /):
219+
r"""Return :math:`\text{divmod(self, value)}`."""
220+
return dpnp.divmod(self, other)
218221

219222
def __dlpack__(
220223
self, /, *, stream=None, max_version=None, dl_device=None, copy=None
@@ -495,7 +498,10 @@ def __rand__(self, other, /):
495498
r"""Return :math:`\text{value & self}`."""
496499
return dpnp.bitwise_and(other, self)
497500

498-
# '__rdivmod__',
501+
def __rdivmod__(self, other, /):
502+
r"""Return :math:`\text{divmod(value, self)}`."""
503+
return dpnp.divmod(other, self)
504+
499505
# '__reduce__',
500506
# '__reduce_ex__',
501507

@@ -505,7 +511,7 @@ def __repr__(self):
505511

506512
def __rfloordiv__(self, other, /):
507513
r"""Return :math:`\text{value // self}`."""
508-
return dpnp.floor_divide(self, other)
514+
return dpnp.floor_divide(other, self)
509515

510516
def __rlshift__(self, other, /):
511517
r"""Return :math:`\text{value << self}`."""

0 commit comments

Comments
 (0)