Skip to content

Commit

Permalink
Checking that the store is an instance of dict seem incorrect.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Carreau committed Oct 22, 2020
1 parent 480d21a commit c7e6ce3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion zarr/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import operator
import re
from functools import reduce
from collections.abc import MutableMapping

import numpy as np
from numcodecs.compat import ensure_bytes, ensure_ndarray
Expand Down Expand Up @@ -1821,7 +1822,7 @@ def _encode_chunk(self, chunk):
cdata = chunk

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

return cdata
Expand Down
2 changes: 1 addition & 1 deletion zarr/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def getsize(store, path: Path = None) -> int:
if hasattr(store, 'getsize'):
# pass through
return store.getsize(path)
elif isinstance(store, dict):
elif isinstance(store, MutableMapping):
# compute from size of values
if path in store:
v = store[path]
Expand Down

0 comments on commit c7e6ce3

Please sign in to comment.