File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 31
31
# Package dependencies
32
32
- packaging
33
33
- donfig
34
- - numcodecs[crc32c]
34
+ - numcodecs
35
+ - google-crc32c>=1.5
35
36
- numpy==2.1 # until https://github.com/numpy/numpy/issues/28034 is resolved
36
37
- typing_extensions
37
38
- universal-pathlib
Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ requires-python = ">=3.11"
34
34
dependencies = [
35
35
' packaging>=22.0' ,
36
36
' numpy>=1.26' ,
37
- ' numcodecs[crc32c]>=0.14' ,
37
+ ' numcodecs>=0.14' ,
38
+ ' google-crc32c>=1.5' ,
38
39
' typing_extensions>=4.9' ,
39
40
' donfig>=0.8' ,
40
41
]
Original file line number Diff line number Diff line change 3
3
from dataclasses import dataclass
4
4
from typing import TYPE_CHECKING , cast
5
5
6
+ import google_crc32c
6
7
import numpy as np
7
8
import typing_extensions
8
- from crc32c import crc32c
9
9
10
10
from zarr .abc .codec import BytesBytesCodec
11
11
from zarr .core .common import JSON , parse_named_configuration
@@ -42,7 +42,7 @@ async def _decode_single(
42
42
43
43
# Need to do a manual cast until https://github.com/numpy/numpy/issues/26783 is resolved
44
44
computed_checksum = np .uint32 (
45
- crc32c (cast ("typing_extensions.Buffer" , inner_bytes ))
45
+ google_crc32c . value (cast ("typing_extensions.Buffer" , inner_bytes ))
46
46
).tobytes ()
47
47
stored_checksum = bytes (crc32_bytes )
48
48
if computed_checksum != stored_checksum :
@@ -58,7 +58,9 @@ async def _encode_single(
58
58
) -> Buffer | None :
59
59
data = chunk_bytes .as_numpy_array ()
60
60
# Calculate the checksum and "cast" it to a numpy array
61
- checksum = np .array ([crc32c (cast ("typing_extensions.Buffer" , data ))], dtype = np .uint32 )
61
+ checksum = np .array (
62
+ [google_crc32c .value (cast ("typing_extensions.Buffer" , data ))], dtype = np .uint32
63
+ )
62
64
# Append the checksum (as bytes) to the data
63
65
return chunk_spec .prototype .buffer .from_array_like (np .append (data , checksum .view ("B" )))
64
66
You can’t perform that action at this time.
0 commit comments