We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 276bdf3 commit 75a267bCopy full SHA for 75a267b
src/zarr/core/buffer/core.py
@@ -428,13 +428,15 @@ def as_scalar(self) -> ScalarType:
428
if self._data.size != 1:
429
raise ValueError("Buffer does not contain a single scalar value")
430
item = self.as_numpy_array().item()
431
+ scalar: ScalarType
432
433
if np.issubdtype(self.dtype, np.datetime64):
434
unit: str = np.datetime_data(self.dtype)[0] # Extract the unit (e.g., 'Y', 'D', etc.)
- return np.datetime64(item, unit)
435
+ scalar = np.datetime64(item, unit)
436
else:
- return self.dtype.type(item) # Regular conversion for non-datetime types
437
+ scalar = self.dtype.type(item) # Regular conversion for non-datetime types
438
439
+ return scalar
440
441
@property
442
def dtype(self) -> np.dtype[Any]:
0 commit comments