deps: bump dvc-data to 0.18.0

- callbacks: update to dvc-data 0.18.0 behavior
This commit is contained in:
Peter Rowlands
2022-10-13 20:00:19 +09:00
committed by Peter Rowlands (변기호)
parent add28f73f1
commit ed87c308ba
4 changed files with 25 additions and 13 deletions
+9 -3
View File
@@ -1,6 +1,6 @@
# pylint: disable=unused-import
from contextlib import ExitStack
from typing import TYPE_CHECKING, Optional
from typing import TYPE_CHECKING, Any, BinaryIO, Dict, Optional, Union
from funcy import cached_property
@@ -75,10 +75,16 @@ class RichCallback(Callback):
visible=not self.disable,
)
def branch(self, path_1, path_2, kwargs, child: Optional[Callback] = None):
def branch(
self,
path_1: Union[str, BinaryIO],
path_2: str,
kwargs: Dict[str, Any],
child: "Callback" = None,
):
child = child or RichCallback(
progress=self.progress,
desc=path_1,
desc=path_1 if isinstance(path_1, str) else path_2,
bytes=True,
transient=self._transient,
)
+7 -4
View File
@@ -30,6 +30,7 @@ from dvc_objects.errors import ObjectFormatError
from .annotations import ANNOTATION_FIELDS, ANNOTATION_SCHEMA, Annotation
from .fs import LocalFileSystem, RemoteMissingDepsError, Schemes, get_cloud_fs
from .fs.callbacks import DEFAULT_CALLBACK
from .utils import relpath
from .utils.fs import path_isin
@@ -38,6 +39,8 @@ if TYPE_CHECKING:
from dvc_data.index import DataIndexKey
from dvc_objects.db import ObjectDB
from .fs.callbacks import Callback
logger = logging.getLogger(__name__)
@@ -827,7 +830,7 @@ class Output:
def checkout(
self,
force=False,
progress_callback=None,
progress_callback: "Callback" = DEFAULT_CALLBACK,
relink=False,
filter_info=None,
allow_missing=False,
@@ -835,9 +838,9 @@ class Output:
**kwargs,
):
if not self.use_cache:
if progress_callback:
progress_callback(
self.fs_path, self.get_files_number(filter_info)
if progress_callback != DEFAULT_CALLBACK:
progress_callback.relative_update(
self.get_files_number(filter_info)
)
return None
+8 -5
View File
@@ -7,7 +7,6 @@ from dvc.exceptions import (
CheckoutErrorSuggestGit,
NoOutputOrStageError,
)
from dvc.progress import Tqdm
from dvc.utils import relpath
from . import locked
@@ -80,6 +79,7 @@ def checkout(
allow_missing=False,
**kwargs,
):
from dvc.fs.callbacks import Callback
stats = {"added": [], "deleted": [], "modified": [], "failed": []}
if not targets:
@@ -91,13 +91,16 @@ def checkout(
pairs = _collect_pairs(self, targets, with_deps, recursive)
total = get_all_files_numbers(pairs)
with Tqdm(
total=total, unit="file", desc="Checkout", disable=total == 0
) as pbar:
with Callback.as_tqdm_callback(
unit="file",
desc="Checkout",
disable=total == 0,
) as cb:
cb.set_size(total)
for stage, filter_info in pairs:
result = stage.checkout(
force=force,
progress_callback=pbar.update_msg,
progress_callback=cb,
relink=relink,
filter_info=filter_info,
allow_missing=allow_missing,
+1 -1
View File
@@ -67,7 +67,7 @@ install_requires =
dvc-render==0.0.12
dvc-task==0.1.3
dvclive>=0.10.0
dvc-data==0.17.1
dvc-data==0.18.0
dvc-http==2.27.2
hydra-core>=1.1.0
iterative-telemetry==0.0.5