Skip to content

Commit a483153

Browse files
committed
fix crc32c json decoding
1 parent 7a47ef7 commit a483153

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/zarr/codecs/crc32c_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Crc32cJSON_V2(Crc32cConfig_V2):
3131
id: ReadOnly[Literal["crc32c"]]
3232

3333

34-
class Crc32cJSON_V3(NamedConfig[Literal["crc32c"], Crc32cConfig_V3]): ...
34+
Crc32cJSON_V3 = NamedConfig[Literal["crc32c"], Crc32cConfig_V3] | Literal["crc32c"]
3535

3636

3737
def check_json_v2(data: object) -> TypeGuard[Crc32cJSON_V2]:

src/zarr/codecs/numcodecs/crc32c.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ def _from_json_v2(cls, data: CodecJSON_V2) -> Self:
7777
@classmethod
7878
def _from_json_v3(cls, data: CodecJSON_V3) -> Self:
7979
if check_json_v3(data):
80+
if data == "crc32c":
81+
return cls()
8082
config = data.get("configuration", {})
8183
return cls(**config)
8284
raise TypeError(f"Invalid JSON: {data}")

0 commit comments

Comments
 (0)