Skip to content

Commit e46044d

Browse files
rcomermeeseeksmachine
authored andcommitted
Backport PR #28441: MNT: Update basic units example to work with numpy 2.0
1 parent af4bebb commit e46044d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

galleries/examples/units/basic_units.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ def __getattribute__(self, name):
146146
return getattr(variable, name)
147147
return object.__getattribute__(self, name)
148148

149-
def __array__(self, dtype=object):
149+
def __array__(self, dtype=object, copy=False):
150150
return np.asarray(self.value, dtype)
151151

152-
def __array_wrap__(self, array, context):
152+
def __array_wrap__(self, array, context=None, return_scalar=False):
153153
return TaggedValue(array, self.unit)
154154

155155
def __repr__(self):
@@ -222,10 +222,10 @@ def __mul__(self, rhs):
222222
def __rmul__(self, lhs):
223223
return self*lhs
224224

225-
def __array_wrap__(self, array, context):
225+
def __array_wrap__(self, array, context=None, return_scalar=False):
226226
return TaggedValue(array, self)
227227

228-
def __array__(self, t=None, context=None):
228+
def __array__(self, t=None, context=None, copy=False):
229229
ret = np.array(1)
230230
if t is not None:
231231
return ret.astype(t)

0 commit comments

Comments
 (0)