33
33
from fsspec .asyn import AsyncFileSystem
34
34
from fsspec .utils import get_protocol
35
35
from obstore .fsspec import AsyncFsspecStore
36
- from obstore .store import GCSStore , S3Store , AzureStore
36
+ from obstore .store import AzureStore , GCSStore , S3Store
37
37
from typing_extensions import Unpack
38
38
39
39
from flytekit import configuration
@@ -86,6 +86,7 @@ def s3_setup_args(s3_cfg: configuration.S3Config, bucket: str = "", anonymous: b
86
86
87
87
return kwargs
88
88
89
+
89
90
def gs_setup_args (gcs_cfg : configuration .GCSConfig , bucket : str = "" , anonymous : bool = False ) -> Dict [str , Any ]:
90
91
kwargs : Dict [str , Any ] = {}
91
92
@@ -140,7 +141,9 @@ def split_path(path: str) -> Tuple[str, str]:
140
141
return bucket , path
141
142
142
143
143
- def azure_setup_args (azure_cfg : configuration .AzureBlobStorageConfig , container : str = "" , anonymous : bool = False ) -> Dict [str , Any ]:
144
+ def azure_setup_args (
145
+ azure_cfg : configuration .AzureBlobStorageConfig , container : str = "" , anonymous : bool = False
146
+ ) -> Dict [str , Any ]:
144
147
kwargs : Dict [str , Any ] = {}
145
148
store_kwargs : Dict [str , Any ] = {}
146
149
@@ -311,7 +314,9 @@ async def get_async_filesystem_for_path(
311
314
protocol , anonymous = anonymous , path = path , bucket = bucket , asynchronous = True , loop = loop , ** kwargs
312
315
)
313
316
314
- def get_filesystem_for_path (self , path : str = "" , bucket : str = "" , anonymous : bool = False , ** kwargs ) -> fsspec .AbstractFileSystem :
317
+ def get_filesystem_for_path (
318
+ self , path : str = "" , bucket : str = "" , anonymous : bool = False , ** kwargs
319
+ ) -> fsspec .AbstractFileSystem :
315
320
protocol = get_protocol (path )
316
321
return self .get_filesystem (protocol , anonymous = anonymous , path = path , bucket = bucket , ** kwargs )
317
322
@@ -513,13 +518,13 @@ async def async_put_raw_data(
513
518
r = await self ._put (from_path , to_path , ** kwargs )
514
519
return r or to_path
515
520
516
- bucket , to_path_file_only = split_path (to_path )
521
+ bucket , _ = split_path (to_path )
517
522
518
523
# See https://github.com/fsspec/s3fs/issues/871 for more background and pending work on the fsspec side to
519
524
# support effectively async open(). For now these use-cases below will revert to sync calls.
520
525
# raw bytes
521
526
if isinstance (lpath , bytes ):
522
- fs = self .get_filesystem_for_path (to_path_file_only , bucket )
527
+ fs = self .get_filesystem_for_path (to_path , bucket )
523
528
with fs .open (to_path , "wb" , ** kwargs ) as s :
524
529
s .write (lpath )
525
530
return to_path
@@ -528,7 +533,7 @@ async def async_put_raw_data(
528
533
if isinstance (lpath , io .BufferedReader ) or isinstance (lpath , io .BytesIO ):
529
534
if not lpath .readable ():
530
535
raise FlyteAssertion ("Buffered reader must be readable" )
531
- fs = self .get_filesystem_for_path (to_path_file_only , bucket )
536
+ fs = self .get_filesystem_for_path (to_path , bucket )
532
537
lpath .seek (0 )
533
538
with fs .open (to_path , "wb" , ** kwargs ) as s :
534
539
while data := lpath .read (read_chunk_size_bytes ):
@@ -538,7 +543,7 @@ async def async_put_raw_data(
538
543
if isinstance (lpath , io .StringIO ):
539
544
if not lpath .readable ():
540
545
raise FlyteAssertion ("Buffered reader must be readable" )
541
- fs = self .get_filesystem_for_path (to_path_file_only , bucket )
546
+ fs = self .get_filesystem_for_path (to_path , bucket )
542
547
lpath .seek (0 )
543
548
with fs .open (to_path , "wb" , ** kwargs ) as s :
544
549
while data_str := lpath .read (read_chunk_size_bytes ):
0 commit comments