diff --git a/src/nexusformat/nexus/tree.py b/src/nexusformat/nexus/tree.py index 07dc993..00c7e3e 100644 --- a/src/nexusformat/nexus/tree.py +++ b/src/nexusformat/nexus/tree.py @@ -1864,7 +1864,7 @@ def __unicode__(self): def __repr__(self): if (self.dtype is not None and (self.shape == () or self.shape == (1,)) and - (self.dtype.type == np.string_ or self.dtype.type == np.str_ or + (self.dtype.type == np.bytes_ or self.dtype.type == np.str_ or self.dtype == string_dtype)): return f"NXattr('{self}')" else: @@ -1898,7 +1898,7 @@ def nxvalue(self): if self._value is None: return '' elif (self.dtype is not None and - (self.dtype.type == np.string_ or self.dtype.type == np.str_ or + (self.dtype.type == np.bytes_ or self.dtype.type == np.str_ or self.dtype == string_dtype)): if self.shape == (): return text(self._value) @@ -3280,7 +3280,7 @@ def __array__(self, *args, **kwargs): """Cast the NXfield as a NumPy array.""" return np.asarray(self.nxdata, *args, **kwargs) - def __array_wrap__(self, value, context=None): + def __array_wrap__(self, value, context=None, return_scalar=False): """Transform the array resulting from a ufunc to an NXfield.""" return NXfield(value, name=self.nxname) @@ -3721,7 +3721,7 @@ def nxvalue(self): if _value is None: return None elif (self.dtype is not None and - (self.dtype.type == np.string_ or self.dtype.type == np.str_ or + (self.dtype.type == np.bytes_ or self.dtype.type == np.str_ or self.dtype == string_dtype)): if self.shape == (): return text(_value)