@@ -172,6 +172,14 @@ def __init__(
172
172
self ._progress_bar = progress_bar
173
173
self ._resume_retries = resume_retries
174
174
175
+ def batch (
176
+ self , links : Iterable [Link ], location : str
177
+ ) -> Iterable [tuple [Link , tuple [str , str ]]]:
178
+ """Download the files given by links into location."""
179
+ for link in links :
180
+ filepath , content_type = self (link , location )
181
+ yield link , (filepath , content_type )
182
+
175
183
def __call__ (self , link : Link , location : str ) -> tuple [str , str ]:
176
184
"""Download the file given by link into location."""
177
185
resp = _http_get_download (self ._session , link )
@@ -297,21 +305,3 @@ def _reset_download_state(
297
305
etag_or_last_modified = _get_http_response_etag_or_last_modified (resp )
298
306
299
307
return bytes_received , total_length , etag_or_last_modified
300
-
301
-
302
- class BatchDownloader :
303
- def __init__ (
304
- self ,
305
- session : PipSession ,
306
- progress_bar : str ,
307
- resume_retries : int ,
308
- ) -> None :
309
- self ._downloader = Downloader (session , progress_bar , resume_retries )
310
-
311
- def __call__ (
312
- self , links : Iterable [Link ], location : str
313
- ) -> Iterable [tuple [Link , tuple [str , str ]]]:
314
- """Download the files given by links into location."""
315
- for link in links :
316
- filepath , content_type = self ._downloader (link , location )
317
- yield link , (filepath , content_type )
0 commit comments