Skip to content

Commit

Permalink
Make MemoryStore serialiazable (#2204)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAugspurger authored Sep 19, 2024
1 parent 54060d3 commit f894335
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
8 changes: 1 addition & 7 deletions src/zarr/store/memory.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from collections.abc import AsyncGenerator, MutableMapping
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING

from zarr.abc.store import Store
from zarr.core.buffer import Buffer, gpu
Expand Down Expand Up @@ -55,12 +55,6 @@ def __eq__(self, other: object) -> bool:
and self.mode == other.mode
)

def __setstate__(self, state: Any) -> None:
raise NotImplementedError(f"{type(self)} cannot be pickled")

def __getstate__(self) -> None:
raise NotImplementedError(f"{type(self)} cannot be pickled")

async def get(
self,
key: str,
Expand Down
22 changes: 0 additions & 22 deletions tests/v3/test_store/test_memory.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import annotations

import pickle

import pytest

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

def test_serizalizable_store(self, store: MemoryStore) -> None:
with pytest.raises(NotImplementedError):
store.__getstate__()

with pytest.raises(NotImplementedError):
store.__setstate__({})

with pytest.raises(NotImplementedError):
pickle.dumps(store)


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

def test_list_prefix(self, store: GpuMemoryStore) -> None:
assert True

def test_serizalizable_store(self, store: MemoryStore) -> None:
with pytest.raises(NotImplementedError):
store.__getstate__()

with pytest.raises(NotImplementedError):
store.__setstate__({})

with pytest.raises(NotImplementedError):
pickle.dumps(store)

0 comments on commit f894335

Please sign in to comment.