Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote: small .save_info()/.get_checksum() cleanup #2835

Merged
merged 1 commit into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions dvc/output/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,7 @@ def exists(self):
return self.remote.exists(self.path_info)

def changed_checksum(self):
return (
self.checksum
!= self.remote.save_info(self.path_info)[
self.remote.PARAM_CHECKSUM
]
)
return self.checksum != self.remote.get_checksum(self.path_info)

def changed_cache(self):
if not self.use_cache or not self.checksum:
Expand Down
5 changes: 3 additions & 2 deletions dvc/remote/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ def is_dir_checksum(cls, checksum):
return checksum.endswith(cls.CHECKSUM_DIR_SUFFIX)

def get_checksum(self, path_info):
assert path_info.scheme == self.scheme

if not self.exists(path_info):
return None

Expand Down Expand Up @@ -322,7 +324,6 @@ def get_checksum(self, path_info):
return checksum

def save_info(self, path_info):
assert path_info.scheme == self.scheme
return {self.PARAM_CHECKSUM: self.get_checksum(path_info)}

def changed(self, path_info, checksum_info):
Expand Down Expand Up @@ -363,7 +364,7 @@ def changed(self, path_info, checksum_info):
)
return True

actual = self.save_info(path_info)[self.PARAM_CHECKSUM]
actual = self.get_checksum(path_info)
if checksum != actual:
logger.debug(
"checksum '{}'(actual '{}') for '{}' has changed.".format(
Expand Down