MCPcopy
hub / github.com/treeverse/dvc / DVCFileSystem

Class DVCFileSystem

dvc/fs/dvc.py:667–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665
666
667class DVCFileSystem(FileSystem):
668 protocol = "local"
669 PARAM_CHECKSUM = "md5"
670
671 def _prepare_credentials(self, **config) -> dict[str, Any]:
672 return config
673
674 @functools.cached_property
675 def fs(self) -> "_DVCFileSystem":
676 return _DVCFileSystem(**self.fs_args)
677
678 @property
679 def immutable(self):
680 from dvc.scm import NoSCM
681
682 if isinstance(self.fs.repo.scm, NoSCM):
683 return False
684
685 return self.fs._repo_kwargs.get("rev") == self.fs.repo.get_rev()
686
687 def getcwd(self):
688 return self.fs.getcwd()
689
690 def _get(
691 self,
692 from_info: Union[AnyFSPath, list[AnyFSPath]],
693 to_info: Union[AnyFSPath, list[AnyFSPath]],
694 callback: "Callback" = DEFAULT_CALLBACK,
695 recursive: bool = False,
696 batch_size: Optional[int] = None,
697 **kwargs,
698 ) -> list[tuple[str, str, Optional[dict]]]:
699 # FileSystem.get is non-recursive by default if arguments are lists
700 # otherwise, it's recursive.
701 recursive = not (isinstance(from_info, list) and isinstance(to_info, list))
702 return self.fs._get(
703 from_info,
704 to_info,
705 callback=callback,
706 recursive=recursive,
707 batch_size=batch_size,
708 **kwargs,
709 )
710
711 def get(
712 self,
713 from_info: Union[AnyFSPath, list[AnyFSPath]],
714 to_info: Union[AnyFSPath, list[AnyFSPath]],
715 callback: "Callback" = DEFAULT_CALLBACK,
716 recursive: bool = False,
717 batch_size: Optional[int] = None,
718 **kwargs,
719 ) -> None:
720 self._get(
721 from_info,
722 to_info,
723 callback=callback,
724 batch_size=batch_size,

Callers 15

_collect_pathsFunction · 0.90
dvcfsMethod · 0.90
_openFunction · 0.90
_make_fsMethod · 0.90
dvcfsFunction · 0.90
test_existsFunction · 0.90
test_openFunction · 0.90
test_open_dirty_hashFunction · 0.90
test_open_dirty_no_hashFunction · 0.90
test_open_in_historyFunction · 0.90
test_isdir_isfileFunction · 0.90

Calls

no outgoing calls

Tested by 15

dvcfsFunction · 0.72
test_existsFunction · 0.72
test_openFunction · 0.72
test_open_dirty_hashFunction · 0.72
test_open_dirty_no_hashFunction · 0.72
test_open_in_historyFunction · 0.72
test_isdir_isfileFunction · 0.72
test_isdir_mixedFunction · 0.72
test_ls_dirtyFunction · 0.72
test_ls_file_not_foundFunction · 0.72
test_ls_dir_emptyFunction · 0.72