

def listdir(self, path):
    path = self._path(path)
    if (not path.endswith('/')):
        path = (path + '/')
    (directories, files) = ([], [])
    options = {
        'prefix': path,
        'delimiter': '/',
    }
    response = self.connection.list_bucket(self.bucket, options=options)
    for prefix in response.common_prefixes:
        directories.append(prefix.prefix.replace(path, '').strip('/'))
    for entry in response.entries:
        files.append(entry.key.replace(path, ''))
    return (directories, files)

dataset/ETHPy150Open kylemacfarlane/django-cb-storage-s3/src/cuddlybuddly/storage/s3/storage.py S3Storage.listdir/original