Skip to content

Commit 75a267b

Browse files
committed
fix mypy
1 parent 276bdf3 commit 75a267b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/zarr/core/buffer/core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,13 +428,15 @@ def as_scalar(self) -> ScalarType:
428428
if self._data.size != 1:
429429
raise ValueError("Buffer does not contain a single scalar value")
430430
item = self.as_numpy_array().item()
431+
scalar: ScalarType
431432

432433
if np.issubdtype(self.dtype, np.datetime64):
433434
unit: str = np.datetime_data(self.dtype)[0] # Extract the unit (e.g., 'Y', 'D', etc.)
434-
return np.datetime64(item, unit)
435+
scalar = np.datetime64(item, unit)
435436
else:
436-
return self.dtype.type(item) # Regular conversion for non-datetime types
437+
scalar = self.dtype.type(item) # Regular conversion for non-datetime types
437438

439+
return scalar
438440

439441
@property
440442
def dtype(self) -> np.dtype[Any]:

0 commit comments

Comments
 (0)