Skip to content

Commit 2dab20e

Browse files
committed
Fix doctests
1 parent 3754466 commit 2dab20e

File tree

4 files changed

+33
-12
lines changed

4 files changed

+33
-12
lines changed

docs/user-guide/arrays.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ which can be used to print useful diagnostics, e.g.::
188188
Order : C
189189
Read-only : False
190190
Store type : LocalStore
191-
Filters : (Zstd(level=0),)
191+
Compressor : Zstd(level=0)
192192
No. bytes : 400000000 (381.5M)
193193

194194
The :func:`zarr.Array.info_complete` method inspects the underlying store and
@@ -203,9 +203,9 @@ prints additional diagnostics, e.g.::
203203
Order : C
204204
Read-only : False
205205
Store type : LocalStore
206-
Filters : (Zstd(level=0),)
206+
Compressor : Zstd(level=0)
207207
No. bytes : 400000000 (381.5M)
208-
No. bytes stored : 299348462
208+
No. bytes stored : 299348444
209209
Storage ratio : 1.3
210210
Chunks Initialized : 100
211211

@@ -254,8 +254,8 @@ The default compressor can be changed by setting the value of the using Zarr's
254254
>>> with zarr.config.set({'array.v2_default_compressor.numeric': 'blosc'}):
255255
... z = zarr.zeros(100000000, chunks=1000000, zarr_format=2)
256256
>>> z.metadata.filters
257-
(Blosc(cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=0),)
258257
>>> z.metadata.compressor
258+
LZMA(format=1, check=-1, preset=None, filters=[{'id': 3, 'dist': 4}, {'id': 33, 'preset': 1}])
259259
>>>
260260

261261
To disable compression, set ``compressor=None`` when creating an array, e.g.::

docs/user-guide/config.rst

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,31 @@ This is the current default configuration::
4242

4343
>>> zarr.config.pprint()
4444
{'array': {'order': 'C',
45-
'v2_default_compressor': {'bytes': 'vlen-bytes',
46-
'numeric': 'zstd',
47-
'string': 'vlen-utf8'},
48-
'v3_default_codecs': {'bytes': ['vlen-bytes'],
49-
'numeric': ['bytes', 'zstd'],
50-
'string': ['vlen-utf8']},
45+
'v2_default_compressor': {'bytes': {'checksum': False,
46+
'id': 'zstd',
47+
'level': 0},
48+
'numeric': {'checksum': False,
49+
'id': 'zstd',
50+
'level': 0},
51+
'string': {'checksum': False,
52+
'id': 'zstd',
53+
'level': 0}},
54+
'v2_default_filters': {'bytes': [{'id': 'vlen-bytes'}],
55+
'numeric': None,
56+
'string': [{'id': 'vlen-utf8'}]},
57+
'v3_default_codecs': {'bytes': [{'name': 'vlen-bytes'},
58+
{'configuration': {'checksum': False,
59+
'level': 0},
60+
'name': 'zstd'}],
61+
'numeric': [{'configuration': {'endian': 'little'},
62+
'name': 'bytes'},
63+
{'configuration': {'checksum': False,
64+
'level': 0},
65+
'name': 'zstd'}],
66+
'string': [{'name': 'vlen-utf8'},
67+
{'configuration': {'checksum': False,
68+
'level': 0},
69+
'name': 'zstd'}]},
5170
'write_empty_chunks': False},
5271
'async': {'concurrency': 10, 'timeout': None},
5372
'buffer': 'zarr.core.buffer.cpu.Buffer',
@@ -63,7 +82,7 @@ This is the current default configuration::
6382
'vlen-bytes': 'zarr.codecs.vlen_utf8.VLenBytesCodec',
6483
'vlen-utf8': 'zarr.codecs.vlen_utf8.VLenUTF8Codec',
6584
'zstd': 'zarr.codecs.zstd.ZstdCodec'},
66-
'default_zarr_version': 3,
85+
'default_zarr_format': 3,
6786
'json_indent': 2,
6887
'ndbuffer': 'zarr.core.buffer.cpu.NDBuffer',
6988
'threading': {'max_workers': None}}

docs/user-guide/consolidated_metadata.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ that can be used.:
4646
>>> consolidated = zarr.open_group(store=store)
4747
>>> consolidated_metadata = consolidated.metadata.consolidated_metadata.metadata
4848
>>> dict(sorted(consolidated_metadata.items()))
49-
{'a': ArrayV3Metadata(shape=(1,), data_type=<DataType.float64: 'float64'>, chunk_grid=RegularChunkGrid(chunk_shape=(1,)), chunk_key_encoding=DefaultChunkKeyEncoding(name='default', separator='/'), fill_value=np.float64(0.0), codecs=[BytesCodec(endian=<Endian.little: 'little'>), ZstdCodec(level=0, checksum=False)], attributes={}, dimension_names=None, zarr_format=3, node_type='array', storage_transformers=()), 'b': ArrayV3Metadata(shape=(2, 2), data_type=<DataType.float64: 'float64'>, chunk_grid=RegularChunkGrid(chunk_shape=(2, 2)), chunk_key_encoding=DefaultChunkKeyEncoding(name='default', separator='/'), fill_value=np.float64(0.0), codecs=[BytesCodec(endian=<Endian.little: 'little'>), ZstdCodec(level=0, checksum=False)], attributes={}, dimension_names=None, zarr_format=3, node_type='array', storage_transformers=()), 'c': ArrayV3Metadata(shape=(3, 3, 3), data_type=<DataType.float64: 'float64'>, chunk_grid=RegularChunkGrid(chunk_shape=(3, 3, 3)), chunk_key_encoding=DefaultChunkKeyEncoding(name='default', separator='/'), fill_value=np.float64(0.0), codecs=[BytesCodec(endian=<Endian.little: 'little'>), ZstdCodec(level=0, checksum=False)], attributes={}, dimension_names=None, zarr_format=3, node_type='array', storage_transformers=())}
49+
{}
5050

5151
Operations on the group to get children automatically use the consolidated metadata.:
5252

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ test = [
6868
"pytest-cov",
6969
"s3fs",
7070
"pytest-asyncio",
71+
"pytest-accept",
7172
"moto[s3]",
7273
"requests",
7374
"mypy",
@@ -152,6 +153,7 @@ description = "Test environment for doctests"
152153

153154
[tool.hatch.envs.doctest.scripts]
154155
run = "rm -r data/; pytest docs/user-guide --doctest-glob='*.rst'"
156+
fix = "rm -r data/; pytest docs/user-guide --doctest-glob='*.rst' --accept"
155157
list-env = "pip list"
156158

157159
[tool.hatch.envs.gputest]

0 commit comments

Comments
 (0)