@@ -123,12 +123,12 @@ def __init__(
123123 self ._staged_files : list [FileInfo ] = []
124124
125125 # Files that are currently being staged with retry times:
126- self .unstaged_retry_times = {
126+ self ._unstaged_retry_times = {
127127 file_id : now for file_id in wanted_files if file_id not in existing_file_ids
128128 }
129129 # Files that could not be staged because they cannot be found:
130- self .missing_files : list [str ] = []
131- self .ignore_failed = False
130+ self ._missing_files : list [str ] = []
131+ self ._ignore_failed = False
132132
133133 async def get_staged_files (self ) -> list [FileInfo ]:
134134 """Get files that are already staged.
@@ -138,7 +138,7 @@ async def get_staged_files(self) -> list[FileInfo]:
138138 The dict should be cleared after these files have been downloaded.
139139 """
140140 CLIMessageDisplay .display ("Updating list of staged files..." )
141- staging_items = list (self .unstaged_retry_times .items ())
141+ staging_items = list (self ._unstaged_retry_times .items ())
142142 for file_id , retry_time in staging_items :
143143 if perf_counter () >= retry_time :
144144 await self ._check_file_is_in_download_bucket (file_id = file_id )
@@ -153,7 +153,7 @@ async def get_staged_files(self) -> list[FileInfo]:
153153 @property
154154 def finished (self ) -> bool :
155155 """Check whether work is finished, i.e. no staged or unstaged files remain."""
156- return not (self ._staged_files or self .unstaged_retry_times )
156+ return not (self ._staged_files or self ._unstaged_retry_times )
157157
158158 async def _check_file_is_in_download_bucket (self , file_id : str ) -> None :
159159 """Check whether a file with the given file_id is staged to the Download bucket
@@ -170,19 +170,19 @@ async def _check_file_is_in_download_bucket(self, file_id: str) -> None:
170170 response = await self ._download_client .get_drs_object (file_id )
171171 except exceptions .FileNotRegisteredError :
172172 # The Download API returned a 404, meaning it doesn't recognize the file id
173- self .missing_files .append (file_id )
173+ self ._missing_files .append (file_id )
174174 return
175175
176176 if isinstance (response , RetryResponse ):
177177 # The file is not staged to the download bucket yet
178- self .unstaged_retry_times [file_id ] = perf_counter () + response .retry_after
178+ self ._unstaged_retry_times [file_id ] = perf_counter () + response .retry_after
179179 CLIMessageDisplay .display (f"File { file_id } is (still) being staged." )
180180 return
181181
182182 # File is staged and ready for download - add FileInfo instance to dict.
183183 # Also, response is a DRS object -- get file size from it
184184 file_size = extract_file_size (drs_object = response )
185- del self .unstaged_retry_times [file_id ]
185+ del self ._unstaged_retry_times [file_id ]
186186 self ._staged_files .append (
187187 FileInfo (
188188 file_id = file_id ,
@@ -207,9 +207,9 @@ def _handle_failures(self) -> bool:
207207 Returns whether there was user interaction.
208208 Raises an error if the user chose to abort the download.
209209 """
210- if not self .missing_files or self .ignore_failed :
210+ if not self ._missing_files or self ._ignore_failed :
211211 return False
212- missing = ", " .join (self .missing_files )
212+ missing = ", " .join (self ._missing_files )
213213 message = f"No download exists for the following file IDs: { missing } "
214214 CLIMessageDisplay .failure (message )
215215 if self .finished :
@@ -222,5 +222,5 @@ def _handle_failures(self) -> bool:
222222 self ._io_handler .handle_response (response = response )
223223 CLIMessageDisplay .display ("Downloading remaining files" )
224224 self ._started_waiting = perf_counter () # reset the timer
225- self .missing_files = [] # reset list of missing files
225+ self ._missing_files = [] # reset list of missing files
226226 return True
0 commit comments