Skip to content

Commit 81c4b7e

Browse files
committed
revert buffer chnages
1 parent 7231d7c commit 81c4b7e

File tree

19 files changed

+17
-54
lines changed

19 files changed

+17
-54
lines changed

docs/guide/storage.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,5 @@ Zarr-Python :class:`zarr.abc.store.Store` API is meant to be extended. The Store
9797
Class includes all of the methods needed to be a fully operational store in Zarr Python.
9898
Zarr also provides a test harness for custom stores: :class:`zarr.testing.store.StoreTests`.
9999

100-
``Store.get``
101-
~~~~~~~~~~~~~
102-
103-
The ``prototype`` keyword of :func:`zarr.abc.store.Store.get` uses a default of
104-
``None``. When given ``None``, implementations should use
105-
:func:`zarr.buffer.default_buffer_prototype` to look up the prototype users have
106-
configured.
107-
108100
.. _Zip Store Specification: https://github.com/zarr-developers/zarr-specs/pull/311
109101
.. _Fsspec: https://zarr-specs.readthedocs.io/en/latest/v3/core/v3.0.html#consolidated-metadata

src/zarr/abc/store.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,17 +201,14 @@ def __eq__(self, value: object) -> bool:
201201
async def get(
202202
self,
203203
key: str,
204-
prototype: BufferPrototype | None = None,
204+
prototype: BufferPrototype,
205205
byte_range: ByteRangeRequest | None = None,
206206
) -> Buffer | None:
207207
"""Retrieve the value associated with a given key.
208208
209209
Parameters
210210
----------
211211
key : str
212-
prototype : BufferPrototype, optional
213-
The prototype giving the buffer classes to use for buffers and nbuffers.
214-
By default, :func:`zarr.buffer.default_buffer_prototype` is used.
215212
byte_range : tuple[int | None, int | None], optional
216213
217214
Returns

src/zarr/buffer.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/zarr/storage/logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def __eq__(self, other: object) -> bool:
159159
async def get(
160160
self,
161161
key: str,
162-
prototype: BufferPrototype | None = None,
162+
prototype: BufferPrototype,
163163
byte_range: tuple[int | None, int | None] | None = None,
164164
) -> Buffer | None:
165165
# docstring inherited

src/zarr/storage/memory.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from zarr.abc.store import ByteRangeRequest, Store
77
from zarr.core.buffer import Buffer, gpu
8-
from zarr.core.buffer.core import default_buffer_prototype
98
from zarr.core.common import concurrent_map
109
from zarr.storage._utils import _normalize_interval_index
1110

@@ -84,12 +83,10 @@ def __eq__(self, other: object) -> bool:
8483
async def get(
8584
self,
8685
key: str,
87-
prototype: BufferPrototype | None = None,
86+
prototype: BufferPrototype,
8887
byte_range: tuple[int | None, int | None] | None = None,
8988
) -> Buffer | None:
9089
# docstring inherited
91-
if prototype is None:
92-
prototype = default_buffer_prototype()
9390
if not self._is_open:
9491
await self._open()
9592
assert isinstance(key, str)

src/zarr/storage/remote.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from typing import TYPE_CHECKING, Any, Self
55

66
from zarr.abc.store import ByteRangeRequest, Store
7-
from zarr.core.buffer.core import default_buffer_prototype
87
from zarr.storage.common import _dereference_path
98

109
if TYPE_CHECKING:
@@ -218,12 +217,10 @@ def __eq__(self, other: object) -> bool:
218217
async def get(
219218
self,
220219
key: str,
221-
prototype: BufferPrototype | None = None,
220+
prototype: BufferPrototype,
222221
byte_range: ByteRangeRequest | None = None,
223222
) -> Buffer | None:
224223
# docstring inherited
225-
if prototype is None:
226-
prototype = default_buffer_prototype()
227224
if not self._is_open:
228225
await self._open()
229226
path = _dereference_path(self.path, key)

src/zarr/storage/zip.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from zarr.abc.store import ByteRangeRequest, Store
1111
from zarr.core.buffer import Buffer, BufferPrototype
12-
from zarr.core.buffer.core import default_buffer_prototype
1312

1413
if TYPE_CHECKING:
1514
from collections.abc import AsyncGenerator, Iterable
@@ -167,13 +166,11 @@ def _get(
167166
async def get(
168167
self,
169168
key: str,
170-
prototype: BufferPrototype | None = None,
169+
prototype: BufferPrototype,
171170
byte_range: ByteRangeRequest | None = None,
172171
) -> Buffer | None:
173172
# docstring inherited
174173
assert isinstance(key, str)
175-
if prototype is None:
176-
prototype = default_buffer_prototype()
177174

178175
with self._lock:
179176
return self._get(key, prototype=prototype, byte_range=byte_range)

src/zarr/testing/store.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,6 @@ async def test_get(
121121
expected = data_buf[start : start + length]
122122
assert_bytes_equal(observed, expected)
123123

124-
async def test_get_default_prototype(self, store: S) -> None:
125-
key = "c/0"
126-
data = b"\x01\x02\x03\x04"
127-
data_buf = self.buffer_cls.from_bytes(data)
128-
await self.set(store, key, data_buf)
129-
observed = await store.get(key)
130-
expected = data_buf[:]
131-
assert_bytes_equal(observed, expected)
132-
133124
async def test_get_many(self, store: S) -> None:
134125
"""
135126
Ensure that multiple keys can be retrieved at once with the _get_many method.

tests/test_codecs/test_blosc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
from zarr import AsyncArray
77
from zarr.abc.store import Store
8-
from zarr.buffer import default_buffer_prototype
98
from zarr.codecs import BloscCodec, BytesCodec, ShardingCodec
9+
from zarr.core.buffer import default_buffer_prototype
1010
from zarr.storage.common import StorePath
1111

1212

tests/test_codecs/test_codecs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
import pytest
99

1010
from zarr import Array, AsyncArray, config
11-
from zarr.buffer import default_buffer_prototype
1211
from zarr.codecs import (
1312
BytesCodec,
1413
GzipCodec,
1514
ShardingCodec,
1615
TransposeCodec,
1716
)
17+
from zarr.core.buffer import default_buffer_prototype
1818
from zarr.core.indexing import Selection, morton_order_iter
1919
from zarr.storage import StorePath
2020

0 commit comments

Comments
 (0)