Skip to content

Commit 18971b5

Browse files
authored
Merge branch 'master' into default-write-empty-chunks-false
2 parents 1f21139 + e15001b commit 18971b5

File tree

8 files changed

+25
-11
lines changed

8 files changed

+25
-11
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
ports:
3333
- 6379:6379
3434
mongodb:
35-
image: mongo:3.4.23
35+
image: mongo:4.4.11
3636
ports:
3737
- 27017:27017
3838
steps:

requirements_dev_minimal.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# library requirements
22
asciitree==0.3.3
3-
fasteners==0.16.3
3+
fasteners==0.17.3
44
numcodecs==0.9.1
55
msgpack-python==0.5.6
6-
setuptools-scm==6.3.2
6+
setuptools-scm==6.4.2
77
# test requirements
88
pytest==6.2.5

requirements_dev_numpy.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Break this out into a separate file to allow testing against
22
# different versions of numpy. This file should pin to the latest
33
# numpy version.
4-
numpy==1.22.0
4+
numpy==1.22.1

requirements_dev_optional.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ ipytree==0.2.1
77
# don't let pyup change pinning for azure-storage-blob, need to pin to older
88
# version to get compatibility with azure storage emulator on appveyor (FIXME)
99
azure-storage-blob==12.8.1 # pyup: ignore
10-
redis==4.1.0
10+
redis==4.1.1
1111
types-redis
1212
types-setuptools
13-
pymongo==3.12.1
13+
pymongo==4.0.1
1414
# optional test requirements
1515
tox==3.24.5
1616
coverage
1717
flake8==4.0.1
1818
pytest-cov==3.0.0
1919
pytest-doctestplus==0.11.2
20-
pytest-timeout==2.0.2
20+
pytest-timeout==2.1.0
2121
h5py==3.6.0
22-
fsspec==2021.11.1
23-
s3fs==2021.11.1
22+
fsspec==2022.1.0
23+
s3fs==2022.1.0
2424
moto[server]>=1.3.14

zarr/convenience.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ def consolidate_metadata(store: StoreLike, metadata_key=".zmetadata"):
11171117
open_consolidated
11181118
11191119
"""
1120-
store = normalize_store_arg(store)
1120+
store = normalize_store_arg(store, clobber=True)
11211121

11221122
def is_zarr_key(key):
11231123
return (key.endswith('.zarray') or key.endswith('.zgroup') or

zarr/creation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ def create(shape, chunks=True, dtype=None, compressor='default',
6969
A codec to encode object arrays, only needed if dtype=object.
7070
dimension_separator : {'.', '/'}, optional
7171
Separator placed between the dimensions of a chunk.
72+
7273
.. versionadded:: 2.8
74+
7375
write_empty_chunks : bool, optional
7476
If True, all chunks will be stored regardless of their contents. If
7577
False (default), each chunk is compared to the array's fill value prior

zarr/storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,7 @@ def __getitem__(self, key):
15511551
def __setitem__(self, key, value):
15521552
if self.mode == 'r':
15531553
raise ReadOnlyError()
1554-
value = ensure_contiguous_ndarray(value)
1554+
value = ensure_contiguous_ndarray(value).view("u1")
15551555
with self.mutex:
15561556
# writestr(key, value) writes with default permissions from
15571557
# zipfile (600) that are too restrictive, build ZipInfo for

zarr/tests/test_storage.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import zarr
2121
from zarr.codecs import BZ2, AsType, Blosc, Zlib
22+
from zarr.convenience import consolidate_metadata
2223
from zarr.errors import MetadataError
2324
from zarr.hierarchy import group
2425
from zarr.meta import ZARR_FORMAT, decode_array_metadata
@@ -1009,6 +1010,10 @@ def test_create(self):
10091010
assert "data" in os.listdir(path1)
10101011
assert ".zgroup" in os.listdir(path1)
10111012

1013+
# consolidated metadata (GH#915)
1014+
consolidate_metadata("file://" + path1)
1015+
assert ".zmetadata" in os.listdir(path1)
1016+
10121017
g = zarr.open_group("simplecache::file://" + path1, mode='r',
10131018
storage_options={"cache_storage": path2,
10141019
"same_names": True})
@@ -1549,6 +1554,13 @@ def test_permissions(self):
15491554
assert perm == '0o40775'
15501555
z.close()
15511556

1557+
def test_store_and_retrieve_ndarray(self):
1558+
store = ZipStore('data/store.zip')
1559+
x = np.array([[1, 2], [3, 4]])
1560+
store['foo'] = x
1561+
y = np.frombuffer(store['foo'], dtype=x.dtype).reshape(x.shape)
1562+
assert np.array_equiv(y, x)
1563+
15521564

15531565
class TestDBMStore(StoreTests):
15541566

0 commit comments

Comments
 (0)