unprotect: add progress bar (#10152)

* unprotect: add progress bar

* Update pyproject.toml
This commit is contained in:
skshetry
2023-12-12 09:47:35 +05:45
committed by GitHub
parent 77b451d118
commit 3c31234151
3 changed files with 9 additions and 3 deletions
+4 -1
View File
@@ -1092,7 +1092,10 @@ class Output:
def unprotect(self): def unprotect(self):
if self.exists and self.use_cache: if self.exists and self.use_cache:
self.cache.unprotect(self.fs_path) with Callback.as_tqdm_callback(
size=self.meta.nfiles or -1, desc=f"Unprotecting {self}"
) as callback:
self.cache.unprotect(self.fs_path, callback=callback)
def get_dir_cache(self, **kwargs) -> Optional["Tree"]: def get_dir_cache(self, **kwargs) -> Optional["Tree"]:
if not self.is_dir_checksum: if not self.is_dir_checksum:
+4 -1
View File
@@ -447,7 +447,10 @@ class Repo:
return init(root_dir=root_dir, no_scm=no_scm, force=force, subdir=subdir) return init(root_dir=root_dir, no_scm=no_scm, force=force, subdir=subdir)
def unprotect(self, target): def unprotect(self, target):
return self.cache.repo.unprotect(target) from dvc_objects.fs.callbacks import Callback
with Callback.as_tqdm_callback(desc=f"Unprotecting {target}") as callback:
return self.cache.repo.unprotect(target, callback=callback)
def _ignore(self): def _ignore(self):
flist = [self.config.files["local"]] flist = [self.config.files["local"]]
+1 -1
View File
@@ -35,7 +35,7 @@ dependencies = [
"configobj>=5.0.6", "configobj>=5.0.6",
"distro>=1.3", "distro>=1.3",
"dpath<3,>=2.1.0", "dpath<3,>=2.1.0",
"dvc-data>=2.22.6,<2.23.0", "dvc-data>=2.23.1,<2.24",
"dvc-http>=2.29.0", "dvc-http>=2.29.0",
"dvc-render>=1.0.0,<2", "dvc-render>=1.0.0,<2",
"dvc-studio-client>=0.17.1,<1", "dvc-studio-client>=0.17.1,<1",