def list_files(filesystem: S3FileSystem, bucket: str, s3_uri: str) -> list: """List files on S3 bucket on given URI.""" # Remove leading and trailing "/" s3_uri = s3_uri.strip('/') # Find all files on s3_uri in bucket paths = filesystem.glob(f'{bucket}/{s3_uri}/*.parquet') if paths: return paths raise FileExistsError( f'Bucket {bucket} contains no files matching "{s3_uri}" URI')
def glob(self, path): s3_path = self._trim_filename(path) return ['s3://%s' % s for s in S3FileSystem.glob(self, s3_path)]
def glob(self, path, **kwargs): bucket = kwargs.pop('host', '') s3_path = bucket + path return S3FileSystem.glob(self, s3_path)