Skip to content

Commit

Permalink
ui: default no_progress_bar=None instead of False
Browse files Browse the repository at this point in the history
Fixes #3314
  • Loading branch information
casperdcl committed Feb 12, 2020
1 parent 7e6e8ee commit e0342a8
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions dvc/remote/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def list_cache_paths(self):
return self._list_paths(self.path_info.bucket, self.path_info.path)

def _upload(
self, from_file, to_info, name=None, no_progress_bar=False, **_kwargs
self, from_file, to_info, name=None, no_progress_bar=None, **_kwargs
):
with Tqdm(desc=name, disable=no_progress_bar, bytes=True) as pbar:
self.blob_service.create_blob_from_path(
Expand All @@ -119,7 +119,7 @@ def _upload(
)

def _download(
self, from_info, to_file, name=None, no_progress_bar=False, **_kwargs
self, from_info, to_file, name=None, no_progress_bar=None, **_kwargs
):
with Tqdm(desc=name, disable=no_progress_bar, bytes=True) as pbar:
self.blob_service.get_blob_to_path(
Expand Down
4 changes: 2 additions & 2 deletions dvc/remote/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def _handle_transfer_exception(
)
return 1

def upload(self, from_info, to_info, name=None, no_progress_bar=False):
def upload(self, from_info, to_info, name=None, no_progress_bar=None):
if not hasattr(self, "_upload"):
raise RemoteActionNotImplemented("upload", self.scheme)

Expand Down Expand Up @@ -593,7 +593,7 @@ def download(
from_info,
to_info,
name=None,
no_progress_bar=False,
no_progress_bar=None,
file_mode=None,
dir_mode=None,
):
Expand Down
2 changes: 1 addition & 1 deletion dvc/remote/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, repo, config):
"files. Use: `dvc remote modify <name> no_traverse true`"
)

def _download(self, from_info, to_file, name=None, no_progress_bar=False):
def _download(self, from_info, to_file, name=None, no_progress_bar=None):
response = self._request("GET", from_info.url, stream=True)
if response.status_code != 200:
raise HTTPError(response.status_code, response.reason)
Expand Down
4 changes: 2 additions & 2 deletions dvc/remote/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def cache_exists(self, checksums, jobs=None, name=None):
]

def _upload(
self, from_file, to_info, name=None, no_progress_bar=False, **_kwargs
self, from_file, to_info, name=None, no_progress_bar=None, **_kwargs
):
makedirs(to_info.parent, exist_ok=True)

Expand All @@ -240,7 +240,7 @@ def _upload(
os.rename(tmp_file, fspath_py35(to_info))

def _download(
self, from_info, to_file, name=None, no_progress_bar=False, **_kwargs
self, from_info, to_file, name=None, no_progress_bar=None, **_kwargs
):
copyfile(
from_info, to_file, no_progress_bar=no_progress_bar, name=name
Expand Down
4 changes: 2 additions & 2 deletions dvc/remote/oss.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ def list_cache_paths(self):
return self._list_paths(self.path_info.path)

def _upload(
self, from_file, to_info, name=None, no_progress_bar=False, **_kwargs
self, from_file, to_info, name=None, no_progress_bar=None, **_kwargs
):
with Tqdm(desc=name, disable=no_progress_bar, bytes=True) as pbar:
self.oss_service.put_object_from_file(
to_info.path, from_file, progress_callback=pbar.update_to
)

def _download(
self, from_info, to_file, name=None, no_progress_bar=False, **_kwargs
self, from_info, to_file, name=None, no_progress_bar=None, **_kwargs
):
with Tqdm(desc=name, disable=no_progress_bar, bytes=True) as pbar:
self.oss_service.get_object_to_file(
Expand Down
4 changes: 2 additions & 2 deletions dvc/remote/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def isdir(self, path_info):
dir_path = path_info / ""
return bool(list(self._list_paths(dir_path, max_items=1)))

def _upload(self, from_file, to_info, name=None, no_progress_bar=False):
def _upload(self, from_file, to_info, name=None, no_progress_bar=None):
total = os.path.getsize(from_file)
with Tqdm(
disable=no_progress_bar, total=total, bytes=True, desc=name
Expand All @@ -280,7 +280,7 @@ def _upload(self, from_file, to_info, name=None, no_progress_bar=False):
ExtraArgs=self.extra_args,
)

def _download(self, from_info, to_file, name=None, no_progress_bar=False):
def _download(self, from_info, to_file, name=None, no_progress_bar=None):
if no_progress_bar:
total = None
else:
Expand Down
4 changes: 2 additions & 2 deletions dvc/remote/ssh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def move(self, from_info, to_info):
with self.ssh(from_info) as ssh:
ssh.move(from_info.path, to_info.path)

def _download(self, from_info, to_file, name=None, no_progress_bar=False):
def _download(self, from_info, to_file, name=None, no_progress_bar=None):
assert from_info.isin(self.path_info)
with self.ssh(self.path_info) as ssh:
ssh.download(
Expand All @@ -235,7 +235,7 @@ def _download(self, from_info, to_file, name=None, no_progress_bar=False):
no_progress_bar=no_progress_bar,
)

def _upload(self, from_file, to_info, name=None, no_progress_bar=False):
def _upload(self, from_file, to_info, name=None, no_progress_bar=None):
assert to_info.isin(self.path_info)
with self.ssh(self.path_info) as ssh:
ssh.upload(
Expand Down
4 changes: 2 additions & 2 deletions dvc/remote/ssh/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def remove(self, path):
else:
self._remove_file(path)

def download(self, src, dest, no_progress_bar=False, progress_title=None):
def download(self, src, dest, no_progress_bar=None, progress_title=None):
with Tqdm(
desc=progress_title or os.path.basename(src),
disable=no_progress_bar,
Expand Down Expand Up @@ -202,7 +202,7 @@ def atomic_copy(self, src, dst):
finally:
self.remove(tmp)

def upload(self, src, dest, no_progress_bar=False, progress_title=None):
def upload(self, src, dest, no_progress_bar=None, progress_title=None):
self.makedirs(posixpath.dirname(dest))
tmp_file = tmp_fname(dest)
if not progress_title:
Expand Down
2 changes: 1 addition & 1 deletion dvc/utils/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def makedirs(path, exist_ok=False, mode=None):
os.umask(umask)


def copyfile(src, dest, no_progress_bar=False, name=None):
def copyfile(src, dest, no_progress_bar=None, name=None):
"""Copy file with progress bar"""
from dvc.exceptions import DvcException
from dvc.progress import Tqdm
Expand Down

0 comments on commit e0342a8

Please sign in to comment.