Skip to content

Commit 884150e

Browse files
committed
set default typesize=None
1 parent eeebe24 commit 884150e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

zarrita/codecs.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,14 @@ def from_metadata(
268268
cls, codec_metadata: BloscCodecMetadata, array_metadata: CoreArrayMetadata
269269
) -> BloscCodec:
270270
configuration = codec_metadata.configuration
271-
if configuration.typesize == 0:
271+
if configuration.typesize is None:
272272
configuration = evolve(
273273
configuration, typesize=array_metadata.data_type.byte_count
274274
)
275+
276+
# Prepare config_dict for the numcodecs.blosc.Blosc constructor
275277
config_dict = asdict(codec_metadata.configuration)
276-
config_dict.pop("typesize", None)
278+
config_dict.pop("typesize")
277279
map_shuffle_str_to_int = {"noshuffle": 0, "shuffle": 1, "bitshuffle": 2}
278280
config_dict["shuffle"] = map_shuffle_str_to_int[config_dict["shuffle"]]
279281
return cls(
@@ -545,7 +547,7 @@ def compute_encoded_size(self, input_byte_length: int) -> int:
545547

546548

547549
def blosc_codec(
548-
typesize: int = 0,
550+
typesize: int | None = None,
549551
cname: Literal["lz4", "lz4hc", "blosclz", "zstd", "snappy", "zlib"] = "zstd",
550552
clevel: int = 5,
551553
shuffle: Literal["noshuffle", "shuffle", "bitshuffle"] = "noshuffle",

zarrita/metadata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def encode_chunk_key(self, chunk_coords: ChunkCoords) -> str:
149149

150150
@frozen
151151
class BloscCodecConfigurationMetadata:
152-
typesize: int = 0
152+
typesize: int | None = None
153153
cname: Literal["lz4", "lz4hc", "blosclz", "zstd", "snappy", "zlib"] = "zstd"
154154
clevel: int = 5
155155
shuffle: BloscShuffle = "noshuffle"

0 commit comments

Comments
 (0)