Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,5 @@ jobs:
run: |
cd ${{ matrix.FRIEND }}
pip install -e . --no-deps
pytest -v -W ignore::pytest.PytestRemovedIn9Warning --ignore=gcsfs/tests/perf
pytest -v -W ignore::pytest.PytestRemovedIn10Warning --ignore=gcsfs/tests/perf
cd ..
23 changes: 18 additions & 5 deletions fsspec/asyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ async def _info(self, path, **kwargs):
async def _ls(self, path, detail=True, **kwargs):
raise NotImplementedError

async def _walk(self, path, maxdepth=None, on_error="omit", **kwargs):
async def _walk(self, path, maxdepth=None, topdown=True, on_error="omit", **kwargs):
if maxdepth is not None and maxdepth < 1:
raise ValueError("maxdepth must be at least 1")

Expand Down Expand Up @@ -783,22 +783,35 @@ async def _walk(self, path, maxdepth=None, on_error="omit", **kwargs):
else:
files[name] = info

if detail:
if not detail:
dirs = list(dirs)
files = list(files)

if topdown:
# Yield before recursion if walking top down
yield path, dirs, files
else:
yield path, list(dirs), list(files)

if maxdepth is not None:
maxdepth -= 1
if maxdepth < 1:
if not topdown:
yield path, dirs, files
return

for d in dirs:
async for _ in self._walk(
full_dirs[d], maxdepth=maxdepth, detail=detail, **kwargs
full_dirs[d],
maxdepth=maxdepth,
detail=detail,
topdown=topdown,
**kwargs,
):
yield _

if not topdown:
# Yield after recursion if walking bottom up
yield path, dirs, files

async def _glob(self, path, maxdepth=None, **kwargs):
if maxdepth is not None and maxdepth < 1:
raise ValueError("maxdepth must be at least 1")
Expand Down
Loading