01.09.17 14:50, Tarek Ziadé пише:
For large archives, I want to display a progress bar while the archive is being extracted with:
I could write my own version of extractall() to do this, or maybe we could introduce a callback option that gets called everytime .extract() is called in extractall()
The callback can receive the tarinfo object and where it's being extracted. This is enough to plug a progress bar and avoid reinventing .extractall()
This is not enough if extract large files. In that case you perhaps want to update the progress bar more often.
If add this feature to tarfile, it may be worth to add it to zipfile and shutil functions (copytree, rmtree). And if call a callback for every extracted/copied entity, it may be worth to use its result for filtering.