forked from zarr-developers/zarr-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblosc.py
More file actions
65 lines (46 loc) · 1.74 KB
/
Copy pathblosc.py
File metadata and controls
65 lines (46 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""
Blosc codec types.
See https://zarr-specs.readthedocs.io/en/latest/v3/codecs/blosc/index.html
"""
from typing import Final, Literal, NotRequired
from typing_extensions import TypedDict
BLOSC_CODEC_NAME: Final = "blosc"
"""The `name` field value of the `blosc` codec."""
BloscCodecName = Literal["blosc"]
"""Literal type of the `name` field of the `blosc` codec."""
BloscShuffle = Literal["noshuffle", "shuffle", "bitshuffle"]
"""Literal type of blosc shuffle mode names."""
BLOSC_SHUFFLE: Final = ("noshuffle", "shuffle", "bitshuffle")
"""Tuple of permitted values for the `shuffle` field of the `blosc` codec."""
BloscCName = Literal["lz4", "lz4hc", "blosclz", "snappy", "zlib", "zstd"]
"""Literal type of blosc compressor identifiers."""
BLOSC_CNAME: Final = ("lz4", "lz4hc", "blosclz", "snappy", "zlib", "zstd")
"""Tuple of permitted values for the `cname` field of the `blosc` codec."""
class BloscCodecConfiguration(TypedDict):
"""Configuration for the Zarr v3 `blosc` codec."""
cname: BloscCName
clevel: int
shuffle: BloscShuffle
blocksize: int
typesize: NotRequired[int]
class BloscCodecObject(TypedDict):
"""`blosc` codec metadata in object form."""
name: BloscCodecName
configuration: BloscCodecConfiguration
BloscCodecMetadata = BloscCodecObject
"""Permitted JSON shape for `blosc` codec metadata.
The configuration has multiple required keys (`cname`, `clevel`, `shuffle`,
`blocksize`), so only the object form is valid; the short-hand-name form
is not permitted by the spec for this codec.
"""
__all__ = [
"BLOSC_CNAME",
"BLOSC_CODEC_NAME",
"BLOSC_SHUFFLE",
"BloscCName",
"BloscCodecConfiguration",
"BloscCodecMetadata",
"BloscCodecName",
"BloscCodecObject",
"BloscShuffle",
]