Ensure that *everything* is typed in community.crypto (#917)

* Ensure that *everything* is typed in community.crypto.

* Fix comment.

* Ignore type definitions/imports and AssertionErrors for code coverage.
This commit is contained in:
Felix Fontein
2025-06-09 10:10:19 +02:00
committed by GitHub
parent ec063d8515
commit d83a923325
73 changed files with 494 additions and 317 deletions

View File

@@ -334,7 +334,7 @@ else:
CRYPTOGRAPHY_HAS_COMPATIBILITY2022 = True
if t.TYPE_CHECKING:
from ansible_collections.community.crypto.plugins.module_utils._crypto.cryptography_support import (
from ansible_collections.community.crypto.plugins.module_utils._crypto.cryptography_support import ( # pragma: no cover
CertificateIssuerPrivateKeyTypes,
)
@@ -343,7 +343,7 @@ if t.TYPE_CHECKING:
t.Union[cryptography.x509.Certificate, None],
list[cryptography.x509.Certificate],
t.Union[bytes, None],
]
] # pragma: no cover
def load_certificate_set(
@@ -688,7 +688,7 @@ class Pkcs(OpenSSLObject):
]:
"""Read PKCS#12 file."""
if self.src is None:
raise AssertionError("Contract violation: src is None")
raise AssertionError("Contract violation: src is None") # pragma: no cover
try:
with open(self.src, "rb") as pkcs12_fh: