You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, models.StreamingBody.write() includes logic for reporting as well as downloading. Change this so that the function uses a callback provided as an argument. To help the user, implement the recommended callback in the reporting module.
The text was updated successfully, but these errors were encountered:
classFileDownloadBar(ProgressBar):
"""Bar reporter of file download progress. Example: ```python from planet import reporting with reporting.FileDownloadBar('img.tif', 100000) as bar: bar.update(1000) ... ``` """def__init__(
self,
filename: str,
size: int,
unit: int=None,
disable: bool=False
):
"""Initialize the object. Parameters: filename: Name of file to display. size: File size in bytes. unit: Value to scale number of report iterations. (e.g. 1024*1024 scales to reporting in Megabytes.) """self.filename=filenameself.size=sizeself.unit=unitor1024*1024super().__init__()
defopen_bar(self):
"""Initialize and start the progress bar."""self.bar=tqdm(
total=self.size,
unit_scale=True,
unit_divisor=self.unit,
unit='B',
desc=self.filename,
disable=self.disable)
defupdate(self, downloaded_amt, logger=None):
self.bar.update(downloaded_amt)
LOGGER.debug(str(self.bar))
Currently,
models.StreamingBody.write()
includes logic for reporting as well as downloading. Change this so that the function uses a callback provided as an argument. To help the user, implement the recommended callback in thereporting
module.The text was updated successfully, but these errors were encountered: