Skip to content

Commit 47f1a77

Browse files
author
Martin Durant
committed
Add old way
1 parent 261295a commit 47f1a77

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

s3fs/core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import logging
44
import os
55
import socket
6-
import time
76
from typing import Tuple, Optional
87
import weakref
98

@@ -446,6 +445,9 @@ async def _find(self, path, maxdepth=None, withdirs=None, detail=False):
446445
bucket, key, _ = self.split_path(path)
447446
if not bucket:
448447
raise ValueError("Cannot traverse all of S3")
448+
if maxdepth:
449+
return super().find(bucket + "/" + key, maxdepth=maxdepth, withdirs=withdirs,
450+
detail=detail)
449451
# TODO: implement find from dircache, if all listings are present
450452
# if refresh is False:
451453
# out = incomplete_tree_dirs(self.dircache, path)
@@ -481,7 +483,7 @@ async def _find(self, path, maxdepth=None, withdirs=None, detail=False):
481483
return {o['name']: o for o in out}
482484
return [o['name'] for o in out]
483485

484-
find = sync_wrapper(_find)
486+
#find = sync_wrapper(_find)
485487

486488
async def _mkdir(self, path, acl="", create_parents=True, **kwargs):
487489
path = self._strip_protocol(path).rstrip('/')

s3fs/tests/test_s3fs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1689,5 +1689,5 @@ def test_shallow_find(s3):
16891689
``ls``, without returning subdirectories. See also issue 378.
16901690
"""
16911691

1692-
assert s3.ls(test_bucket_name) == s3.find(test_bucket_name, maxdepth=1)
1692+
assert s3.ls(test_bucket_name) == s3.find(test_bucket_name, maxdepth=1, withdirs=True)
16931693
assert s3.ls(test_bucket_name) == s3.glob(test_bucket_name + "/*")

0 commit comments

Comments
 (0)