Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix deprecation warning with __array__'s copy keyword for Numpy>2 (#132)
  • Loading branch information
olivhoenen authored Jun 15, 2026
commit 7789093e5d72f254137981216894c6f8b6111348
6 changes: 3 additions & 3 deletions imas/ids_primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class IDSNumeric0D(IDSPrimitive):
__doc__ = IDSDoc(__doc__)
__slots__ = ()

def __array__(self, dtype=None):
def __array__(self, dtype=None, copy=None):
return np.array(self.value, dtype=dtype)

def __str__(self):
Expand Down Expand Up @@ -437,8 +437,8 @@ class IDSNumericArray(IDSPrimitive, np.lib.mixins.NDArrayOperatorsMixin):
# list, to support operations like np.add(array_like, list)
_HANDLED_TYPES = (np.ndarray, Number)

def __array__(self, dtype=None):
return self.value.astype(dtype, copy=False)
def __array__(self, dtype=None, copy=None):
return self.value.astype(dtype, copy=bool(copy))

def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
out = kwargs.get("out", ())
Expand Down
Loading