diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 0bcb45a5c4..4f6e96b64f 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -802,7 +802,7 @@ Here is an example using S3Map to read an array created previously:: array([b'H', b'e', b'l', b'l', b'o', b' ', b'f', b'r', b'o', b'm', b' ', b't', b'h', b'e', b' ', b'c', b'l', b'o', b'u', b'd', b'!'], dtype='|S1') - >>> z[:].tostring() + >>> z[:].tobytes() b'Hello from the cloud!' Zarr now also has a builtin storage backend for Azure Blob Storage. @@ -841,11 +841,11 @@ store. E.g.:: >>> z = root['foo/bar/baz'] >>> from timeit import timeit >>> # first data access is relatively slow, retrieved from store - ... timeit('print(z[:].tostring())', number=1, globals=globals()) # doctest: +SKIP + ... timeit('print(z[:].tobytes())', number=1, globals=globals()) # doctest: +SKIP b'Hello from the cloud!' 0.1081731989979744 >>> # second data access is faster, uses cache - ... timeit('print(z[:].tostring())', number=1, globals=globals()) # doctest: +SKIP + ... timeit('print(z[:].tobytes())', number=1, globals=globals()) # doctest: +SKIP b'Hello from the cloud!' 0.0009490990014455747 diff --git a/zarr/core.py b/zarr/core.py index f8e5834070..e69895cc8d 100644 --- a/zarr/core.py +++ b/zarr/core.py @@ -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 @@ -1955,7 +1956,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 diff --git a/zarr/storage.py b/zarr/storage.py index 19949cd8a5..6b5b486836 100644 --- a/zarr/storage.py +++ b/zarr/storage.py @@ -1973,11 +1973,11 @@ class LRUStoreCache(MutableMapping): >>> z = root['foo/bar/baz'] # doctest: +REMOTE_DATA >>> from timeit import timeit >>> # first data access is relatively slow, retrieved from store - ... timeit('print(z[:].tostring())', number=1, globals=globals()) # doctest: +SKIP + ... timeit('print(z[:].tobytes())', number=1, globals=globals()) # doctest: +SKIP b'Hello from the cloud!' 0.1081731989979744 >>> # second data access is faster, uses cache - ... timeit('print(z[:].tostring())', number=1, globals=globals()) # doctest: +SKIP + ... timeit('print(z[:].tobytes())', number=1, globals=globals()) # doctest: +SKIP b'Hello from the cloud!' 0.0009490990014455747