Skip to content

Commit 3be4afc

Browse files
committed
use ls instead of walk
1 parent 00695ad commit 3be4afc

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/zarr/storage/remote.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,9 @@ async def clear(self) -> None:
9494
pass
9595

9696
async def empty(self) -> bool:
97-
async for _path, _dirs, files in self.fs._walk(self.path):
98-
# stop once a file is found
99-
if files:
100-
return False
101-
return True
97+
# TODO: it would be nice if we didn't have to list all keys here
98+
# it should be possible to stop after the first key is discovered
99+
return not await self.fs._ls(self.path)
102100

103101
def with_mode(self, mode: AccessModeLiteral) -> Self:
104102
return type(self)(

tests/v3/test_store/test_remote.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,13 @@ def test_store_repr(self, store: RemoteStore) -> None:
135135
assert str(store) == "<RemoteStore(S3FileSystem, test)>"
136136

137137
def test_store_supports_writes(self, store: RemoteStore) -> None:
138-
assert True
138+
assert store.supports_writes
139139

140-
@pytest.mark.xfail
141140
def test_store_supports_partial_writes(self, store: RemoteStore) -> None:
142-
raise AssertionError
141+
assert not store.supports_partial_writes
143142

144143
def test_store_supports_listing(self, store: RemoteStore) -> None:
145-
assert True
144+
assert store.supports_listing
146145

147146
async def test_remote_store_from_uri(
148147
self, store: RemoteStore, store_kwargs: dict[str, str | bool]

0 commit comments

Comments
 (0)