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

Method save

dvc/output.py:682–727  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

680 self.repo.scm_context.ignore_remove(self.fspath)
681
682 def save(self) -> None:
683 if self.use_cache and not self.is_in_repo:
684 raise DvcException(
685 f"Saving cached external output {self!s} is not supported "
686 "since DVC 3.0. See "
687 f"{format_link('https://dvc.org/doc/user-guide/upgrade')} "
688 "for more info."
689 )
690
691 if not self.exists:
692 raise self.DoesNotExistError(self)
693
694 if not self.isfile() and not self.isdir():
695 raise self.IsNotFileOrDirError(self)
696
697 if self.is_empty:
698 logger.warning("'%s' is empty.", self)
699
700 self.ignore()
701
702 if self.metric:
703 self.verify_metric()
704
705 self.update_legacy_hash_name()
706 if self.use_cache:
707 _, self.meta, self.obj = self._build(
708 self.cache,
709 self.fs_path,
710 self.fs,
711 self.hash_name,
712 ignore=self.dvcignore,
713 )
714 else:
715 _, self.meta, self.obj = self._build(
716 self.local_cache,
717 self.fs_path,
718 self.fs,
719 self.hash_name,
720 ignore=self.dvcignore,
721 dry_run=True,
722 )
723 if not self.IS_DEPENDENCY:
724 logger.debug("Output '%s' doesn't use cache. Skipping saving.", self)
725
726 self.hash_info = self.obj.hash_info
727 self.files = None
728
729 def update_legacy_hash_name(self, force: bool = False):
730 if self.hash_name == "md5-dos2unix" and (force or self.changed_checksum()):

Callers 15

moveMethod · 0.95
test_save_missingFunction · 0.95
viztracer_profileFunction · 0.45
yappi_profileFunction · 0.45
test_stateFunction · 0.45
test_auto_push_on_saveFunction · 0.45
test_exp_save_unchangedFunction · 0.45
test_exp_saveFunction · 0.45

Calls 8

isfileMethod · 0.95
isdirMethod · 0.95
ignoreMethod · 0.95
verify_metricMethod · 0.95
_buildMethod · 0.95
DvcExceptionClass · 0.90
format_linkFunction · 0.90

Tested by 15

test_save_missingFunction · 0.76
test_stateFunction · 0.36
test_auto_push_on_saveFunction · 0.36
test_exp_save_unchangedFunction · 0.36
test_exp_saveFunction · 0.36