Cadair / parfive

An asyncio based parallel file downloader for Python 3.8+
https://parfive.readthedocs.io/
MIT License
51 stars 24 forks source link

`progress=False` and `overwrite=True` are ignored by `simple_download()` #114

Open ebuchlin opened 2 years ago

ebuchlin commented 2 years ago

With the following code

from parfive import Downloader
files = [
    'https://idoc-regards-data.ias.u-psud.fr/SDO_DEM/2012/08/DEM_aia_2012-08-10T00_05.tar',
    'https://idoc-regards-data.ias.u-psud.fr/SDO_DEM/2012/08/DEM_aia_2012-08-10T01_05.tar',
    'https://idoc-regards-data.ias.u-psud.fr/SDO_DEM/2012/08/DEM_aia_2012-08-10T02_05.tar',
    'https://idoc-regards-data.ias.u-psud.fr/SDO_DEM/2012/08/DEM_aia_2012-08-10T03_05.tar',
]
dl = Downloader(progress=False, overwrite=True)
print('With enqueue_file() and download():')
for f in files: dl.enqueue_file(f, path='result')
dl.download()
print('Done')
print('With simple_download():')
dl = Downloader(progress=False, overwrite=True)
dl.simple_download(files, path='result')
print('Done')

the resulting terminal output is

With enqueue_file() and download():
Done
With simple_download():
Files Downloaded: 100%|███████████████████████████████████████████████| 4/4 [00:00<00:00, 31.12file/s]
Done

Then:

Expected behavior: progress=False and overwrite=True should not be ignored by simple_download()

Specifying overwrite=True in the call to simple_download() works, but the expectation is that overwrite from Downloader is inherited by default when calling simple_download() without specifying overwrite.

ebuchlin commented 2 years ago

We just understood that this is because simple_download() is a classmethod, but for some reason I was confused about this.