Skip to content

Commit f519e26

Browse files
Deprecate positional out argument in dpnp.minimum
1 parent 06d3076 commit f519e26

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

dpnp/dpnp_iface_mathematical.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
import builtins
4949
import warnings
50+
from functools import wraps
5051

5152
import dpctl.tensor as dpt
5253
import dpctl.tensor._tensor_elementwise_impl as ti
@@ -3344,14 +3345,31 @@ def interp(x, xp, fp, left=None, right=None, period=None):
33443345
array(-inf)
33453346
"""
33463347

3347-
minimum = DPNPBinaryFunc(
3348+
_minimum_impl = DPNPBinaryFunc(
33483349
"minimum",
33493350
ti._minimum_result_type,
33503351
ti._minimum,
33513352
_MINIMUM_DOCSTRING,
33523353
)
33533354

33543355

3356+
@wraps(_minimum_impl)
3357+
def minimum(*args, **kwargs):
3358+
"""
3359+
Wrapper around `_minimum_impl` that emits a DeprecationWarning
3360+
when `out` is passed positionally.
3361+
3362+
"""
3363+
if len(args) >= 3 and "out" not in kwargs:
3364+
warnings.warn(
3365+
"Positional `out` argument to `dpnp.minimum` is deprecated. "
3366+
"Please use the keyword form, e.g. `dpnp.minimum(a, b, out=c)`.",
3367+
DeprecationWarning,
3368+
stacklevel=2,
3369+
)
3370+
return _minimum_impl(*args, **kwargs)
3371+
3372+
33553373
def modf(x1, **kwargs):
33563374
"""
33573375
Return the fractional and integral parts of an array, element-wise.

0 commit comments

Comments
 (0)