Skip to content

Commit 81def2d

Browse files
author
Jussi Kukkonen
committed
Metadata API: Add missing type annotations
Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
1 parent f458e92 commit 81def2d

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

tuf/api/metadata.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,11 @@ class Signed(metaclass=abc.ABCMeta):
288288

289289
# _type and type are identical: 1st replicates file format, 2nd passes lint
290290
@property
291-
def _type(self):
291+
def _type(self) -> str:
292292
return self._signed_type
293293

294294
@property
295-
def type(self):
295+
def type(self) -> str:
296296
return self._signed_type
297297

298298
# NOTE: Signed is a stupid name, because this might not be signed yet, but
@@ -372,7 +372,7 @@ def _common_fields_to_dict(self) -> Dict[str, Any]:
372372
**self.unrecognized_fields,
373373
}
374374

375-
def is_expired(self, reference_time: datetime = None) -> bool:
375+
def is_expired(self, reference_time: Optional[datetime] = None) -> bool:
376376
"""Checks metadata expiration against a reference time.
377377
378378
Args:
@@ -464,7 +464,7 @@ def verify_signature(
464464
self,
465465
metadata: Metadata,
466466
signed_serializer: Optional[SignedSerializer] = None,
467-
):
467+
) -> None:
468468
"""Verifies that the 'metadata.signatures' contains a signature made
469469
with this key, correctly signing 'metadata.signed'.
470470
@@ -765,7 +765,7 @@ def to_dict(self) -> Dict[str, Any]:
765765

766766
return res_dict
767767

768-
def verify_length_and_hashes(self, data: Union[bytes, BinaryIO]):
768+
def verify_length_and_hashes(self, data: Union[bytes, BinaryIO]) -> None:
769769
"""Verifies that the length and hashes of "data" match expected values.
770770
771771
Args:
@@ -1024,7 +1024,7 @@ def __init__(
10241024
self.unrecognized_fields = unrecognized_fields or {}
10251025

10261026
@property
1027-
def custom(self):
1027+
def custom(self) -> Any:
10281028
if self.unrecognized_fields is None:
10291029
return None
10301030
return self.unrecognized_fields.get("custom", None)
@@ -1046,7 +1046,7 @@ def to_dict(self) -> Dict[str, Any]:
10461046
**self.unrecognized_fields,
10471047
}
10481048

1049-
def verify_length_and_hashes(self, data: Union[bytes, BinaryIO]):
1049+
def verify_length_and_hashes(self, data: Union[bytes, BinaryIO]) -> None:
10501050
"""Verifies that length and hashes of "data" match expected values.
10511051
10521052
Args:

0 commit comments

Comments
 (0)