diff --git a/noxfile.py b/noxfile.py index 6d8607cf..4fac681e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -10,7 +10,6 @@ import sys import nox - try: import antsibull_nox except ImportError: diff --git a/plugins/action/openssl_privatekey_pipe.py b/plugins/action/openssl_privatekey_pipe.py index db187a5c..ac7db733 100644 --- a/plugins/action/openssl_privatekey_pipe.py +++ b/plugins/action/openssl_privatekey_pipe.py @@ -20,7 +20,6 @@ from ansible_collections.community.crypto.plugins.plugin_utils._action_module im ActionModuleBase, ) - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._argspec import ( # pragma: no cover ArgumentSpec, diff --git a/plugins/filter/gpg_fingerprint.py b/plugins/filter/gpg_fingerprint.py index ab8342dd..e5cdac03 100644 --- a/plugins/filter/gpg_fingerprint.py +++ b/plugins/filter/gpg_fingerprint.py @@ -4,7 +4,6 @@ from __future__ import annotations - DOCUMENTATION = r""" name: gpg_fingerprint short_description: Retrieve a GPG fingerprint from a GPG public or private key diff --git a/plugins/filter/openssl_csr_info.py b/plugins/filter/openssl_csr_info.py index 9f910792..7e894db2 100644 --- a/plugins/filter/openssl_csr_info.py +++ b/plugins/filter/openssl_csr_info.py @@ -4,7 +4,6 @@ from __future__ import annotations - DOCUMENTATION = r""" name: openssl_csr_info short_description: Retrieve information from OpenSSL Certificate Signing Requests (CSR) diff --git a/plugins/filter/openssl_privatekey_info.py b/plugins/filter/openssl_privatekey_info.py index 6b1b7566..f8e373c3 100644 --- a/plugins/filter/openssl_privatekey_info.py +++ b/plugins/filter/openssl_privatekey_info.py @@ -4,7 +4,6 @@ from __future__ import annotations - DOCUMENTATION = r""" name: openssl_privatekey_info short_description: Retrieve information from OpenSSL private keys diff --git a/plugins/filter/openssl_publickey_info.py b/plugins/filter/openssl_publickey_info.py index 721addf6..406cf38f 100644 --- a/plugins/filter/openssl_publickey_info.py +++ b/plugins/filter/openssl_publickey_info.py @@ -4,7 +4,6 @@ from __future__ import annotations - DOCUMENTATION = r""" name: openssl_publickey_info short_description: Retrieve information from OpenSSL public keys in PEM format diff --git a/plugins/filter/parse_serial.py b/plugins/filter/parse_serial.py index 9eb403c0..920ab286 100644 --- a/plugins/filter/parse_serial.py +++ b/plugins/filter/parse_serial.py @@ -4,7 +4,6 @@ from __future__ import annotations - DOCUMENTATION = r""" name: parse_serial short_description: Convert a serial number as a colon-separated list of hex numbers to an integer diff --git a/plugins/filter/split_pem.py b/plugins/filter/split_pem.py index cba3cd63..6df47b6e 100644 --- a/plugins/filter/split_pem.py +++ b/plugins/filter/split_pem.py @@ -4,7 +4,6 @@ from __future__ import annotations - DOCUMENTATION = r""" name: split_pem short_description: Split PEM file contents into multiple objects diff --git a/plugins/filter/to_serial.py b/plugins/filter/to_serial.py index 6aea306a..b0f42712 100644 --- a/plugins/filter/to_serial.py +++ b/plugins/filter/to_serial.py @@ -4,7 +4,6 @@ from __future__ import annotations - DOCUMENTATION = r""" name: to_serial short_description: Convert an integer to a colon-separated list of hex numbers diff --git a/plugins/filter/x509_certificate_info.py b/plugins/filter/x509_certificate_info.py index a7e84ffd..683beb4e 100644 --- a/plugins/filter/x509_certificate_info.py +++ b/plugins/filter/x509_certificate_info.py @@ -4,7 +4,6 @@ from __future__ import annotations - DOCUMENTATION = r""" name: x509_certificate_info short_description: Retrieve information from X.509 certificates in PEM format diff --git a/plugins/filter/x509_crl_info.py b/plugins/filter/x509_crl_info.py index aa5f9573..ee0acb6d 100644 --- a/plugins/filter/x509_crl_info.py +++ b/plugins/filter/x509_crl_info.py @@ -4,7 +4,6 @@ from __future__ import annotations - DOCUMENTATION = r""" name: x509_crl_info short_description: Retrieve information from X.509 CRLs in PEM format diff --git a/plugins/lookup/gpg_fingerprint.py b/plugins/lookup/gpg_fingerprint.py index d4727923..dc1c957e 100644 --- a/plugins/lookup/gpg_fingerprint.py +++ b/plugins/lookup/gpg_fingerprint.py @@ -4,7 +4,6 @@ from __future__ import annotations - DOCUMENTATION = r""" name: gpg_fingerprint short_description: Retrieve a GPG fingerprint from a GPG public or private key file diff --git a/plugins/module_utils/_acme/account.py b/plugins/module_utils/_acme/account.py index 169e9cd2..0460fd1b 100644 --- a/plugins/module_utils/_acme/account.py +++ b/plugins/module_utils/_acme/account.py @@ -16,7 +16,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.errors impo ModuleFailException, ) - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._acme.acme import ( # pragma: no cover ACMEClient, diff --git a/plugins/module_utils/_acme/acme.py b/plugins/module_utils/_acme/acme.py index 2aa37c8a..330ffec0 100644 --- a/plugins/module_utils/_acme/acme.py +++ b/plugins/module_utils/_acme/acme.py @@ -48,7 +48,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import ( get_now_datetime, ) - if t.TYPE_CHECKING: import http.client # pragma: no cover import os # pragma: no cover @@ -810,8 +809,8 @@ def create_backend( __all__ = ( - "ACMEDirectory", "ACMEClient", - "create_default_argspec", + "ACMEDirectory", "create_backend", + "create_default_argspec", ) diff --git a/plugins/module_utils/_acme/backend_cryptography.py b/plugins/module_utils/_acme/backend_cryptography.py index 9f563835..56ba1ceb 100644 --- a/plugins/module_utils/_acme/backend_cryptography.py +++ b/plugins/module_utils/_acme/backend_cryptography.py @@ -54,7 +54,6 @@ from ansible_collections.community.crypto.plugins.module_utils._version import ( LooseVersion, ) - CRYPTOGRAPHY_MINIMAL_VERSION = "1.5" CRYPTOGRAPHY_ERROR: None | str @@ -539,9 +538,9 @@ class CryptographyBackend(CryptoBackend): __all__ = ( + "CRYPTOGRAPHY_ERROR", + "CRYPTOGRAPHY_ERROR", "CRYPTOGRAPHY_MINIMAL_VERSION", - "CRYPTOGRAPHY_ERROR", "CRYPTOGRAPHY_VERSION", - "CRYPTOGRAPHY_ERROR", "CryptographyBackend", ) diff --git a/plugins/module_utils/_acme/backend_openssl_cli.py b/plugins/module_utils/_acme/backend_openssl_cli.py index e7e0fb19..4045cc2e 100644 --- a/plugins/module_utils/_acme/backend_openssl_cli.py +++ b/plugins/module_utils/_acme/backend_openssl_cli.py @@ -38,7 +38,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import ( ensure_utc_timezone, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/module_utils/_acme/backends.py b/plugins/module_utils/_acme/backends.py index 4e3bdc90..3d943a13 100644 --- a/plugins/module_utils/_acme/backends.py +++ b/plugins/module_utils/_acme/backends.py @@ -29,7 +29,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import ( remove_timezone, ) - if t.TYPE_CHECKING: import os # pragma: no cover diff --git a/plugins/module_utils/_acme/certificate.py b/plugins/module_utils/_acme/certificate.py index 399cb7aa..bba72789 100644 --- a/plugins/module_utils/_acme/certificate.py +++ b/plugins/module_utils/_acme/certificate.py @@ -36,7 +36,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.utils impor pem_to_der, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/module_utils/_acme/certificates.py b/plugins/module_utils/_acme/certificates.py index b7ea95b0..0000d053 100644 --- a/plugins/module_utils/_acme/certificates.py +++ b/plugins/module_utils/_acme/certificates.py @@ -22,7 +22,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.pem impor split_pem_list, ) - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._acme.acme import ( # pragma: no cover ACMEClient, @@ -129,4 +128,4 @@ class ChainMatcher(metaclass=abc.ABCMeta): """ -__all__ = ("CertificateChain", "Criterium", "ChainMatcher") +__all__ = ("CertificateChain", "ChainMatcher", "Criterium") diff --git a/plugins/module_utils/_acme/challenges.py b/plugins/module_utils/_acme/challenges.py index b2d312a9..8d5f4550 100644 --- a/plugins/module_utils/_acme/challenges.py +++ b/plugins/module_utils/_acme/challenges.py @@ -27,7 +27,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.utils impor nopad_b64, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover @@ -429,11 +428,11 @@ def wait_for_validation( __all__ = ( - "create_key_authorization", + "Authorization", + "Challenge", "combine_identifier", + "create_key_authorization", "normalize_combined_identifier", "split_identifier", - "Challenge", - "Authorization", "wait_for_validation", ) diff --git a/plugins/module_utils/_acme/errors.py b/plugins/module_utils/_acme/errors.py index f157fbb9..7948ecac 100644 --- a/plugins/module_utils/_acme/errors.py +++ b/plugins/module_utils/_acme/errors.py @@ -13,7 +13,6 @@ from http.client import responses as http_responses from ansible.module_utils.common.text.converters import to_text - if t.TYPE_CHECKING: import http.client # pragma: no cover import urllib.error # pragma: no cover @@ -185,11 +184,11 @@ class KeyParsingError(ModuleFailException): __all__ = ( - "format_http_status", - "format_error_problem", - "ModuleFailException", "ACMEProtocolException", "BackendException", - "NetworkException", "KeyParsingError", + "ModuleFailException", + "NetworkException", + "format_error_problem", + "format_http_status", ) diff --git a/plugins/module_utils/_acme/io.py b/plugins/module_utils/_acme/io.py index 3ab0bd27..d291ef0e 100644 --- a/plugins/module_utils/_acme/io.py +++ b/plugins/module_utils/_acme/io.py @@ -19,7 +19,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.errors impo ModuleFailException, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/module_utils/_acme/orders.py b/plugins/module_utils/_acme/orders.py index e6c68135..d65e9e84 100644 --- a/plugins/module_utils/_acme/orders.py +++ b/plugins/module_utils/_acme/orders.py @@ -24,7 +24,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.utils impor nopad_b64, ) - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._acme.acme import ( # pragma: no cover ACMEClient, diff --git a/plugins/module_utils/_acme/utils.py b/plugins/module_utils/_acme/utils.py index c9f3aae9..e189e166 100644 --- a/plugins/module_utils/_acme/utils.py +++ b/plugins/module_utils/_acme/utils.py @@ -28,7 +28,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import ( get_now_datetime, ) - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._acme.backends import ( # pragma: no cover CertificateInformation, @@ -165,10 +164,10 @@ def compute_cert_id( __all__ = ( - "nopad_b64", + "compute_cert_id", "der_to_pem", + "nopad_b64", + "parse_retry_after", "pem_to_der", "process_links", - "parse_retry_after", - "compute_cert_id", ) diff --git a/plugins/module_utils/_argspec.py b/plugins/module_utils/_argspec.py index 266345cb..ff059622 100644 --- a/plugins/module_utils/_argspec.py +++ b/plugins/module_utils/_argspec.py @@ -11,7 +11,6 @@ import typing as t from ansible.module_utils.basic import AnsibleModule - _T = t.TypeVar("_T") diff --git a/plugins/module_utils/_crypto/_asn1.py b/plugins/module_utils/_crypto/_asn1.py index 08bd9208..6f5d5917 100644 --- a/plugins/module_utils/_crypto/_asn1.py +++ b/plugins/module_utils/_crypto/_asn1.py @@ -12,7 +12,6 @@ import re from ansible.module_utils.common.text.converters import to_bytes - # An ASN.1 serialized as a string in the OpenSSL format: # [modifier,]type[:value] # @@ -173,4 +172,4 @@ def pack_asn1( return bytes(b_asn1_data) + b_data -__all__ = ("TagClass", "TagNumber", "serialize_asn1_string_as_der", "pack_asn1") +__all__ = ("TagClass", "TagNumber", "pack_asn1", "serialize_asn1_string_as_der") diff --git a/plugins/module_utils/_crypto/_obj2txt.py b/plugins/module_utils/_crypto/_obj2txt.py index 4e5768af..f254a775 100644 --- a/plugins/module_utils/_crypto/_obj2txt.py +++ b/plugins/module_utils/_crypto/_obj2txt.py @@ -33,7 +33,6 @@ from __future__ import annotations import typing as t - # WARNING: this function no longer works with cryptography 35.0.0 and newer! # It must **ONLY** be used in compatibility code for older # cryptography versions! diff --git a/plugins/module_utils/_crypto/_objects.py b/plugins/module_utils/_crypto/_objects.py index 464983f4..e1ccc1e5 100644 --- a/plugins/module_utils/_crypto/_objects.py +++ b/plugins/module_utils/_crypto/_objects.py @@ -11,7 +11,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto._objects_ OID_MAP, ) - OID_LOOKUP: dict[str, str] = {} NORMALIZE_NAMES: dict[str, str] = {} NORMALIZE_NAMES_SHORT: dict[str, str] = {} @@ -35,4 +34,4 @@ for alias, original in [("userID", "userId")]: OID_LOOKUP[alias] = OID_LOOKUP[original] -__all__ = ("OID_LOOKUP", "NORMALIZE_NAMES", "NORMALIZE_NAMES_SHORT") +__all__ = ("NORMALIZE_NAMES", "NORMALIZE_NAMES_SHORT", "OID_LOOKUP") diff --git a/plugins/module_utils/_crypto/_objects_data.py b/plugins/module_utils/_crypto/_objects_data.py index 1fecd6cd..c7ed6b53 100644 --- a/plugins/module_utils/_crypto/_objects_data.py +++ b/plugins/module_utils/_crypto/_objects_data.py @@ -19,7 +19,6 @@ from __future__ import annotations - OID_MAP = { "0": ("itu-t", "ITU-T", "ccitt"), "0.3.4401.5": ("ntt-ds",), diff --git a/plugins/module_utils/_crypto/basic.py b/plugins/module_utils/_crypto/basic.py index ed33e759..1bc5844e 100644 --- a/plugins/module_utils/_crypto/basic.py +++ b/plugins/module_utils/_crypto/basic.py @@ -8,7 +8,6 @@ from __future__ import annotations - try: import cryptography # noqa: F401, pylint: disable=unused-import @@ -26,4 +25,4 @@ class OpenSSLBadPassphraseError(OpenSSLObjectError): pass -__all__ = ("HAS_CRYPTOGRAPHY", "OpenSSLObjectError", "OpenSSLBadPassphraseError") +__all__ = ("HAS_CRYPTOGRAPHY", "OpenSSLBadPassphraseError", "OpenSSLObjectError") diff --git a/plugins/module_utils/_crypto/cryptography_crl.py b/plugins/module_utils/_crypto/cryptography_crl.py index 2c56219a..04d7c0bf 100644 --- a/plugins/module_utils/_crypto/cryptography_crl.py +++ b/plugins/module_utils/_crypto/cryptography_crl.py @@ -13,7 +13,6 @@ from ansible_collections.community.crypto.plugins.module_utils._version import ( LooseVersion as _LooseVersion, ) - try: import cryptography from cryptography import x509 @@ -32,7 +31,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.cryptogra cryptography_decode_name, ) - if t.TYPE_CHECKING: import datetime # pragma: no cover @@ -200,11 +198,11 @@ __all__ = ( "cryptography_decode_revoked_certificate", "cryptography_dump_revoked", "cryptography_get_signature_algorithm_oid_from_crl", - "get_next_update", - "get_last_update", - "get_revocation_date", "get_invalidity_date", - "set_next_update", + "get_last_update", + "get_next_update", + "get_revocation_date", "set_last_update", + "set_next_update", "set_revocation_date", ) diff --git a/plugins/module_utils/_crypto/cryptography_support.py b/plugins/module_utils/_crypto/cryptography_support.py index c27c2964..fbae9cdc 100644 --- a/plugins/module_utils/_crypto/cryptography_support.py +++ b/plugins/module_utils/_crypto/cryptography_support.py @@ -28,7 +28,6 @@ from ansible_collections.community.crypto.plugins.module_utils._version import ( LooseVersion, ) - try: import cryptography from cryptography import x509 @@ -86,7 +85,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.basic imp OpenSSLObjectError, ) - if t.TYPE_CHECKING: import datetime # pragma: no cover @@ -1108,27 +1106,27 @@ def is_potential_certificate_issuer_public_key( __all__ = ( "CRYPTOGRAPHY_TIMEZONE", + "cryptography_compare_private_keys", + "cryptography_compare_public_keys", + "cryptography_decode_name", + "cryptography_get_basic_constraints", "cryptography_get_extensions_from_cert", "cryptography_get_extensions_from_csr", + "cryptography_get_name", + "cryptography_key_needs_digest_for_signing", "cryptography_name_to_oid", "cryptography_oid_to_name", - "cryptography_parse_relative_distinguished_name", - "cryptography_get_name", - "cryptography_decode_name", "cryptography_parse_key_usage_params", - "cryptography_get_basic_constraints", - "cryptography_key_needs_digest_for_signing", - "cryptography_compare_public_keys", - "cryptography_compare_private_keys", - "parse_pkcs12", - "cryptography_verify_signature", + "cryptography_parse_relative_distinguished_name", "cryptography_verify_certificate_signature", + "cryptography_verify_signature", "get_not_valid_after", "get_not_valid_before", + "is_potential_certificate_issuer_private_key", + "is_potential_certificate_issuer_public_key", + "is_potential_certificate_private_key", + "is_potential_certificate_public_key", + "parse_pkcs12", "set_not_valid_after", "set_not_valid_before", - "is_potential_certificate_private_key", - "is_potential_certificate_issuer_private_key", - "is_potential_certificate_public_key", - "is_potential_certificate_issuer_public_key", ) diff --git a/plugins/module_utils/_crypto/math.py b/plugins/module_utils/_crypto/math.py index 9256f810..e5ec5580 100644 --- a/plugins/module_utils/_crypto/math.py +++ b/plugins/module_utils/_crypto/math.py @@ -160,11 +160,11 @@ def convert_bytes_to_int(data: bytes) -> int: __all__ = ( "binary_exp_mod", - "simple_gcd", - "quick_is_not_prime", - "count_bytes", - "count_bits", + "convert_bytes_to_int", "convert_int_to_bytes", "convert_int_to_hex", - "convert_bytes_to_int", + "count_bits", + "count_bytes", + "quick_is_not_prime", + "simple_gcd", ) diff --git a/plugins/module_utils/_crypto/module_backends/certificate.py b/plugins/module_utils/_crypto/module_backends/certificate.py index f0068742..4ae27a4c 100644 --- a/plugins/module_utils/_crypto/module_backends/certificate.py +++ b/plugins/module_utils/_crypto/module_backends/certificate.py @@ -36,7 +36,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep assert_required_cryptography_version, ) - if t.TYPE_CHECKING: import datetime # pragma: no cover @@ -416,8 +415,8 @@ def get_certificate_argument_spec() -> ArgumentSpec: __all__ = ( - "CertificateError", "CertificateBackend", + "CertificateError", "CertificateProvider", "get_certificate_argument_spec", ) diff --git a/plugins/module_utils/_crypto/module_backends/certificate_acme.py b/plugins/module_utils/_crypto/module_backends/certificate_acme.py index ab5d6f5e..cc18cc8e 100644 --- a/plugins/module_utils/_crypto/module_backends/certificate_acme.py +++ b/plugins/module_utils/_crypto/module_backends/certificate_acme.py @@ -21,7 +21,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.module_ba CertificateProvider, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/module_utils/_crypto/module_backends/certificate_info.py b/plugins/module_utils/_crypto/module_backends/certificate_info.py index f3debf14..bf1f2487 100644 --- a/plugins/module_utils/_crypto/module_backends/certificate_info.py +++ b/plugins/module_utils/_crypto/module_backends/certificate_info.py @@ -37,7 +37,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import ( get_now_datetime, ) - if t.TYPE_CHECKING: import datetime # pragma: no cover diff --git a/plugins/module_utils/_crypto/module_backends/certificate_ownca.py b/plugins/module_utils/_crypto/module_backends/certificate_ownca.py index 9c4ecb6c..044446d1 100644 --- a/plugins/module_utils/_crypto/module_backends/certificate_ownca.py +++ b/plugins/module_utils/_crypto/module_backends/certificate_ownca.py @@ -40,7 +40,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import ( get_relative_time_option, ) - if t.TYPE_CHECKING: import datetime # pragma: no cover diff --git a/plugins/module_utils/_crypto/module_backends/certificate_selfsigned.py b/plugins/module_utils/_crypto/module_backends/certificate_selfsigned.py index 20f7e016..ce26630a 100644 --- a/plugins/module_utils/_crypto/module_backends/certificate_selfsigned.py +++ b/plugins/module_utils/_crypto/module_backends/certificate_selfsigned.py @@ -34,7 +34,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import ( get_relative_time_option, ) - if t.TYPE_CHECKING: import datetime # pragma: no cover diff --git a/plugins/module_utils/_crypto/module_backends/crl_info.py b/plugins/module_utils/_crypto/module_backends/crl_info.py index 44b80684..82bca5a6 100644 --- a/plugins/module_utils/_crypto/module_backends/crl_info.py +++ b/plugins/module_utils/_crypto/module_backends/crl_info.py @@ -26,7 +26,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep assert_required_cryptography_version, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/module_utils/_crypto/module_backends/csr.py b/plugins/module_utils/_crypto/module_backends/csr.py index e5b1963d..bc1611db 100644 --- a/plugins/module_utils/_crypto/module_backends/csr.py +++ b/plugins/module_utils/_crypto/module_backends/csr.py @@ -47,7 +47,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep assert_required_cryptography_version, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover @@ -926,8 +925,8 @@ def get_csr_argument_spec() -> ArgumentSpec: __all__ = ( - "CertificateSigningRequestError", "CertificateSigningRequestBackend", - "select_backend", + "CertificateSigningRequestError", "get_csr_argument_spec", + "select_backend", ) diff --git a/plugins/module_utils/_crypto/module_backends/csr_info.py b/plugins/module_utils/_crypto/module_backends/csr_info.py index 521e03a5..b12b7544 100644 --- a/plugins/module_utils/_crypto/module_backends/csr_info.py +++ b/plugins/module_utils/_crypto/module_backends/csr_info.py @@ -30,7 +30,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep assert_required_cryptography_version, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover diff --git a/plugins/module_utils/_crypto/module_backends/privatekey.py b/plugins/module_utils/_crypto/module_backends/privatekey.py index bdbbf944..c9aff491 100644 --- a/plugins/module_utils/_crypto/module_backends/privatekey.py +++ b/plugins/module_utils/_crypto/module_backends/privatekey.py @@ -36,7 +36,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep assert_required_cryptography_version, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover @@ -655,8 +654,8 @@ def get_privatekey_argument_spec() -> ArgumentSpec: __all__ = ( - "PrivateKeyError", "PrivateKeyBackend", - "select_backend", + "PrivateKeyError", "get_privatekey_argument_spec", + "select_backend", ) diff --git a/plugins/module_utils/_crypto/module_backends/privatekey_convert.py b/plugins/module_utils/_crypto/module_backends/privatekey_convert.py index 1a7f5b5b..1a432ad1 100644 --- a/plugins/module_utils/_crypto/module_backends/privatekey_convert.py +++ b/plugins/module_utils/_crypto/module_backends/privatekey_convert.py @@ -30,7 +30,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep ) from ansible_collections.community.crypto.plugins.module_utils._io import load_file - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover @@ -287,8 +286,8 @@ def get_privatekey_argument_spec() -> ArgumentSpec: __all__ = ( - "PrivateKeyError", "PrivateKeyConvertBackend", - "select_backend", + "PrivateKeyError", "get_privatekey_argument_spec", + "select_backend", ) diff --git a/plugins/module_utils/_crypto/module_backends/privatekey_info.py b/plugins/module_utils/_crypto/module_backends/privatekey_info.py index 6577fedb..253c1a7b 100644 --- a/plugins/module_utils/_crypto/module_backends/privatekey_info.py +++ b/plugins/module_utils/_crypto/module_backends/privatekey_info.py @@ -33,7 +33,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep assert_required_cryptography_version, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover @@ -336,8 +335,8 @@ def select_backend( __all__ = ( "PrivateKeyConsistencyError", - "PrivateKeyParseError", "PrivateKeyInfoRetrieval", + "PrivateKeyParseError", "get_privatekey_info", "select_backend", ) diff --git a/plugins/module_utils/_crypto/module_backends/publickey_info.py b/plugins/module_utils/_crypto/module_backends/publickey_info.py index 8929cda4..0a0a6b1d 100644 --- a/plugins/module_utils/_crypto/module_backends/publickey_info.py +++ b/plugins/module_utils/_crypto/module_backends/publickey_info.py @@ -21,7 +21,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep assert_required_cryptography_version, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover @@ -178,8 +177,8 @@ def select_backend( __all__ = ( - "PublicKeyParseError", "PublicKeyInfoRetrieval", + "PublicKeyParseError", "get_publickey_info", "select_backend", ) diff --git a/plugins/module_utils/_crypto/pem.py b/plugins/module_utils/_crypto/pem.py index d5357004..ef0b68d4 100644 --- a/plugins/module_utils/_crypto/pem.py +++ b/plugins/module_utils/_crypto/pem.py @@ -9,7 +9,6 @@ from __future__ import annotations import typing as t - PEM_START = "-----BEGIN " PEM_END_START = "-----END " PEM_END = "-----" @@ -128,14 +127,14 @@ def extract_pem(content: str, *, strict: bool = False) -> tuple[str, str]: __all__ = ( - "PEM_START", - "PEM_END_START", "PEM_END", - "PKCS8_PRIVATEKEY_NAMES", + "PEM_END_START", + "PEM_START", "PKCS1_PRIVATEKEY_SUFFIX", + "PKCS8_PRIVATEKEY_NAMES", + "extract_first_pem", + "extract_pem", "identify_pem_format", "identify_private_key_format", "split_pem_list", - "extract_first_pem", - "extract_pem", ) diff --git a/plugins/module_utils/_crypto/support.py b/plugins/module_utils/_crypto/support.py index 890d1f8e..353b9a8e 100644 --- a/plugins/module_utils/_crypto/support.py +++ b/plugins/module_utils/_crypto/support.py @@ -23,7 +23,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.pem impor identify_pem_format, ) - try: from cryptography import x509 from cryptography.exceptions import UnsupportedAlgorithm @@ -38,7 +37,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.basic imp OpenSSLObjectError, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover @@ -467,17 +465,17 @@ class OpenSSLObject(metaclass=abc.ABCMeta): __all__ = ( + "OpenSSLObject", + "get_fingerprint", "get_fingerprint_of_bytes", "get_fingerprint_of_privatekey", - "get_fingerprint", - "load_privatekey", - "load_certificate_privatekey", - "load_certificate_issuer_privatekey", - "load_publickey", "load_certificate", + "load_certificate_issuer_privatekey", + "load_certificate_privatekey", "load_certificate_request", + "load_privatekey", + "load_publickey", "parse_name_field", "parse_ordered_name_field", "select_message_digest", - "OpenSSLObject", ) diff --git a/plugins/module_utils/_cryptography_dep.py b/plugins/module_utils/_cryptography_dep.py index c410e042..e636c509 100644 --- a/plugins/module_utils/_cryptography_dep.py +++ b/plugins/module_utils/_cryptography_dep.py @@ -22,7 +22,6 @@ from ansible_collections.community.crypto.plugins.module_utils._version import ( LooseVersion, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/module_utils/_gnupg/cli.py b/plugins/module_utils/_gnupg/cli.py index f6f0b626..d6347d23 100644 --- a/plugins/module_utils/_gnupg/cli.py +++ b/plugins/module_utils/_gnupg/cli.py @@ -82,7 +82,7 @@ def get_fingerprint_from_bytes(*, gpg_runner: GPGRunner, content: bytes) -> str: __all__ = ( "GPGError", "GPGRunner", - "get_fingerprint_from_stdout", - "get_fingerprint_from_file", "get_fingerprint_from_bytes", + "get_fingerprint_from_file", + "get_fingerprint_from_stdout", ) diff --git a/plugins/module_utils/_io.py b/plugins/module_utils/_io.py index 14c9e168..17ee5996 100644 --- a/plugins/module_utils/_io.py +++ b/plugins/module_utils/_io.py @@ -12,7 +12,6 @@ import os import tempfile import typing as t - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/module_utils/_openssh/backends/common.py b/plugins/module_utils/_openssh/backends/common.py index 83dba6ce..60ef7095 100644 --- a/plugins/module_utils/_openssh/backends/common.py +++ b/plugins/module_utils/_openssh/backends/common.py @@ -18,7 +18,6 @@ from ansible_collections.community.crypto.plugins.module_utils._openssh.utils im parse_openssh_version, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover @@ -485,11 +484,11 @@ def parse_private_key_format( __all__ = ( - "restore_on_failure", - "safe_atomic_move", - "OpensshModule", "KeygenCommand", + "OpensshModule", "PrivateKey", "PublicKey", "parse_private_key_format", + "restore_on_failure", + "safe_atomic_move", ) diff --git a/plugins/module_utils/_openssh/backends/keypair_backend.py b/plugins/module_utils/_openssh/backends/keypair_backend.py index 28e7edb7..04f1208d 100644 --- a/plugins/module_utils/_openssh/backends/keypair_backend.py +++ b/plugins/module_utils/_openssh/backends/keypair_backend.py @@ -43,7 +43,6 @@ from ansible_collections.community.crypto.plugins.module_utils._version import ( LooseVersion, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/module_utils/_openssh/certificate.py b/plugins/module_utils/_openssh/certificate.py index 02532858..ac288017 100644 --- a/plugins/module_utils/_openssh/certificate.py +++ b/plugins/module_utils/_openssh/certificate.py @@ -30,7 +30,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import ( convert_relative_to_datetime, ) - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._openssh.cryptography import ( # pragma: no cover KeyType, @@ -840,14 +839,14 @@ def parse_option_list( __all__ = ( - "OpensshCertificateTimeParameters", - "OpensshCertificateOption", + "OpensshCertificate", "OpensshCertificateInfo", - "OpensshRSACertificateInfo", + "OpensshCertificateOption", + "OpensshCertificateTimeParameters", "OpensshDSACertificateInfo", "OpensshECDSACertificateInfo", "OpensshED25519CertificateInfo", - "OpensshCertificate", + "OpensshRSACertificateInfo", "apply_directives", "default_options", "fingerprint", diff --git a/plugins/module_utils/_openssh/cryptography.py b/plugins/module_utils/_openssh/cryptography.py index af430166..f77b346b 100644 --- a/plugins/module_utils/_openssh/cryptography.py +++ b/plugins/module_utils/_openssh/cryptography.py @@ -13,7 +13,6 @@ from base64 import b64decode, b64encode from getpass import getuser from socket import gethostname - try: from cryptography import __version__ as CRYPTOGRAPHY_VERSION from cryptography.exceptions import InvalidSignature, UnsupportedAlgorithm @@ -73,7 +72,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.cryptogra is_potential_certificate_issuer_private_key, ) - if t.TYPE_CHECKING: KeyFormat = t.Literal["SSH", "PKCS8", "PKCS1"] # pragma: no cover KeySerializationFormat = t.Literal["PEM", "DER", "SSH"] # pragma: no cover @@ -815,27 +813,27 @@ def calculate_fingerprint(openssh_publickey: bytes) -> str: __all__ = ( - "HAS_OPENSSH_SUPPORT", "CRYPTOGRAPHY_VERSION", - "OpenSSHError", + "HAS_OPENSSH_SUPPORT", + "AsymmetricKeypair", "InvalidAlgorithmError", "InvalidCommentError", "InvalidDataError", - "InvalidPrivateKeyFileError", - "InvalidPublicKeyFileError", "InvalidKeyFormatError", "InvalidKeySizeError", "InvalidKeyTypeError", "InvalidPassphraseError", + "InvalidPrivateKeyFileError", + "InvalidPublicKeyFileError", "InvalidSignatureError", - "AsymmetricKeypair", + "OpenSSHError", "OpensshKeypair", + "calculate_fingerprint", + "compare_encryption_algorithms", + "compare_publickeys", + "extract_comment", + "get_encryption_algorithm", "load_privatekey", "load_publickey", - "compare_publickeys", - "compare_encryption_algorithms", - "get_encryption_algorithm", "validate_comment", - "extract_comment", - "calculate_fingerprint", ) diff --git a/plugins/module_utils/_openssh/utils.py b/plugins/module_utils/_openssh/utils.py index 7159d917..3718482a 100644 --- a/plugins/module_utils/_openssh/utils.py +++ b/plugins/module_utils/_openssh/utils.py @@ -14,7 +14,6 @@ import typing as t from contextlib import contextmanager from struct import Struct - # Protocol References # ------------------- # https://datatracker.ietf.org/doc/html/rfc4251 @@ -351,10 +350,10 @@ class _OpensshWriter: __all__ = ( + "OpensshParser", "any_in", "file_mode", "parse_openssh_version", "secure_open", "secure_write", - "OpensshParser", ) diff --git a/plugins/module_utils/_time.py b/plugins/module_utils/_time.py index 6cb2bff8..6ca67177 100644 --- a/plugins/module_utils/_time.py +++ b/plugins/module_utils/_time.py @@ -16,7 +16,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.basic imp OpenSSLObjectError, ) - UTC = datetime.timezone.utc @@ -160,12 +159,12 @@ def get_relative_time_option( __all__ = ( - "get_now_datetime", - "ensure_utc_timezone", - "remove_timezone", "add_or_remove_timezone", - "get_epoch_seconds", - "from_epoch_seconds", "convert_relative_to_datetime", + "ensure_utc_timezone", + "from_epoch_seconds", + "get_epoch_seconds", + "get_now_datetime", "get_relative_time_option", + "remove_timezone", ) diff --git a/plugins/module_utils/_version.py b/plugins/module_utils/_version.py index 653a1b05..306d1f39 100644 --- a/plugins/module_utils/_version.py +++ b/plugins/module_utils/_version.py @@ -11,5 +11,4 @@ from __future__ import annotations from ansible.module_utils.compat.version import LooseVersion - __all__ = ("LooseVersion",) diff --git a/plugins/modules/acme_account.py b/plugins/modules/acme_account.py index e1980bfa..e57569d0 100644 --- a/plugins/modules/acme_account.py +++ b/plugins/modules/acme_account.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: acme_account author: "Felix Fontein (@felixfontein)" diff --git a/plugins/modules/acme_account_info.py b/plugins/modules/acme_account_info.py index e9c7b8ac..8badba79 100644 --- a/plugins/modules/acme_account_info.py +++ b/plugins/modules/acme_account_info.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: acme_account_info author: "Felix Fontein (@felixfontein)" @@ -222,7 +221,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.utils impor process_links, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/modules/acme_ari_info.py b/plugins/modules/acme_ari_info.py index 975a4bc2..68d2528e 100644 --- a/plugins/modules/acme_ari_info.py +++ b/plugins/modules/acme_ari_info.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: acme_ari_info author: "Felix Fontein (@felixfontein)" diff --git a/plugins/modules/acme_certificate.py b/plugins/modules/acme_certificate.py index c9fa7ef4..78f3b2e3 100644 --- a/plugins/modules/acme_certificate.py +++ b/plugins/modules/acme_certificate.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: acme_certificate author: "Michael Gruener (@mgruener)" @@ -596,7 +595,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.utils impor pem_to_der, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/modules/acme_certificate_deactivate_authz.py b/plugins/modules/acme_certificate_deactivate_authz.py index 633b75d9..8aeb2678 100644 --- a/plugins/modules/acme_certificate_deactivate_authz.py +++ b/plugins/modules/acme_certificate_deactivate_authz.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: acme_certificate_deactivate_authz author: "Felix Fontein (@felixfontein)" diff --git a/plugins/modules/acme_certificate_order_create.py b/plugins/modules/acme_certificate_order_create.py index d4ce2e19..994adde9 100644 --- a/plugins/modules/acme_certificate_order_create.py +++ b/plugins/modules/acme_certificate_order_create.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = """ module: acme_certificate_order_create author: Felix Fontein (@felixfontein) diff --git a/plugins/modules/acme_certificate_order_finalize.py b/plugins/modules/acme_certificate_order_finalize.py index 08c41621..350552cb 100644 --- a/plugins/modules/acme_certificate_order_finalize.py +++ b/plugins/modules/acme_certificate_order_finalize.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = """ module: acme_certificate_order_finalize author: Felix Fontein (@felixfontein) @@ -325,7 +324,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.errors impo ModuleFailException, ) - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._acme.certificates import ( # pragma: no cover CertificateChain, diff --git a/plugins/modules/acme_certificate_order_info.py b/plugins/modules/acme_certificate_order_info.py index f7f6d9ca..abbd4c08 100644 --- a/plugins/modules/acme_certificate_order_info.py +++ b/plugins/modules/acme_certificate_order_info.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = """ module: acme_certificate_order_info author: Felix Fontein (@felixfontein) diff --git a/plugins/modules/acme_certificate_order_validate.py b/plugins/modules/acme_certificate_order_validate.py index 8d3e0285..9eee2ce4 100644 --- a/plugins/modules/acme_certificate_order_validate.py +++ b/plugins/modules/acme_certificate_order_validate.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = """ module: acme_certificate_order_validate author: Felix Fontein (@felixfontein) @@ -237,7 +236,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.errors impo ModuleFailException, ) - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._acme.challenges import ( # pragma: no cover Authorization, diff --git a/plugins/modules/acme_certificate_renewal_info.py b/plugins/modules/acme_certificate_renewal_info.py index cba1aa3a..1b32ef4d 100644 --- a/plugins/modules/acme_certificate_renewal_info.py +++ b/plugins/modules/acme_certificate_renewal_info.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: acme_certificate_renewal_info author: "Felix Fontein (@felixfontein)" diff --git a/plugins/modules/acme_certificate_revoke.py b/plugins/modules/acme_certificate_revoke.py index c2a54af2..32f5507d 100644 --- a/plugins/modules/acme_certificate_revoke.py +++ b/plugins/modules/acme_certificate_revoke.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: acme_certificate_revoke author: "Felix Fontein (@felixfontein)" diff --git a/plugins/modules/acme_challenge_cert_helper.py b/plugins/modules/acme_challenge_cert_helper.py index fac30b14..bc40457c 100644 --- a/plugins/modules/acme_challenge_cert_helper.py +++ b/plugins/modules/acme_challenge_cert_helper.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: acme_challenge_cert_helper author: "Felix Fontein (@felixfontein)" @@ -173,7 +172,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import ( get_now_datetime, ) - try: import cryptography import cryptography.hazmat.backends diff --git a/plugins/modules/acme_inspect.py b/plugins/modules/acme_inspect.py index c8829c8d..a881f675 100644 --- a/plugins/modules/acme_inspect.py +++ b/plugins/modules/acme_inspect.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: acme_inspect author: "Felix Fontein (@felixfontein)" diff --git a/plugins/modules/certificate_complete_chain.py b/plugins/modules/certificate_complete_chain.py index 36d2d9e4..b9631846 100644 --- a/plugins/modules/certificate_complete_chain.py +++ b/plugins/modules/certificate_complete_chain.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: certificate_complete_chain author: "Felix Fontein (@felixfontein)" @@ -134,7 +133,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep assert_required_cryptography_version, ) - try: import cryptography import cryptography.exceptions diff --git a/plugins/modules/crypto_info.py b/plugins/modules/crypto_info.py index 5f1c13fc..a8ab02f3 100644 --- a/plugins/modules/crypto_info.py +++ b/plugins/modules/crypto_info.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: crypto_info author: "Felix Fontein (@felixfontein)" @@ -156,7 +155,6 @@ import typing as t from ansible.module_utils.basic import AnsibleModule - CRYPTOGRAPHY_VERSION: str | None CRYPTOGRAPHY_IMP_ERR: str | None try: diff --git a/plugins/modules/get_certificate.py b/plugins/modules/get_certificate.py index 2993c2d7..8667113f 100644 --- a/plugins/modules/get_certificate.py +++ b/plugins/modules/get_certificate.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: get_certificate author: "John Westcott IV (@john-westcott-iv)" @@ -296,7 +295,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import ( get_now_datetime, ) - MINIMAL_CRYPTOGRAPHY_VERSION = COLLECTION_MINIMUM_CRYPTOGRAPHY_VERSION try: diff --git a/plugins/modules/luks_device.py b/plugins/modules/luks_device.py index 778c1f5e..5c8bb848 100644 --- a/plugins/modules/luks_device.py +++ b/plugins/modules/luks_device.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: luks_device @@ -486,7 +485,6 @@ from base64 import b64decode from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_bytes, to_text - # used to get out of lsblk output in format 'crypt ' # regex takes care of any possible blank characters LUKS_NAME_REGEX = re.compile(r"^crypt\s+([^\s]*)\s*$") diff --git a/plugins/modules/openssh_cert.py b/plugins/modules/openssh_cert.py index 7b7731e1..2c4875de 100644 --- a/plugins/modules/openssh_cert.py +++ b/plugins/modules/openssh_cert.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssh_cert author: "David Kainz (@lolcube)" diff --git a/plugins/modules/openssh_keypair.py b/plugins/modules/openssh_keypair.py index b17d1ba5..2e2db9d3 100644 --- a/plugins/modules/openssh_keypair.py +++ b/plugins/modules/openssh_keypair.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssh_keypair author: "David Kainz (@lolcube)" diff --git a/plugins/modules/openssl_csr.py b/plugins/modules/openssl_csr.py index 7a74d6f2..42241443 100644 --- a/plugins/modules/openssl_csr.py +++ b/plugins/modules/openssl_csr.py @@ -6,7 +6,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_csr short_description: Generate OpenSSL Certificate Signing Request (CSR) @@ -256,7 +255,6 @@ from ansible_collections.community.crypto.plugins.module_utils._io import ( write_file, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/modules/openssl_csr_info.py b/plugins/modules/openssl_csr_info.py index 8624b1b4..83937edc 100644 --- a/plugins/modules/openssl_csr_info.py +++ b/plugins/modules/openssl_csr_info.py @@ -6,7 +6,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_csr_info short_description: Provide information of OpenSSL Certificate Signing Requests (CSR) diff --git a/plugins/modules/openssl_csr_pipe.py b/plugins/modules/openssl_csr_pipe.py index 950d09dd..fbcf10d8 100644 --- a/plugins/modules/openssl_csr_pipe.py +++ b/plugins/modules/openssl_csr_pipe.py @@ -6,7 +6,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_csr_pipe short_description: Generate OpenSSL Certificate Signing Request (CSR) @@ -137,7 +136,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.module_ba select_backend, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/modules/openssl_dhparam.py b/plugins/modules/openssl_dhparam.py index 4317619a..1e838e00 100644 --- a/plugins/modules/openssl_dhparam.py +++ b/plugins/modules/openssl_dhparam.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_dhparam short_description: Generate OpenSSL Diffie-Hellman Parameters @@ -152,7 +151,6 @@ from ansible_collections.community.crypto.plugins.module_utils._version import ( LooseVersion, ) - MINIMAL_CRYPTOGRAPHY_VERSION = COLLECTION_MINIMUM_CRYPTOGRAPHY_VERSION try: diff --git a/plugins/modules/openssl_pkcs12.py b/plugins/modules/openssl_pkcs12.py index 20849d62..298cf90f 100644 --- a/plugins/modules/openssl_pkcs12.py +++ b/plugins/modules/openssl_pkcs12.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_pkcs12 author: @@ -307,7 +306,6 @@ from ansible_collections.community.crypto.plugins.module_utils._io import ( write_file, ) - MINIMAL_CRYPTOGRAPHY_VERSION = COLLECTION_MINIMUM_CRYPTOGRAPHY_VERSION try: diff --git a/plugins/modules/openssl_privatekey.py b/plugins/modules/openssl_privatekey.py index 13f9c745..f7a9fd5a 100644 --- a/plugins/modules/openssl_privatekey.py +++ b/plugins/modules/openssl_privatekey.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_privatekey short_description: Generate OpenSSL private keys @@ -172,7 +171,6 @@ from ansible_collections.community.crypto.plugins.module_utils._io import ( write_file, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/modules/openssl_privatekey_convert.py b/plugins/modules/openssl_privatekey_convert.py index fa921c9b..82c301e3 100644 --- a/plugins/modules/openssl_privatekey_convert.py +++ b/plugins/modules/openssl_privatekey_convert.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_privatekey_convert short_description: Convert OpenSSL private keys @@ -77,7 +76,6 @@ from ansible_collections.community.crypto.plugins.module_utils._io import ( write_file, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/modules/openssl_privatekey_info.py b/plugins/modules/openssl_privatekey_info.py index 2f10e109..4fdb9d35 100644 --- a/plugins/modules/openssl_privatekey_info.py +++ b/plugins/modules/openssl_privatekey_info.py @@ -6,7 +6,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_privatekey_info short_description: Provide information for OpenSSL private keys diff --git a/plugins/modules/openssl_privatekey_pipe.py b/plugins/modules/openssl_privatekey_pipe.py index 11f95919..1dc1c685 100644 --- a/plugins/modules/openssl_privatekey_pipe.py +++ b/plugins/modules/openssl_privatekey_pipe.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_privatekey_pipe short_description: Generate OpenSSL private keys without disk access diff --git a/plugins/modules/openssl_publickey.py b/plugins/modules/openssl_publickey.py index d716dae6..a2bef836 100644 --- a/plugins/modules/openssl_publickey.py +++ b/plugins/modules/openssl_publickey.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_publickey short_description: Generate an OpenSSL public key from its private key @@ -212,7 +211,6 @@ from ansible_collections.community.crypto.plugins.module_utils._io import ( write_file, ) - MINIMAL_CRYPTOGRAPHY_VERSION = COLLECTION_MINIMUM_CRYPTOGRAPHY_VERSION try: diff --git a/plugins/modules/openssl_publickey_info.py b/plugins/modules/openssl_publickey_info.py index 83505d52..04c4e076 100644 --- a/plugins/modules/openssl_publickey_info.py +++ b/plugins/modules/openssl_publickey_info.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_publickey_info short_description: Provide information for OpenSSL public keys diff --git a/plugins/modules/openssl_signature.py b/plugins/modules/openssl_signature.py index b6b18882..a3fab308 100644 --- a/plugins/modules/openssl_signature.py +++ b/plugins/modules/openssl_signature.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_signature version_added: 1.1.0 @@ -109,7 +108,6 @@ from ansible_collections.community.crypto.plugins.module_utils._version import ( LooseVersion, ) - MINIMAL_CRYPTOGRAPHY_VERSION = COLLECTION_MINIMUM_CRYPTOGRAPHY_VERSION try: diff --git a/plugins/modules/openssl_signature_info.py b/plugins/modules/openssl_signature_info.py index 3709b219..9915bda1 100644 --- a/plugins/modules/openssl_signature_info.py +++ b/plugins/modules/openssl_signature_info.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: openssl_signature_info version_added: 1.1.0 @@ -98,7 +97,6 @@ from ansible_collections.community.crypto.plugins.module_utils._version import ( LooseVersion, ) - MINIMAL_CRYPTOGRAPHY_VERSION = COLLECTION_MINIMUM_CRYPTOGRAPHY_VERSION try: diff --git a/plugins/modules/x509_certificate.py b/plugins/modules/x509_certificate.py index 46b050ca..3a552a97 100644 --- a/plugins/modules/x509_certificate.py +++ b/plugins/modules/x509_certificate.py @@ -6,7 +6,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: x509_certificate short_description: Generate and/or check OpenSSL certificates @@ -236,7 +235,6 @@ from ansible_collections.community.crypto.plugins.module_utils._io import ( write_file, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/modules/x509_certificate_convert.py b/plugins/modules/x509_certificate_convert.py index 42b61148..c60f4733 100644 --- a/plugins/modules/x509_certificate_convert.py +++ b/plugins/modules/x509_certificate_convert.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: x509_certificate_convert short_description: Convert X.509 certificates @@ -134,7 +133,6 @@ from ansible_collections.community.crypto.plugins.module_utils._io import ( write_file, ) - MINIMAL_CRYPTOGRAPHY_VERSION = COLLECTION_MINIMUM_CRYPTOGRAPHY_VERSION try: diff --git a/plugins/modules/x509_certificate_info.py b/plugins/modules/x509_certificate_info.py index b7efe319..fc2cc9d7 100644 --- a/plugins/modules/x509_certificate_info.py +++ b/plugins/modules/x509_certificate_info.py @@ -6,7 +6,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: x509_certificate_info short_description: Provide information of OpenSSL X.509 certificates diff --git a/plugins/modules/x509_certificate_pipe.py b/plugins/modules/x509_certificate_pipe.py index 150843b4..225868a8 100644 --- a/plugins/modules/x509_certificate_pipe.py +++ b/plugins/modules/x509_certificate_pipe.py @@ -7,7 +7,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: x509_certificate_pipe short_description: Generate and/or check OpenSSL certificates @@ -134,7 +133,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.module_ba add_selfsigned_provider_to_argument_spec, ) - if t.TYPE_CHECKING: from ansible.module_utils.basic import AnsibleModule # pragma: no cover diff --git a/plugins/modules/x509_crl.py b/plugins/modules/x509_crl.py index 170cb2fc..65a0251c 100644 --- a/plugins/modules/x509_crl.py +++ b/plugins/modules/x509_crl.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: x509_crl version_added: '1.0.0' @@ -482,7 +481,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import ( get_relative_time_option, ) - MINIMAL_CRYPTOGRAPHY_VERSION = COLLECTION_MINIMUM_CRYPTOGRAPHY_VERSION try: diff --git a/plugins/modules/x509_crl_info.py b/plugins/modules/x509_crl_info.py index 14983117..12aa0005 100644 --- a/plugins/modules/x509_crl_info.py +++ b/plugins/modules/x509_crl_info.py @@ -5,7 +5,6 @@ from __future__ import annotations - DOCUMENTATION = r""" module: x509_crl_info version_added: '1.0.0' diff --git a/plugins/plugin_utils/_action_module.py b/plugins/plugin_utils/_action_module.py index 46979880..cb10b0fb 100644 --- a/plugins/plugin_utils/_action_module.py +++ b/plugins/plugin_utils/_action_module.py @@ -26,7 +26,6 @@ from ansible.module_utils.common.arg_spec import ArgumentSpecValidator from ansible.module_utils.errors import UnsupportedError from ansible.plugins.action import ActionBase - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._argspec import ( ArgumentSpec, @@ -223,4 +222,4 @@ class ActionModuleBase(ActionBase, metaclass=abc.ABCMeta): return result -__all__ = ("AnsibleActionModule", "ActionModuleBase") +__all__ = ("ActionModuleBase", "AnsibleActionModule") diff --git a/plugins/plugin_utils/_filter_module.py b/plugins/plugin_utils/_filter_module.py index e9cad339..8d5d7718 100644 --- a/plugins/plugin_utils/_filter_module.py +++ b/plugins/plugin_utils/_filter_module.py @@ -14,7 +14,6 @@ import typing as t from ansible.errors import AnsibleFilterError from ansible.utils.display import Display - _display = Display() diff --git a/tests/unit/plugins/module_utils/_acme/backend_data.py b/tests/unit/plugins/module_utils/_acme/backend_data.py index e008e75b..f1c59d7c 100644 --- a/tests/unit/plugins/module_utils/_acme/backend_data.py +++ b/tests/unit/plugins/module_utils/_acme/backend_data.py @@ -19,7 +19,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.errors impo from ..test__time import TIMEZONES, cartesian_product - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._acme.backends import ( # pragma: no cover Criterium, diff --git a/tests/unit/plugins/module_utils/_acme/test_backend_cryptography.py b/tests/unit/plugins/module_utils/_acme/test_backend_cryptography.py index 3cd192c0..9c78533f 100644 --- a/tests/unit/plugins/module_utils/_acme/test_backend_cryptography.py +++ b/tests/unit/plugins/module_utils/_acme/test_backend_cryptography.py @@ -37,7 +37,6 @@ from .backend_data import ( TEST_PARSE_ACME_TIMESTAMP, ) - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._acme.backends import ( # pragma: no cover CertificateInformation, diff --git a/tests/unit/plugins/module_utils/_acme/test_backend_openssl_cli.py b/tests/unit/plugins/module_utils/_acme/test_backend_openssl_cli.py index f212bf56..4ee1283f 100644 --- a/tests/unit/plugins/module_utils/_acme/test_backend_openssl_cli.py +++ b/tests/unit/plugins/module_utils/_acme/test_backend_openssl_cli.py @@ -33,7 +33,6 @@ from .backend_data import ( TEST_PARSE_ACME_TIMESTAMP, ) - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._acme.backends import ( # pragma: no cover CertificateInformation, diff --git a/tests/unit/plugins/module_utils/_acme/test_errors.py b/tests/unit/plugins/module_utils/_acme/test_errors.py index 7d5b2573..0cd55a48 100644 --- a/tests/unit/plugins/module_utils/_acme/test_errors.py +++ b/tests/unit/plugins/module_utils/_acme/test_errors.py @@ -17,7 +17,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.errors impo format_error_problem, ) - TEST_FORMAT_ERROR_PROBLEM: list[tuple[dict[str, t.Any], str, str]] = [ ( { diff --git a/tests/unit/plugins/module_utils/_acme/test_io.py b/tests/unit/plugins/module_utils/_acme/test_io.py index 2c61707b..81e29d7a 100644 --- a/tests/unit/plugins/module_utils/_acme/test_io.py +++ b/tests/unit/plugins/module_utils/_acme/test_io.py @@ -14,7 +14,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.io import ( write_file, ) - TEST_TEXT = r"""1234 5678""" diff --git a/tests/unit/plugins/module_utils/_acme/test_utils.py b/tests/unit/plugins/module_utils/_acme/test_utils.py index 04f525d8..3b09aef7 100644 --- a/tests/unit/plugins/module_utils/_acme/test_utils.py +++ b/tests/unit/plugins/module_utils/_acme/test_utils.py @@ -24,7 +24,6 @@ from ansible_collections.community.crypto.plugins.module_utils._acme.utils impor from .backend_data import TEST_PEM_DERS - NOPAD_B64: list[tuple[str, str]] = [ ("", ""), ("\n", "Cg"), diff --git a/tests/unit/plugins/module_utils/_crypto/test_asn1.py b/tests/unit/plugins/module_utils/_crypto/test_asn1.py index 97c48102..305856b3 100644 --- a/tests/unit/plugins/module_utils/_crypto/test_asn1.py +++ b/tests/unit/plugins/module_utils/_crypto/test_asn1.py @@ -15,7 +15,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto._asn1 imp serialize_asn1_string_as_der, ) - TEST_CASES: list[tuple[str, bytes]] = [ ("UTF8:Hello World", b"\x0c\x0b\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64"), ( diff --git a/tests/unit/plugins/module_utils/_crypto/test_pem.py b/tests/unit/plugins/module_utils/_crypto/test_pem.py index 83c2d395..018477dc 100644 --- a/tests/unit/plugins/module_utils/_crypto/test_pem.py +++ b/tests/unit/plugins/module_utils/_crypto/test_pem.py @@ -15,7 +15,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.pem impor split_pem_list, ) - PEM_TEST_CASES: list[ tuple[bytes, list[str], bool, t.Literal["raw", "pkcs1", "pkcs8", "unknown-pem"]] ] = [ diff --git a/tests/unit/plugins/module_utils/_openssh/test_certificate.py b/tests/unit/plugins/module_utils/_openssh/test_certificate.py index 0d5b1d5c..11fa9287 100644 --- a/tests/unit/plugins/module_utils/_openssh/test_certificate.py +++ b/tests/unit/plugins/module_utils/_openssh/test_certificate.py @@ -15,7 +15,6 @@ from ansible_collections.community.crypto.plugins.module_utils._openssh.certific parse_option_list, ) - # Type: ssh-rsa-cert-v01@openssh.com user certificate # Public key: RSA-CERT SHA256:SvUwwUer4AwsdePYseJR3LcZS8lnKi6BqiL51Dop030 # Signing CA: DSA SHA256:YCdJ2lYU+FSkWUud7zg1SJszprXoRGNU/GVcqXUjgC8 diff --git a/tests/unit/plugins/module_utils/_openssh/test_cryptography.py b/tests/unit/plugins/module_utils/_openssh/test_cryptography.py index 99ddf2b2..7faea568 100644 --- a/tests/unit/plugins/module_utils/_openssh/test_cryptography.py +++ b/tests/unit/plugins/module_utils/_openssh/test_cryptography.py @@ -24,7 +24,6 @@ from ansible_collections.community.crypto.plugins.module_utils._openssh.cryptogr OpensshKeypair, ) - if t.TYPE_CHECKING: from ansible_collections.community.crypto.plugins.module_utils._openssh.cryptography import ( # pragma: no cover KeyType, diff --git a/tests/unit/plugins/module_utils/_openssh/test_utils.py b/tests/unit/plugins/module_utils/_openssh/test_utils.py index f15ed7d9..957879e9 100644 --- a/tests/unit/plugins/module_utils/_openssh/test_utils.py +++ b/tests/unit/plugins/module_utils/_openssh/test_utils.py @@ -14,7 +14,6 @@ from ansible_collections.community.crypto.plugins.module_utils._openssh.utils im parse_openssh_version, ) - SSH_VERSION_STRING = "OpenSSH_7.9p1, OpenSSL 1.1.0i-fips 14 Aug 2018" SSH_VERSION_NUMBER = "7.9" diff --git a/tests/unit/plugins/module_utils/test__time.py b/tests/unit/plugins/module_utils/test__time.py index f298e141..72f7752b 100644 --- a/tests/unit/plugins/module_utils/test__time.py +++ b/tests/unit/plugins/module_utils/test__time.py @@ -22,7 +22,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import ( remove_timezone, ) - TIMEZONES = [ datetime.timedelta(hours=0), datetime.timedelta(hours=1),