From c3411dc59e82d030d9e4f10ffc4b7d2f6ab4cf49 Mon Sep 17 00:00:00 2001 From: Jussi Kukkonen Date: Fri, 3 Mar 2023 10:52:03 +0200 Subject: [PATCH] repository: Rename snapshot()/timestamp() New names: do_snapshot() do_timestamp() This is in preparation of using the old names for another purpose. Signed-off-by: Jussi Kukkonen --- examples/repository/_simplerepo.py | 12 ++++++------ tuf/repository/_repository.py | 8 ++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/repository/_simplerepo.py b/examples/repository/_simplerepo.py index fd27c86a..b315fed8 100644 --- a/examples/repository/_simplerepo.py +++ b/examples/repository/_simplerepo.py @@ -133,8 +133,8 @@ def add_target(self, path: str, content: str) -> None: logger.debug("Targets v%d", targets.version) # update snapshot, timestamp - self.snapshot() - self.timestamp() + self.do_snapshot() + self.do_timestamp() def submit_delegation(self, rolename: str, data: bytes) -> bool: """Add a delegation to a (offline signed) delegated targets metadata""" @@ -159,8 +159,8 @@ def submit_delegation(self, rolename: str, data: bytes) -> bool: logger.debug("Targets v%d", targets.version) # update snapshot, timestamp - self.snapshot() - self.timestamp() + self.do_snapshot() + self.do_timestamp() return True @@ -201,7 +201,7 @@ def submit_role(self, role: str, data: bytes) -> bool: self.target_cache[targetpath] = bytes(f"{targetpath}", "utf-8") # update snapshot, timestamp - self.snapshot() - self.timestamp() + self.do_snapshot() + self.do_timestamp() return True diff --git a/tuf/repository/_repository.py b/tuf/repository/_repository.py index 9efb994b..e1c12f1e 100644 --- a/tuf/repository/_repository.py +++ b/tuf/repository/_repository.py @@ -134,7 +134,9 @@ def edit_targets(self, rolename: str) -> Generator[Targets, None, None]: raise RuntimeError(f"Unexpected Targets ({rolename}) type") yield targets - def snapshot(self, force: bool = False) -> Tuple[bool, Dict[str, MetaFile]]: + def do_snapshot( + self, force: bool = False + ) -> Tuple[bool, Dict[str, MetaFile]]: """Update snapshot meta information Updates the snapshot meta information according to current targets @@ -182,7 +184,9 @@ def snapshot(self, force: bool = False) -> Tuple[bool, Dict[str, MetaFile]]: return update_version, removed - def timestamp(self, force: bool = False) -> Tuple[bool, Optional[MetaFile]]: + def do_timestamp( + self, force: bool = False + ) -> Tuple[bool, Optional[MetaFile]]: """Update timestamp meta information Updates timestamp according to current snapshot state