Skip to content

Commit 709a537

Browse files
committed
Add support of python built-in function divmod()
1 parent 5d68bf5 commit 709a537

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

209209
# '__deepcopy__',
210210
# '__dir__',
211-
# '__divmod__',
211+
212+
def __divmod__(self, other, /):
213+
r"""Return :math:`\text{divmod(self, value)}`."""
214+
return dpnp.divmod(self, other)
212215

213216
def __dlpack__(
214217
self, /, *, stream=None, max_version=None, dl_device=None, copy=None
@@ -489,7 +492,10 @@ def __rand__(self, other, /):
489492
r"""Return :math:`\text{value & self}`."""
490493
return dpnp.bitwise_and(other, self)
491494

492-
# '__rdivmod__',
495+
def __rdivmod__(self, other, /):
496+
r"""Return :math:`\text{divmod(value, self)}`."""
497+
return dpnp.divmod(other, self)
498+
493499
# '__reduce__',
494500
# '__reduce_ex__',
495501

@@ -499,7 +505,7 @@ def __repr__(self):
499505

500506
def __rfloordiv__(self, other, /):
501507
r"""Return :math:`\text{value // self}`."""
502-
return dpnp.floor_divide(self, other)
508+
return dpnp.floor_divide(other, self)
503509

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

0 commit comments

Comments
 (0)