From aed3451df924a891f94d052e56f2f693e6237015 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sun, 28 Jul 2019 16:38:29 +0100 Subject: [PATCH] pylint --- dvc/progress.py | 7 ++----- dvc/remote/http.py | 4 +++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dvc/progress.py b/dvc/progress.py index 0f5c56794..7f0ab98a3 100644 --- a/dvc/progress.py +++ b/dvc/progress.py @@ -2,7 +2,6 @@ from __future__ import print_function import logging from tqdm import tqdm -from threading import Lock class Tqdm(tqdm): @@ -14,8 +13,7 @@ class Tqdm(tqdm): iterable=None, disable=logging.getLogger( __name__).getEffectiveLevel() >= logging.CRITICAL, - ascii=None, # TODO: True? - bytes=False, + bytes=False, # pylint: disable=W0622 desc_truncate=None, **kwargs): """ @@ -34,7 +32,6 @@ class Tqdm(tqdm): super(Tqdm, self).__init__( iterable=iterable, disable=disable, - ascii=ascii, **kwargs) # self.set_lock(Lock()) @@ -49,7 +46,7 @@ class Tqdm(tqdm): def update_to(self, current, total=None): if total: - self.total = total + self.total = total # pylint: disable=W0613 self.update(current - self.n) @classmethod diff --git a/dvc/remote/http.py b/dvc/remote/http.py index fe778cf7b..64648bdd1 100644 --- a/dvc/remote/http.py +++ b/dvc/remote/http.py @@ -29,13 +29,15 @@ class RemoteHTTP(RemoteBASE): def _download(self, from_info, to_file, name=None, no_progress_bar=False): request = self._request("GET", from_info.url, stream=True) total = self._content_length(from_info.url) + if name is None: + name = from_info.url leave = False # TODO: persistent progress only for "large" files? # if total: # leave = total > self.CHUNK_SIZE * 100 with Tqdm(total=total, leave=leave, bytes=True, - desc_truncate=to_file, + desc_truncate=name, disable=no_progress_bar) as pbar: with open(to_file, "wb") as fd: for chunk in request.iter_content(chunk_size=self.CHUNK_SIZE):