Skip to content

Commit 6b9de9d

Browse files
committed
implement default on store abc
1 parent b110768 commit 6b9de9d

File tree

7 files changed

+3
-33
lines changed

7 files changed

+3
-33
lines changed

src/zarr/abc/store.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from typing import TYPE_CHECKING, Literal, Protocol, runtime_checkable
99

1010
from zarr.core.buffer import Buffer, BufferPrototype
11+
from zarr.core.buffer.core import default_buffer_prototype
1112
from zarr.core.sync import sync
1213

1314
if TYPE_CHECKING:
@@ -184,12 +185,11 @@ def __eq__(self, value: object) -> bool:
184185
"""Equality comparison."""
185186
...
186187

187-
@abstractmethod
188188
def _get_default_buffer_class(self) -> type[Buffer]:
189189
"""
190-
Get the default buffer class for this store.
190+
Get the default buffer class.
191191
"""
192-
...
192+
return default_buffer_prototype().buffer
193193

194194
@abstractmethod
195195
async def get(

src/zarr/storage/_fsspec.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
SuffixByteRequest,
1717
)
1818
from zarr.core.buffer import Buffer, BufferPrototype
19-
from zarr.core.buffer.core import default_buffer_prototype
2019
from zarr.errors import ZarrUserWarning
2120
from zarr.storage._common import _dereference_path
2221

@@ -273,10 +272,6 @@ def __eq__(self, other: object) -> bool:
273272
and self.fs == other.fs
274273
)
275274

276-
def _get_default_buffer_class(self) -> type[Buffer]:
277-
# docstring inherited
278-
return default_buffer_prototype().buffer
279-
280275
async def get(
281276
self,
282277
key: str,

src/zarr/storage/_local.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
SuffixByteRequest,
2020
)
2121
from zarr.core.buffer import Buffer, BufferPrototype
22-
from zarr.core.buffer.core import default_buffer_prototype
2322
from zarr.core.common import AccessModeLiteral, concurrent_map
2423

2524
if TYPE_CHECKING:
@@ -192,10 +191,6 @@ def __repr__(self) -> str:
192191
def __eq__(self, other: object) -> bool:
193192
return isinstance(other, type(self)) and self.root == other.root
194193

195-
def _get_default_buffer_class(self) -> type[Buffer]:
196-
# docstring inherited
197-
return default_buffer_prototype().buffer
198-
199194
async def get(
200195
self,
201196
key: str,

src/zarr/storage/_memory.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from zarr.abc.store import BufferLike, ByteRequest, Store
77
from zarr.core.buffer import Buffer, BufferPrototype, 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_byte_range_index
1110

@@ -58,10 +57,6 @@ def with_read_only(self, read_only: bool = False) -> MemoryStore:
5857
read_only=read_only,
5958
)
6059

61-
def _get_default_buffer_class(self) -> type[Buffer]:
62-
# docstring inherited
63-
return default_buffer_prototype().buffer
64-
6560
async def clear(self) -> None:
6661
# docstring inherited
6762
self._store_dict.clear()

src/zarr/storage/_obstore.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,6 @@ def __setstate__(self, state: dict[Any, Any]) -> None:
9797
state["store"] = pickle.loads(state["store"])
9898
self.__dict__.update(state)
9999

100-
def _get_default_buffer_class(self) -> type[Buffer]:
101-
# docstring inherited
102-
from zarr.core.buffer.core import default_buffer_prototype
103-
104-
return default_buffer_prototype().buffer
105-
106100
async def get(
107101
self, key: str, prototype: BufferLike | None = None, byte_range: ByteRequest | None = None
108102
) -> Buffer | None:

src/zarr/storage/_wrapper.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ def __str__(self) -> str:
8383
def __repr__(self) -> str:
8484
return f"WrapperStore({self._store.__class__.__name__}, '{self._store}')"
8585

86-
def _get_default_buffer_class(self) -> type[Buffer]:
87-
# docstring inherited
88-
return self._store._get_default_buffer_class()
89-
9086
async def get(
9187
self, key: str, prototype: BufferLike | None = None, byte_range: ByteRequest | None = None
9288
) -> Buffer | None:

src/zarr/storage/_zip.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
SuffixByteRequest,
1818
)
1919
from zarr.core.buffer import Buffer, BufferPrototype
20-
from zarr.core.buffer.core import default_buffer_prototype
2120

2221
if TYPE_CHECKING:
2322
from collections.abc import AsyncIterator, Iterable
@@ -145,10 +144,6 @@ def __repr__(self) -> str:
145144
def __eq__(self, other: object) -> bool:
146145
return isinstance(other, type(self)) and self.path == other.path
147146

148-
def _get_default_buffer_class(self) -> type[Buffer]:
149-
# docstring inherited
150-
return default_buffer_prototype().buffer
151-
152147
def _get(
153148
self,
154149
key: str,

0 commit comments

Comments
 (0)