Skip to content
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
12 changes: 4 additions & 8 deletions tuf/api/dsse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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:
Expand Down
15 changes: 5 additions & 10 deletions tuf/api/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
"""

Expand Down Expand Up @@ -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:
Expand Down
18 changes: 9 additions & 9 deletions tuf/ngclient/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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``.
Expand Down Expand Up @@ -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.
Expand Down
7 changes: 3 additions & 4 deletions tuf/ngclient/requests_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions tuf/ngclient/urllib3_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading