Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions dvc/fs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from multiprocessing import cpu_count
from typing import Any, ClassVar, Dict, FrozenSet, Optional

from funcy import cached_property
from tqdm.utils import CallbackIOWrapper

from dvc.exceptions import DvcException
Expand Down Expand Up @@ -223,12 +222,6 @@ def is_dir_hash(cls, hash_):
return False
return hash_.endswith(cls.CHECKSUM_DIR_SUFFIX)

@cached_property
def _local_fs(self):
from dvc.fs import LocalFileSystem

return LocalFileSystem()

def upload(
self,
from_info,
Expand Down Expand Up @@ -260,7 +253,7 @@ def upload(
**pbar_args,
)
stack.enter_context(pbar)
callback = pbar.as_callback(self._local_fs, from_info)
callback = pbar.as_callback()
if total:
callback.set_size(total)

Expand Down Expand Up @@ -321,7 +314,7 @@ def download(
**pbar_kwargs,
)
stack.enter_context(pbar)
callback = pbar.as_callback(self, from_info)
callback = pbar.as_callback()

with stack:
if download_dir:
Expand Down
4 changes: 0 additions & 4 deletions dvc/fs/fsspec_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from dvc.progress import DEFAULT_CALLBACK

from .base import BaseFileSystem
from .local import LocalFileSystem


# pylint: disable=no-member
Expand Down Expand Up @@ -238,9 +237,6 @@ def ls(self, *args, **kwargs):
raise NotImplementedError


_LOCAL_FS = LocalFileSystem()


class CallbackMixin:
"""Provides callback support for the filesystem that don't support yet."""

Expand Down
20 changes: 7 additions & 13 deletions dvc/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def wrapped(*args, **kwargs):

return wrapped

def as_callback(self, fs, path_info):
return FsspecCallback(fs, path_info, self)
def as_callback(self):
return FsspecCallback(self)

def close(self):
self.postfix["info"] = ""
Expand Down Expand Up @@ -167,21 +167,15 @@ def format_dict(self):


class FsspecCallback(fsspec.Callback):
def __init__(self, fs, path_info, progress_bar):
self.fs = fs
self.path_info = path_info
def __init__(self, progress_bar):
self.progress_bar = progress_bar
super().__init__()

def set_size(self, size):
"""``set_size()`` is an API that might be called with ``None`` if the
information is not already present on the caller. In that case, we'll
retrieve the size from an ``info()`` call."""
if size is None:
size = self.fs.info(self.path_info)["size"]
self.progress_bar.total = size
self.progress_bar.refresh()
super().set_size(size)
if size is not None:
self.progress_bar.total = size
self.progress_bar.refresh()
super().set_size(size)
Comment on lines +175 to +178
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So looks like we no longer need self.fs and self.path_info anymore?


def relative_update(self, inc=1):
self.progress_bar.update(inc)
Expand Down