diff --git a/tuf/api/dsse.py b/tuf/api/dsse.py index dc16cf79fc..88b8299b7c 100644 --- a/tuf/api/dsse.py +++ b/tuf/api/dsse.py @@ -71,8 +71,7 @@ def from_bytes(cls, data: bytes) -> SimpleEnvelope[T]: data: envelope JSON bytes. Raises: - tuf.api.serialization.DeserializationError: - data cannot be deserialized. + DeserializationError: data cannot be deserialized. Returns: TUF ``SimpleEnvelope`` object. @@ -94,8 +93,7 @@ def to_bytes(self) -> bytes: serialize a ``Signed`` object and wrap it in an SimpleEnvelope. Raises: - tuf.api.serialization.SerializationError: - self cannot be serialized. + SerializationError: self cannot be serialized. """ try: envelope_dict = self.to_dict() @@ -114,8 +112,7 @@ def from_signed(cls, signed: T) -> SimpleEnvelope[T]: signed: ``Signed`` object. Raises: - tuf.api.serialization.SerializationError: - The signed object cannot be serialized. + SerializationError: The signed object cannot be serialized. """ try: signed_dict = signed.to_dict() @@ -130,8 +127,7 @@ def get_signed(self) -> T: """Extract and deserialize payload JSON bytes from envelope. Raises: - tuf.api.serialization.DeserializationError: - The signed object cannot be deserialized. + DeserializationError: The signed object cannot be deserialized. """ try: diff --git a/tuf/api/metadata.py b/tuf/api/metadata.py index 23a498932e..54a311a5a3 100644 --- a/tuf/api/metadata.py +++ b/tuf/api/metadata.py @@ -228,8 +228,7 @@ def from_file( Raises: StorageError: The file cannot be read. - tuf.api.serialization.DeserializationError: - The file cannot be deserialized. + DeserializationError: The file cannot be deserialized. Returns: TUF ``Metadata`` object. @@ -255,8 +254,7 @@ def from_bytes( Default is ``JSONDeserializer``. Raises: - tuf.api.serialization.DeserializationError: - The file cannot be deserialized. + DeserializationError: The file cannot be deserialized. Returns: TUF ``Metadata`` object. @@ -285,8 +283,7 @@ def to_bytes(self, serializer: MetadataSerializer | None = None) -> bytes: desired serialization format. Default is ``JSONSerializer``. Raises: - tuf.api.serialization.SerializationError: - The metadata object cannot be serialized. + SerializationError: The metadata object cannot be serialized. """ if serializer is None: @@ -331,8 +328,7 @@ def to_file( is ``FilesystemBackend`` (i.e. a local file). Raises: - tuf.api.serialization.SerializationError: - The metadata object cannot be serialized. + SerializationError: The metadata object cannot be serialized. StorageError: The file cannot be written. """ @@ -364,8 +360,7 @@ def sign( serialization format. Default is ``CanonicalJSONSerializer``. Raises: - tuf.api.serialization.SerializationError: - ``signed`` cannot be serialized. + SerializationError: ``signed`` cannot be serialized. UnsignedMetadataError: Signing errors. Returns: diff --git a/tuf/ngclient/fetcher.py b/tuf/ngclient/fetcher.py index ae583b537a..8f1228ebc1 100644 --- a/tuf/ngclient/fetcher.py +++ b/tuf/ngclient/fetcher.py @@ -43,7 +43,7 @@ def _fetch(self, url: str) -> Iterator[bytes]: url: URL string that represents a file location. Raises: - exceptions.DownloadHTTPError: HTTP error code was received. + DownloadHTTPError: HTTP error code was received. Returns: Bytes iterator @@ -57,8 +57,8 @@ def fetch(self, url: str) -> Iterator[bytes]: url: URL string that represents a file location. Raises: - exceptions.DownloadError: An error occurred during download. - exceptions.DownloadHTTPError: An HTTP error code was received. + DownloadError: An error occurred during download. + DownloadHTTPError: An HTTP error code was received. Returns: Bytes iterator @@ -85,10 +85,10 @@ def download_file(self, url: str, max_length: int) -> Iterator[IO]: max_length: Upper bound of file size in bytes. Raises: - exceptions.DownloadError: An error occurred during download. - exceptions.DownloadLengthMismatchError: Downloaded bytes exceed + DownloadError: An error occurred during download. + DownloadLengthMismatchError: Downloaded bytes exceed ``max_length``. - exceptions.DownloadHTTPError: An HTTP error code was received. + DownloadHTTPError: An HTTP error code was received. Yields: ``TemporaryFile`` object that points to the contents of ``url``. @@ -128,10 +128,10 @@ def download_bytes(self, url: str, max_length: int) -> bytes: max_length: Upper bound of data size in bytes. Raises: - exceptions.DownloadError: An error occurred during download. - exceptions.DownloadLengthMismatchError: Downloaded bytes exceed + DownloadError: An error occurred during download. + DownloadLengthMismatchError: Downloaded bytes exceed ``max_length``. - exceptions.DownloadHTTPError: An HTTP error code was received. + DownloadHTTPError: An HTTP error code was received. Returns: Content of the file in bytes. diff --git a/tuf/ngclient/requests_fetcher.py b/tuf/ngclient/requests_fetcher.py index 6edc699d9d..b627582b1c 100644 --- a/tuf/ngclient/requests_fetcher.py +++ b/tuf/ngclient/requests_fetcher.py @@ -76,9 +76,8 @@ def _fetch(self, url: str) -> Iterator[bytes]: url: URL string that represents a file location. Raises: - exceptions.SlowRetrievalError: Timeout occurs while receiving - data. - exceptions.DownloadHTTPError: HTTP error code is received. + SlowRetrievalError: Timeout occurs while receiving data. + DownloadHTTPError: HTTP error code is received. Returns: Bytes iterator @@ -133,7 +132,7 @@ def _get_session(self, url: str) -> requests.Session: combination. Raises: - exceptions.DownloadError: When there is a problem parsing the url. + DownloadError: When there is a problem parsing the url. """ # Use a different requests.Session per schema+hostname combination, to # reuse connections while minimizing subtle security issues. diff --git a/tuf/ngclient/urllib3_fetcher.py b/tuf/ngclient/urllib3_fetcher.py index 63cd9916d2..baec8fe9df 100644 --- a/tuf/ngclient/urllib3_fetcher.py +++ b/tuf/ngclient/urllib3_fetcher.py @@ -59,9 +59,8 @@ def _fetch(self, url: str) -> Iterator[bytes]: url: URL string that represents a file location. Raises: - exceptions.SlowRetrievalError: Timeout occurs while receiving - data. - exceptions.DownloadHTTPError: HTTP error code is received. + SlowRetrievalError: Timeout occurs while receiving data. + DownloadHTTPError: HTTP error code is received. Returns: Bytes iterator