11from typing import Any , Tuple , IO
22from pathlib import PurePosixPath , Path
33from urllib .parse import ParseResult
4- from exasol_bucketfs_utils_python import download , upload
4+ from exasol_bucketfs_utils_python import download , upload , list_files
55from exasol_bucketfs_utils_python import load_file_from_local_fs as from_BFS
66from exasol_bucketfs_utils_python .bucket_config import BucketConfig
77
@@ -24,90 +24,98 @@ def __init__(self, bucket_config: BucketConfig, base_path: PurePosixPath):
2424 self .base_path = base_path
2525 self .bucket_config = bucket_config
2626
27- def get_complete_file_path_in_bucket (self ,
28- bucket_file_path : str ) -> str :
27+ def get_complete_file_path_in_bucket (
28+ self ,
29+ bucket_file_path : str ) -> str :
2930 return str (PurePosixPath (self .base_path , bucket_file_path ))
3031
31- def download_from_bucketfs_to_string (self ,
32- bucket_file_path : str ) -> str :
33- result = download .download_from_bucketfs_to_string (
32+ def download_from_bucketfs_to_string (
33+ self ,
34+ bucket_file_path : str ) -> str :
35+ return download .download_from_bucketfs_to_string (
3436 self .bucket_config ,
3537 self .get_complete_file_path_in_bucket (bucket_file_path )
3638 )
37- return result
3839
39- def download_object_from_bucketfs_via_joblib (self ,
40- bucket_file_path : str ) -> Any :
41- result = download .download_object_from_bucketfs_via_joblib (
40+ def download_object_from_bucketfs_via_joblib (
41+ self ,
42+ bucket_file_path : str ) -> Any :
43+ return download .download_object_from_bucketfs_via_joblib (
4244 self .bucket_config ,
4345 self .get_complete_file_path_in_bucket (bucket_file_path )
4446 )
45- return result
4647
47- def upload_string_to_bucketfs (self ,
48- bucket_file_path : str ,
49- string : str ) -> \
50- Tuple [ParseResult , PurePosixPath ]:
51- result = upload .upload_string_to_bucketfs (
48+ def upload_string_to_bucketfs (
49+ self ,
50+ bucket_file_path : str ,
51+ string : str ) -> Tuple [ParseResult , PurePosixPath ]:
52+ return upload .upload_string_to_bucketfs (
5253 self .bucket_config ,
5354 self .get_complete_file_path_in_bucket (bucket_file_path ),
5455 string
5556 )
56- return result
5757
58- def upload_object_to_bucketfs_via_joblib (self , object : Any ,
59- bucket_file_path : str ,
60- ** kwargs ) -> \
61- Tuple [ParseResult , PurePosixPath ]:
62- result = upload .upload_object_to_bucketfs_via_joblib (
58+ def upload_object_to_bucketfs_via_joblib (
59+ self , object : Any ,
60+ bucket_file_path : str ,
61+ ** kwargs ) -> Tuple [ParseResult , PurePosixPath ]:
62+ return upload .upload_object_to_bucketfs_via_joblib (
6363 object ,
6464 self .bucket_config ,
6565 self .get_complete_file_path_in_bucket (bucket_file_path ),
6666 ** kwargs
6767 )
68- return result
6968
70- def upload_fileobj_to_bucketfs (self ,
71- fileobj : IO ,
72- bucket_file_path : str ) -> \
73- Tuple [ParseResult , PurePosixPath ]:
74- result = upload .upload_fileobj_to_bucketfs (
69+ def upload_fileobj_to_bucketfs (
70+ self ,
71+ fileobj : IO ,
72+ bucket_file_path : str ) -> Tuple [ParseResult , PurePosixPath ]:
73+ return upload .upload_fileobj_to_bucketfs (
7574 self .bucket_config ,
7675 self .get_complete_file_path_in_bucket (bucket_file_path ),
7776 fileobj
7877 )
79- return result
8078
81- def read_file_from_bucketfs_to_string (self ,
82- bucket_file_path : str ) -> str :
83- result = from_BFS .read_file_from_bucketfs_to_string (
79+ def read_file_from_bucketfs_to_string (
80+ self ,
81+ bucket_file_path : str ) -> str :
82+ return from_BFS .read_file_from_bucketfs_to_string (
8483 self .get_complete_file_path_in_bucket (bucket_file_path ),
8584 self .bucket_config
8685 )
87- return result
8886
89- def read_file_from_bucketfs_to_file (self ,
90- bucket_file_path : str ,
91- local_file_path : Path ) -> None :
87+ def read_file_from_bucketfs_to_file (
88+ self ,
89+ bucket_file_path : str ,
90+ local_file_path : Path ) -> None :
9291 from_BFS .read_file_from_bucketfs_to_file (
9392 self .get_complete_file_path_in_bucket (bucket_file_path ),
9493 self .bucket_config ,
9594 local_file_path
9695 )
9796
98- def read_file_from_bucketfs_to_fileobj (self ,
99- bucket_file_path : str ,
100- fileobj : IO ) -> None :
97+ def read_file_from_bucketfs_to_fileobj (
98+ self ,
99+ bucket_file_path : str ,
100+ fileobj : IO ) -> None :
101101 from_BFS .read_file_from_bucketfs_to_fileobj (
102102 self .get_complete_file_path_in_bucket (bucket_file_path ),
103103 self .bucket_config ,
104104 fileobj
105105 )
106106
107- def read_file_from_bucketfs_via_joblib (self ,
108- bucket_file_path : str ) -> Any :
109- result = from_BFS .read_file_from_bucketfs_via_joblib (
107+ def read_file_from_bucketfs_via_joblib (
108+ self ,
109+ bucket_file_path : str ) -> Any :
110+ return from_BFS .read_file_from_bucketfs_via_joblib (
110111 self .get_complete_file_path_in_bucket (bucket_file_path ),
111112 self .bucket_config
112113 )
113- return result
114+
115+ def list_files_in_bucketfs (
116+ self ,
117+ bucket_file_path : str ) -> list :
118+ return list_files .list_files_in_bucketfs (
119+ self .bucket_config ,
120+ self .get_complete_file_path_in_bucket (bucket_file_path )
121+ )
0 commit comments