Skip to content

Commit ffff7f5

Browse files
author
Jussi Kukkonen
committed
ngclient: Improve dosctrings and error messages
Signed-off-by: Jussi Kukkonen <[email protected]>
1 parent 1b404f3 commit ffff7f5

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

tuf/ngclient/_internal/trusted_metadata_set.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ def update_snapshot(self, data: bytes): # pylint: disable=too-many-branches
353353
!= self.timestamp.signed.meta["snapshot.json"].version
354354
):
355355
raise exceptions.BadVersionNumberError(
356-
f"Expected snapshot version"
357-
f"{self.timestamp.signed.meta['snapshot.json'].version},"
356+
f"Expected snapshot version "
357+
f"{self.timestamp.signed.meta['snapshot.json'].version}, "
358358
f"got {new_snapshot.signed.version}"
359359
)
360360

@@ -373,8 +373,8 @@ def update_snapshot(self, data: bytes): # pylint: disable=too-many-branches
373373
# Prevent rollback of any metadata versions
374374
if new_fileinfo.version < fileinfo.version:
375375
raise exceptions.BadVersionNumberError(
376-
f"Expected {filename} version"
377-
f"{new_fileinfo.version}, got {fileinfo.version}"
376+
f"Expected {filename} version "
377+
f"{new_fileinfo.version}, got {fileinfo.version}."
378378
)
379379

380380
if new_snapshot.signed.is_expired(self.reference_time):
@@ -403,7 +403,7 @@ def update_delegated_targets(
403403
Args:
404404
data: unverified new metadata as bytes
405405
role_name: The role name of the new metadata
406-
delegator_name: The name of the role delegating the new metadata
406+
delegator_name: The name of the role delegating to the new metadata
407407
408408
Raises:
409409
RepositoryError: Metadata failed to load or verify. The actual
@@ -452,8 +452,8 @@ def update_delegated_targets(
452452

453453
if new_delegate.signed.version != meta.version:
454454
raise exceptions.BadVersionNumberError(
455-
f"Expected {role_name} version"
456-
f"{meta.version}, got {new_delegate.signed.version}"
455+
f"Expected {role_name} version "
456+
f"{meta.version}, got {new_delegate.signed.version}."
457457
)
458458

459459
if new_delegate.signed.is_expired(self.reference_time):

tuf/ngclient/updater.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
logger = logging.getLogger(__name__)
3434

35-
# Classes
35+
3636
class Updater:
3737
"""
3838
An implemetation of the TUF client workflow.
@@ -79,7 +79,7 @@ def __init__(
7979
def refresh(self) -> None:
8080
"""
8181
This method downloads, verifies, and loads metadata for the top-level
82-
roles in a specific order (root -> timestamp -> snapshot -> targets)
82+
roles in the specified order (root -> timestamp -> snapshot -> targets)
8383
The expiration time for downloaded metadata is also verified.
8484
8585
The metadata for delegated roles are not refreshed by this method, but
@@ -104,8 +104,8 @@ def get_one_valid_targetinfo(self, target_path: str) -> Dict:
104104
"""
105105
Returns the target information for a target identified by target_path.
106106
107-
As a side-effect this method downloads all the metadata it needs to
108-
return the target information.
107+
As a side-effect this method downloads all the additional (delegated
108+
targets) metadata required to return the target information.
109109
110110
Args:
111111
target_path: A target identifier that is a path-relative-URL string

0 commit comments

Comments
 (0)