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

Method get_dir_cache

dvc/output.py:1086–1111  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

1084 self.cache.unprotect(self.fs_path, callback=callback)
1085
1086 def get_dir_cache(self, **kwargs) -> Optional["Tree"]:
1087 if not self.is_dir_checksum:
1088 raise DvcException("cannot get dir cache for file checksum")
1089
1090 obj = self.cache.get(self.hash_info.value)
1091 try:
1092 ocheck(self.cache, obj)
1093 except FileNotFoundError:
1094 if self.remote:
1095 kwargs["remote"] = self.remote
1096 with suppress(Exception):
1097 assert self.repo
1098 self.repo.cloud.pull([obj.hash_info], **kwargs)
1099
1100 if self.obj:
1101 assert isinstance(self.obj, Tree)
1102 return self.obj
1103
1104 try:
1105 obj = oload(self.cache, self.hash_info)
1106 assert isinstance(obj, Tree)
1107 except (FileNotFoundError, ObjectFormatError):
1108 obj = None
1109
1110 self.obj = obj
1111 return obj
1112
1113 def _collect_used_dir_cache(
1114 self, remote=None, force=False, jobs=None, filter_info=None

Callers 3

unstageMethod · 0.95
applyMethod · 0.95

Calls 3

DvcExceptionClass · 0.90
getMethod · 0.45
pullMethod · 0.45

Tested by

no test coverage detected