@@ -50,13 +50,13 @@ class _DbfsIO(BinaryIO):
5050 _closed = False
5151
5252 def __init__ (
53- self ,
54- api : files .DbfsAPI ,
55- path : str ,
56- * ,
57- read : bool = False ,
58- write : bool = False ,
59- overwrite : bool = False ,
53+ self ,
54+ api : files .DbfsAPI ,
55+ path : str ,
56+ * ,
57+ read : bool = False ,
58+ write : bool = False ,
59+ overwrite : bool = False ,
6060 ):
6161 self ._api = api
6262 self ._path = path
@@ -115,10 +115,10 @@ def closed(self) -> bool:
115115 return self ._closed
116116
117117 def __exit__ (
118- self ,
119- __t : Type [BaseException ] | None ,
120- __value : BaseException | None ,
121- __traceback : TracebackType | None ,
118+ self ,
119+ __t : Type [BaseException ] | None ,
120+ __value : BaseException | None ,
121+ __traceback : TracebackType | None ,
122122 ):
123123 self .close ()
124124
@@ -200,13 +200,13 @@ def __repr__(self) -> str:
200200class _VolumesIO (BinaryIO ):
201201
202202 def __init__ (
203- self ,
204- api : files .FilesAPI ,
205- path : str ,
206- * ,
207- read : bool ,
208- write : bool ,
209- overwrite : bool ,
203+ self ,
204+ api : files .FilesAPI ,
205+ path : str ,
206+ * ,
207+ read : bool ,
208+ write : bool ,
209+ overwrite : bool ,
210210 ):
211211 self ._buffer = []
212212 self ._api = api
@@ -586,12 +586,12 @@ def __init__(self, api_client):
586586 self ._dbfs_api = files .DbfsAPI (api_client )
587587
588588 def open (
589- self ,
590- path : str ,
591- * ,
592- read : bool = False ,
593- write : bool = False ,
594- overwrite : bool = False ,
589+ self ,
590+ path : str ,
591+ * ,
592+ read : bool = False ,
593+ write : bool = False ,
594+ overwrite : bool = False ,
595595 ) -> BinaryIO :
596596 return self ._path (path ).open (read = read , write = write , overwrite = overwrite )
597597
@@ -790,12 +790,12 @@ def upload(self, file_path: str, contents: BinaryIO, *, overwrite: Optional[bool
790790 raise ValueError (f"Unexpected server response: { initiate_upload_response } " )
791791
792792 def _perform_multipart_upload (
793- self ,
794- target_path : str ,
795- input_stream : BinaryIO ,
796- session_token : str ,
797- pre_read_buffer : bytes ,
798- cloud_provider_session : requests .Session ,
793+ self ,
794+ target_path : str ,
795+ input_stream : BinaryIO ,
796+ session_token : str ,
797+ pre_read_buffer : bytes ,
798+ cloud_provider_session : requests .Session ,
799799 ):
800800 """
801801 Performs multipart upload using presigned URLs on AWS and Azure:
@@ -992,13 +992,13 @@ def _is_url_expired_response(response: requests.Response):
992992 return False
993993
994994 def _perform_resumable_upload (
995- self ,
996- target_path : str ,
997- input_stream : BinaryIO ,
998- session_token : str ,
999- overwrite : bool ,
1000- pre_read_buffer : bytes ,
1001- cloud_provider_session : requests .Session ,
995+ self ,
996+ target_path : str ,
997+ input_stream : BinaryIO ,
998+ session_token : str ,
999+ overwrite : bool ,
1000+ pre_read_buffer : bytes ,
1001+ cloud_provider_session : requests .Session ,
10021002 ):
10031003 """
10041004 Performs resumable upload on GCP: https://cloud.google.com/storage/docs/performing-resumable-uploads
@@ -1249,7 +1249,7 @@ def perform():
12491249 raise ValueError (abort_response )
12501250
12511251 def _abort_resumable_upload (
1252- self , resumable_upload_url : str , required_headers : list , cloud_provider_session : requests .Session
1252+ self , resumable_upload_url : str , required_headers : list , cloud_provider_session : requests .Session
12531253 ):
12541254 """Aborts ongoing resumable upload session to clean up incomplete file."""
12551255 headers : dict = {}
@@ -1284,7 +1284,7 @@ def _create_cloud_provider_session(self):
12841284 return session
12851285
12861286 def _retry_idempotent_operation (
1287- self , operation : Callable [[], requests .Response ], before_retry : Callable = None
1287+ self , operation : Callable [[], requests .Response ], before_retry : Callable = None
12881288 ) -> requests .Response :
12891289 """Perform given idempotent operation with necessary retries. Since operation is idempotent it's
12901290 safe to retry it for response codes where server state might have changed.
@@ -1312,7 +1312,7 @@ def delegate():
13121312 )(delegate )()
13131313
13141314 def _open_download_stream (
1315- self , file_path : str , start_byte_offset : int , if_unmodified_since_timestamp : Optional [str ] = None
1315+ self , file_path : str , start_byte_offset : int , if_unmodified_since_timestamp : Optional [str ] = None
13161316 ) -> DownloadResponse :
13171317 """Opens a download stream from given offset, performing necessary retries."""
13181318 headers = {
@@ -1364,12 +1364,12 @@ def _wrap_stream(self, file_path: str, download_response: DownloadResponse):
13641364class _ResilientResponse (_RawResponse ):
13651365
13661366 def __init__ (
1367- self ,
1368- api : FilesExt ,
1369- file_path : str ,
1370- file_last_modified : str ,
1371- offset : int ,
1372- underlying_response : _RawResponse ,
1367+ self ,
1368+ api : FilesExt ,
1369+ file_path : str ,
1370+ file_last_modified : str ,
1371+ offset : int ,
1372+ underlying_response : _RawResponse ,
13731373 ):
13741374 self .api = api
13751375 self .file_path = file_path
@@ -1402,19 +1402,19 @@ class _ResilientIterator(Iterator):
14021402
14031403 @staticmethod
14041404 def _extract_raw_response (
1405- download_response : DownloadResponse ,
1405+ download_response : DownloadResponse ,
14061406 ) -> _RawResponse :
14071407 streaming_response : _StreamingResponse = download_response .contents # this is an instance of _StreamingResponse
14081408 return streaming_response ._response
14091409
14101410 def __init__ (
1411- self ,
1412- underlying_iterator ,
1413- file_path : str ,
1414- file_last_modified : str ,
1415- offset : int ,
1416- api : FilesExt ,
1417- chunk_size : int ,
1411+ self ,
1412+ underlying_iterator ,
1413+ file_path : str ,
1414+ file_last_modified : str ,
1415+ offset : int ,
1416+ api : FilesExt ,
1417+ chunk_size : int ,
14181418 ):
14191419 self ._underlying_iterator = underlying_iterator
14201420 self ._api = api
@@ -1435,9 +1435,9 @@ def _should_recover(self) -> bool:
14351435 _LOG .debug ("Total recovers limit exceeded" )
14361436 return False
14371437 if (
1438- self ._api ._config .files_api_client_download_max_total_recovers_without_progressing is not None
1439- and self ._recovers_without_progressing_count
1440- >= self ._api ._config .files_api_client_download_max_total_recovers_without_progressing
1438+ self ._api ._config .files_api_client_download_max_total_recovers_without_progressing is not None
1439+ and self ._recovers_without_progressing_count
1440+ >= self ._api ._config .files_api_client_download_max_total_recovers_without_progressing
14411441 ):
14421442 _LOG .debug ("No progression recovers limit exceeded" )
14431443 return False
0 commit comments