Skip to content

Commit a5b186b

Browse files
committed
use path for gpumemorystore
1 parent 9e65afb commit a5b186b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/zarr/storage/memory.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,18 +206,19 @@ def __init__(
206206
self,
207207
store_dict: MutableMapping[str, gpu.Buffer] | None = None,
208208
*,
209+
path: str = "",
209210
mode: AccessModeLiteral = "r",
210211
) -> None:
211-
super().__init__(store_dict=store_dict, mode=mode) # type: ignore[arg-type]
212+
super().__init__(store_dict=store_dict, path=path, mode=mode) # type: ignore[arg-type]
212213

213214
def __str__(self) -> str:
214-
return f"gpumemory://{id(self._store_dict)}"
215+
return f"gpumemory://{id(self._store_dict)}/{self.path}"
215216

216217
def __repr__(self) -> str:
217218
return f"GpuMemoryStore({str(self)!r})"
218219

219220
@classmethod
220-
def from_dict(cls, store_dict: MutableMapping[str, Buffer]) -> Self:
221+
def from_dict(cls, store_dict: MutableMapping[str, Buffer], path: str = "") -> Self:
221222
"""
222223
Create a GpuMemoryStore from a dictionary of buffers at any location.
223224
@@ -235,7 +236,7 @@ def from_dict(cls, store_dict: MutableMapping[str, Buffer]) -> Self:
235236
GpuMemoryStore
236237
"""
237238
gpu_store_dict = {k: gpu.Buffer.from_buffer(v) for k, v in store_dict.items()}
238-
return cls(gpu_store_dict)
239+
return cls(gpu_store_dict, path=path)
239240

240241
async def set(self, key: str, value: Buffer, byte_range: tuple[int, int] | None = None) -> None:
241242
# docstring inherited

0 commit comments

Comments
 (0)