File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change
1
+ Avoid an unnecessary memory copy when writing Zarr to a local file
Original file line number Diff line number Diff line change @@ -51,15 +51,17 @@ def _put(
51
51
if start is not None :
52
52
with path .open ("r+b" ) as f :
53
53
f .seek (start )
54
- f .write (value .as_numpy_array ().tobytes ())
54
+ # write takes any object supporting the buffer protocol
55
+ f .write (value .as_numpy_array ()) # type: ignore[arg-type]
55
56
return None
56
57
else :
57
- view = memoryview (value .as_numpy_array (). tobytes ())
58
+ view = memoryview (value .as_numpy_array ()) # type: ignore[arg-type]
58
59
if exclusive :
59
60
mode = "xb"
60
61
else :
61
62
mode = "wb"
62
63
with path .open (mode = mode ) as f :
64
+ # write takes any object supporting the buffer protocol
63
65
return f .write (view )
64
66
65
67
You can’t perform that action at this time.
0 commit comments