From 17c25e29ae32b148fe162a3239efcf1befa8c5b7 Mon Sep 17 00:00:00 2001 From: Lukas Puehringer Date: Fri, 5 Mar 2021 12:33:24 +0100 Subject: [PATCH] Fix blank lines in tuf.api as per styleguide https://github.com/google/styleguide/blob/gh-pages/pyguide.md#35-blank-lines Signed-off-by: Lukas Puehringer --- tuf/api/metadata.py | 8 -------- tuf/api/serialization/__init__.py | 2 ++ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/tuf/api/metadata.py b/tuf/api/metadata.py index 2b183ed32e..1bd2535487 100644 --- a/tuf/api/metadata.py +++ b/tuf/api/metadata.py @@ -266,7 +266,6 @@ def verify(self, key: Mapping[str, Any], signed_serializer.serialize(self.signed)) - class Signed: """A base class for the signed part of TUF metadata. @@ -281,12 +280,10 @@ class Signed: metadata format adheres to. expires: The metadata expiration datetime object. - """ # NOTE: Signed is a stupid name, because this might not be signed yet, but # we keep it to match spec terminology (I often refer to this as "payload", # or "inner metadata") - def __init__( self, _type: str, version: int, spec_version: str, expires: datetime) -> None: @@ -333,13 +330,11 @@ def _common_fields_to_dict(self) -> Dict[str, Any]: 'expires': self.expires.isoformat() + 'Z' } - # Modification. def bump_expiration(self, delta: timedelta = timedelta(days=1)) -> None: """Increments the expires attribute by the passed timedelta. """ self.expires += delta - def bump_version(self) -> None: """Increments the metadata version number by 1.""" self.version += 1 @@ -420,7 +415,6 @@ def add_key(self, role: str, keyid: str, self.roles[role]['keyids'].append(keyid) self.keys[keyid] = key_metadata - # Remove key for a role. def remove_key(self, role: str, keyid: str) -> None: """Removes key for 'role' and updates the key store. """ @@ -433,8 +427,6 @@ def remove_key(self, role: str, keyid: str) -> None: del self.keys[keyid] - - class Timestamp(Signed): """A container for the signed part of timestamp metadata. diff --git a/tuf/api/serialization/__init__.py b/tuf/api/serialization/__init__.py index 6089add4ac..d7b473b2c4 100644 --- a/tuf/api/serialization/__init__.py +++ b/tuf/api/serialization/__init__.py @@ -16,10 +16,12 @@ """ import abc + # TODO: Should these be in tuf.exceptions or inherit from tuf.exceptions.Error? class SerializationError(Exception): """Error during serialization. """ + class DeserializationError(Exception): """Error during deserialization. """