@@ -983,7 +983,9 @@ async def open(
983983 Examples
984984 --------
985985 ```python
986+ import asyncio
986987 import zarr
988+ from zarr.core.array import AsyncArray
987989
988990 async def example():
989991 store = zarr.storage.MemoryStore()
@@ -995,8 +997,8 @@ async def example():
995997 async_arr = await AsyncArray.open(store)
996998 return async_arr
997999
998- # async_arr = await example()
999- # AsyncArray( ...)
1000+ async_arr = asyncio.run( example() )
1001+ # < AsyncArray memory:// ... shape=(100, 100) dtype=int32>
10001002 ```
10011003 """
10021004 store_path = await make_store_path (store )
@@ -1313,18 +1315,21 @@ async def nchunks_initialized(self) -> int:
13131315 Examples
13141316 --------
13151317 ```python
1318+ import asyncio
13161319 import zarr.api.asynchronous
13171320
13181321 async def example():
1319- arr = await zarr.api.asynchronous.create(shape=(10,), chunks=(1,), shards=(2,) )
1322+ arr = await zarr.api.asynchronous.create(shape=(10,), chunks=(1,))
13201323 count = await arr.nchunks_initialized()
1321- # 0
1324+ print(f"Initial: {count}")
1325+ #> Initial: 0
13221326 await arr.setitem(slice(5), 1)
13231327 count = await arr.nchunks_initialized()
1324- # 6
1328+ print(f"After write: {count}")
1329+ #> After write: 5
13251330 return count
13261331
1327- # result = await example()
1332+ result = asyncio.run( example() )
13281333 ```
13291334 """
13301335 if self .shards is None :
@@ -1354,18 +1359,21 @@ async def _nshards_initialized(self) -> int:
13541359 Examples
13551360 --------
13561361 ```python
1362+ import asyncio
13571363 import zarr.api.asynchronous
13581364
13591365 async def example():
13601366 arr = await zarr.api.asynchronous.create(shape=(10,), chunks=(2,))
13611367 count = await arr._nshards_initialized()
1362- # 0
1368+ print(f"Initial: {count}")
1369+ #> Initial: 0
13631370 await arr.setitem(slice(5), 1)
13641371 count = await arr._nshards_initialized()
1365- # 3
1372+ print(f"After write: {count}")
1373+ #> After write: 3
13661374 return count
13671375
1368- # result = await example()
1376+ result = asyncio.run( example() )
13691377 ```
13701378 """
13711379 return len (await _shards_initialized (self ))
@@ -1595,6 +1603,7 @@ async def getitem(
15951603 Examples
15961604 --------
15971605 ```python
1606+ import asyncio
15981607 import zarr.api.asynchronous
15991608
16001609 async def example():
@@ -1606,10 +1615,11 @@ async def example():
16061615 dtype='i4',
16071616 fill_value=0)
16081617 result = await async_arr.getitem((0,1))
1609- # array(0, dtype=int32)
1618+ print(result)
1619+ #> 0
16101620 return result
16111621
1612- # value = await example()
1622+ value = asyncio.run( example() )
16131623 ```
16141624 """
16151625 if prototype is None :
0 commit comments