Skip to content

Commit f894335

Browse files
Make MemoryStore serialiazable (#2204)
1 parent 54060d3 commit f894335

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

src/zarr/store/memory.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from collections.abc import AsyncGenerator, MutableMapping
4-
from typing import TYPE_CHECKING, Any
4+
from typing import TYPE_CHECKING
55

66
from zarr.abc.store import Store
77
from zarr.core.buffer import Buffer, gpu
@@ -55,12 +55,6 @@ def __eq__(self, other: object) -> bool:
5555
and self.mode == other.mode
5656
)
5757

58-
def __setstate__(self, state: Any) -> None:
59-
raise NotImplementedError(f"{type(self)} cannot be pickled")
60-
61-
def __getstate__(self) -> None:
62-
raise NotImplementedError(f"{type(self)} cannot be pickled")
63-
6458
async def get(
6559
self,
6660
key: str,

tests/v3/test_store/test_memory.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
import pickle
4-
53
import pytest
64

75
from zarr.core.buffer import Buffer, cpu, gpu
@@ -48,16 +46,6 @@ def test_store_supports_partial_writes(self, store: MemoryStore) -> None:
4846
def test_list_prefix(self, store: MemoryStore) -> None:
4947
assert True
5048

51-
def test_serizalizable_store(self, store: MemoryStore) -> None:
52-
with pytest.raises(NotImplementedError):
53-
store.__getstate__()
54-
55-
with pytest.raises(NotImplementedError):
56-
store.__setstate__({})
57-
58-
with pytest.raises(NotImplementedError):
59-
pickle.dumps(store)
60-
6149

6250
@gpu_test
6351
class TestGpuMemoryStore(StoreTests[GpuMemoryStore, gpu.Buffer]):
@@ -92,13 +80,3 @@ def test_store_supports_partial_writes(self, store: GpuMemoryStore) -> None:
9280

9381
def test_list_prefix(self, store: GpuMemoryStore) -> None:
9482
assert True
95-
96-
def test_serizalizable_store(self, store: MemoryStore) -> None:
97-
with pytest.raises(NotImplementedError):
98-
store.__getstate__()
99-
100-
with pytest.raises(NotImplementedError):
101-
store.__setstate__({})
102-
103-
with pytest.raises(NotImplementedError):
104-
pickle.dumps(store)

0 commit comments

Comments
 (0)