Skip to content

Commit 9ec6b8f

Browse files
committed
Add support of python built-in function divmod()
1 parent 25fee15 commit 9ec6b8f

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
@@ -212,7 +212,10 @@ def __copy__(self):
212212

213213
# '__deepcopy__',
214214
# '__dir__',
215-
# '__divmod__',
215+
216+
def __divmod__(self, other, /):
217+
r"""Return :math:`\text{divmod(self, value)}`."""
218+
return dpnp.divmod(self, other)
216219

217220
def __dlpack__(
218221
self, /, *, stream=None, max_version=None, dl_device=None, copy=None
@@ -493,7 +496,10 @@ def __rand__(self, other, /):
493496
r"""Return :math:`\text{value & self}`."""
494497
return dpnp.bitwise_and(other, self)
495498

496-
# '__rdivmod__',
499+
def __rdivmod__(self, other, /):
500+
r"""Return :math:`\text{divmod(value, self)}`."""
501+
return dpnp.divmod(other, self)
502+
497503
# '__reduce__',
498504
# '__reduce_ex__',
499505

@@ -503,7 +509,7 @@ def __repr__(self):
503509

504510
def __rfloordiv__(self, other, /):
505511
r"""Return :math:`\text{value // self}`."""
506-
return dpnp.floor_divide(self, other)
512+
return dpnp.floor_divide(other, self)
507513

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

0 commit comments

Comments
 (0)