Skip to content

Commit 7028110

Browse files
committed
Annotation tweaks: Keep mypy happy
The existing annotations probably should work... but currently they make mypy unhappy. Signed-off-by: Jussi Kukkonen <[email protected]>
1 parent a623010 commit 7028110

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

sigstore/_internal/trust.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ class Key:
9393
key: PublicKey
9494
key_id: KeyID
9595

96-
_RSA_SHA_256_DETAILS: ClassVar[set[_PublicKeyDetails]] = {
96+
_RSA_SHA_256_DETAILS: ClassVar = {
9797
_PublicKeyDetails.PKCS1_RSA_PKCS1V5,
9898
_PublicKeyDetails.PKIX_RSA_PKCS1V15_2048_SHA256,
9999
_PublicKeyDetails.PKIX_RSA_PKCS1V15_3072_SHA256,
100100
_PublicKeyDetails.PKIX_RSA_PKCS1V15_4096_SHA256,
101101
}
102102

103-
_EC_DETAILS_TO_HASH: ClassVar[dict[_PublicKeyDetails, hashes.HashAlgorithm]] = {
103+
_EC_DETAILS_TO_HASH: ClassVar = {
104104
_PublicKeyDetails.PKIX_ECDSA_P256_SHA_256: hashes.SHA256(),
105105
_PublicKeyDetails.PKIX_ECDSA_P384_SHA_384: hashes.SHA384(),
106106
_PublicKeyDetails.PKIX_ECDSA_P521_SHA_512: hashes.SHA512(),

sigstore/models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,10 @@ def _from_parts(
667667

668668
# Fill in the appropriate variants.
669669
if isinstance(content, common_v1.MessageSignature):
670-
content = {"message_signature": content}
670+
# mypy will be mystified if types are specified here
671+
content_dict: dict[str, Any] = {"message_signature": content}
671672
else:
672-
content = {"dsse_envelope": content._inner}
673+
content_dict = {"dsse_envelope": content._inner}
673674

674675
inner = _Bundle(
675676
media_type=Bundle.BundleType.BUNDLE_0_3.value,
@@ -678,7 +679,7 @@ def _from_parts(
678679
tlog_entries=[log_entry._to_rekor()],
679680
timestamp_verification_data=timestamp_verifcation_data,
680681
),
681-
**content,
682+
**content_dict,
682683
)
683684

684685
return cls(inner)

0 commit comments

Comments
 (0)