Skip to content

Commit 9118056

Browse files
committed
fixup
1 parent d96c202 commit 9118056

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/zarr/core/array.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,12 @@ def info(self) -> ArrayInfo:
12191219

12201220
async def info_complete(self) -> ArrayInfo:
12211221
# TODO: get the size of the object from the store.
1222+
extra = {
1223+
"count_chunks_initialized": self.nchunks_initialized, # this should be async?
1224+
# count_bytes_stored isn't yet implemented.
1225+
}
1226+
return self._info(extra=extra)
1227+
12221228
raise NotImplementedError
12231229

12241230
def _info(self, extra: dict[str, int] | None = None) -> ArrayInfo:
@@ -1239,15 +1245,17 @@ def _info(self, extra: dict[str, int] | None = None) -> ArrayInfo:
12391245
if isinstance(chunk_grid, RegularChunkGrid):
12401246
kwargs["chunk_shape"] = chunk_grid.chunk_shape
12411247
else:
1242-
msg = f"'info' is not yet implemented for chunk grids of type {type(self.metadata.chunk_grid)}"
1243-
raise NotImplementedError(msg)
1248+
raise NotImplementedError(
1249+
"'info' is not yet implemented for chunk grids of type {type(self.metadata.chunk_grid)}"
1250+
)
12441251

12451252
return ArrayInfo(
12461253
zarr_format=self.metadata.zarr_format,
12471254
shape=self.shape,
12481255
order=self.order,
12491256
read_only=self.store_path.store.mode.readonly,
12501257
store_type=type(self.store_path.store).__name__,
1258+
count_bytes=self.dtype.itemsize * self.size,
12511259
**kwargs,
12521260
)
12531261

tests/test_array.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ def test_info_v2(self) -> None:
435435
order="C",
436436
read_only=False,
437437
store_type="MemoryStore",
438+
count_bytes=128,
438439
)
439440
assert result == expected
440441

@@ -450,6 +451,7 @@ def test_info_v3(self) -> None:
450451
read_only=False,
451452
store_type="MemoryStore",
452453
codecs="[BytesCodec(endian=<Endian.little: 'little'>)]",
454+
count_bytes=128,
453455
)
454456
assert result == expected
455457

0 commit comments

Comments
 (0)