@@ -256,12 +256,20 @@ async def _get_bytes(
256256
257257 Examples
258258 --------
259- >>> store = await MemoryStore.open()
260- >>> await store.set("data", Buffer.from_bytes(b"hello world"))
261- >>> data = await store.get_bytes("data", prototype=default_buffer_prototype())
262- >>> print(data)
259+ >>> async def example():
260+ ... from zarr.core.buffer.cpu import Buffer
261+ ... from zarr.storage import MemoryStore
262+ ...
263+ ... store = await MemoryStore.open()
264+ ... await store.set("data", Buffer.from_bytes(b"hello world"))
265+ ... # No need to specify prototype for MemoryStore
266+ ... return await store._get_bytes("data")
267+
268+ >>> import asyncio
269+ >>> asyncio.run(example())
263270 b'hello world'
264271 """
272+
265273 buffer = await self .get (key , prototype , byte_range )
266274 if buffer is None :
267275 raise FileNotFoundError (key )
@@ -309,10 +317,11 @@ def _get_bytes_sync(
309317
310318 Examples
311319 --------
320+ >>> from zarr.core.buffer.cpu import Buffer
321+ >>> from zarr.storage import MemoryStore
312322 >>> store = MemoryStore()
313- >>> await store.set("data", Buffer.from_bytes(b"hello world"))
314- >>> data = store.get_bytes_sync("data", prototype=default_buffer_prototype())
315- >>> print(data)
323+ >>> store.set_sync("data", Buffer.from_bytes(b"hello world"))
324+ >>> store._get_bytes_sync("data") # No need to specify prototype for MemoryStore
316325 b'hello world'
317326 """
318327
@@ -358,11 +367,18 @@ async def _get_json(
358367
359368 Examples
360369 --------
361- >>> store = await MemoryStore.open()
362- >>> metadata = {"zarr_format": 3, "node_type": "array"}
363- >>> await store.set("zarr.json", Buffer.from_bytes(json.dumps(metadata).encode()))
364- >>> data = await store.get_json("zarr.json", prototype=default_buffer_prototype())
365- >>> print(data)
370+ >>> async def example():
371+ ... from zarr.core.buffer.cpu import Buffer
372+ ... from zarr.storage import MemoryStore
373+ ...
374+ ... store = await MemoryStore.open()
375+ ... metadata = {"zarr_format": 3, "node_type": "array"}
376+ ... await store.set("zarr.json", Buffer.from_bytes(json.dumps(metadata).encode()))
377+ ... # No need to specify prototype for MemoryStore
378+ ... return await store._get_json("zarr.json")
379+
380+ >>> import asyncio
381+ >>> asyncio.run(example())
366382 {'zarr_format': 3, 'node_type': 'array'}
367383 """
368384
@@ -414,11 +430,12 @@ def _get_json_sync(
414430
415431 Examples
416432 --------
433+ >>> from zarr.core.buffer.cpu import Buffer
434+ >>> from zarr.storage import MemoryStore
417435 >>> store = MemoryStore()
418436 >>> metadata = {"zarr_format": 3, "node_type": "array"}
419- >>> store.set("zarr.json", Buffer.from_bytes(json.dumps(metadata).encode()))
420- >>> data = store.get_json_sync("zarr.json", prototype=default_buffer_prototype())
421- >>> print(data)
437+ >>> store.set_sync("zarr.json", Buffer.from_bytes(json.dumps(metadata).encode()))
438+ >>> store._get_json_sync("zarr.json") # No need to specify prototype for MemoryStore
422439 {'zarr_format': 3, 'node_type': 'array'}
423440 """
424441
0 commit comments