From a7ce9e79bbc81b5abfde4b8e99e95d039a092baa Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 16 May 2019 16:52:32 -0300 Subject: Cleanup --- ckandumper | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ckandumper b/ckandumper index 121f33b..a7464d8 100755 --- a/ckandumper +++ b/ckandumper @@ -119,13 +119,14 @@ class DownloadMultiple: return proc.returncode - async def gather(self, filepairs, progress_bar): + async def gather(self, filepairs): """Gather all files to be downloaded See https://stackoverflow.com/questions/50308812/is-it-possible-to-limit-the-number-of-coroutines-running-corcurrently-in-asyncio#50328882 """ - jobs = [] + jobs = [] + progress_bar = tqdm(total=len(filepairs)) if self.progress and len(filepairs) > 1 else False for url, filename in filepairs: jobs.append(asyncio.ensure_future(self.download_file(url, filename, self.limit_concurrent, progress_bar))) @@ -133,12 +134,11 @@ class DownloadMultiple: await asyncio.gather(*jobs) def get(self, filepairs): - self.stats = { 'exitstatus': {} } - progress_bar = tqdm(total=len(filepairs)) if self.progress and len(filepairs) > 1 else False - loop = asyncio.get_event_loop() + self.stats = { 'exitstatus': {} } + loop = asyncio.get_event_loop() loop.set_debug(self.debug) - loop.run_until_complete(self.gather(filepairs, progress_bar)) + loop.run_until_complete(self.gather(filepairs)) if self.debug: print(self.stats) -- cgit v1.2.3