Skip to content

Commit c7e6ce3

Browse files
committed
Checking that the store is an instance of dict seem incorrect.
Indeed MemoryStore is an instance of mutable mapping that have the same property as dict, but woudl not be seen as as instance of dict.
1 parent 480d21a commit c7e6ce3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

zarr/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import operator
66
import re
77
from functools import reduce
8+
from collections.abc import MutableMapping
89

910
import numpy as np
1011
from numcodecs.compat import ensure_bytes, ensure_ndarray
@@ -1821,7 +1822,7 @@ def _encode_chunk(self, chunk):
18211822
cdata = chunk
18221823

18231824
# ensure in-memory data is immutable and easy to compare
1824-
if isinstance(self.chunk_store, dict):
1825+
if isinstance(self.chunk_store, MutableMapping):
18251826
cdata = ensure_bytes(cdata)
18261827

18271828
return cdata

zarr/storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def getsize(store, path: Path = None) -> int:
176176
if hasattr(store, 'getsize'):
177177
# pass through
178178
return store.getsize(path)
179-
elif isinstance(store, dict):
179+
elif isinstance(store, MutableMapping):
180180
# compute from size of values
181181
if path in store:
182182
v = store[path]

0 commit comments

Comments
 (0)