From b8adc3b241a4b726eb2e78a05294b8e602b89e16 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 24 May 2025 08:30:31 +0200 Subject: [PATCH] Use ruff format, and then undo most changes with black and isort. (#903) --- plugins/doc_fragments/_acme.py | 1 - plugins/doc_fragments/_attributes.py | 1 - plugins/doc_fragments/_module_certificate.py | 1 - plugins/doc_fragments/_module_csr.py | 1 - plugins/doc_fragments/_module_privatekey.py | 1 - plugins/doc_fragments/_module_privatekey_convert.py | 1 - plugins/module_utils/_acme/account.py | 3 +-- plugins/module_utils/_acme/backend_cryptography.py | 3 +-- plugins/module_utils/_acme/certificate.py | 3 +-- plugins/module_utils/_crypto/cryptography_support.py | 2 +- plugins/module_utils/_crypto/module_backends/csr.py | 3 +-- .../_crypto/module_backends/privatekey.py | 1 - .../_crypto/module_backends/privatekey_info.py | 5 +---- plugins/module_utils/_crypto/support.py | 1 - .../module_utils/_openssh/backends/keypair_backend.py | 4 +--- plugins/module_utils/_openssh/certificate.py | 3 +-- plugins/module_utils/_openssh/cryptography.py | 4 ++-- plugins/modules/acme_certificate_renewal_info.py | 3 +-- plugins/modules/certificate_complete_chain.py | 3 +-- plugins/modules/luks_device.py | 11 +++-------- plugins/modules/openssh_keypair.py | 1 - plugins/modules/openssl_csr.py | 1 - plugins/modules/openssl_dhparam.py | 7 +------ plugins/modules/openssl_pkcs12.py | 4 +++- plugins/modules/openssl_privatekey.py | 2 -- plugins/modules/openssl_privatekey_convert.py | 1 - plugins/modules/openssl_privatekey_info.py | 3 ++- plugins/modules/openssl_publickey.py | 2 -- plugins/modules/openssl_publickey_info.py | 3 ++- plugins/modules/openssl_signature.py | 2 -- plugins/modules/openssl_signature_info.py | 2 -- plugins/modules/x509_crl.py | 1 - .../module_utils/_openssh/test_cryptography.py | 1 - tests/unit/plugins/modules/test_luks_device.py | 1 - 34 files changed, 23 insertions(+), 63 deletions(-) diff --git a/plugins/doc_fragments/_acme.py b/plugins/doc_fragments/_acme.py index c708cd68..ee44ad34 100644 --- a/plugins/doc_fragments/_acme.py +++ b/plugins/doc_fragments/_acme.py @@ -9,7 +9,6 @@ from __future__ import annotations class ModuleDocFragment: - # Basic documentation fragment without account data BASIC = r""" notes: diff --git a/plugins/doc_fragments/_attributes.py b/plugins/doc_fragments/_attributes.py index 464131b7..80dc044b 100644 --- a/plugins/doc_fragments/_attributes.py +++ b/plugins/doc_fragments/_attributes.py @@ -9,7 +9,6 @@ from __future__ import annotations class ModuleDocFragment: - # Standard documentation fragment DOCUMENTATION = r""" options: {} diff --git a/plugins/doc_fragments/_module_certificate.py b/plugins/doc_fragments/_module_certificate.py index c21e6533..1299cd6d 100644 --- a/plugins/doc_fragments/_module_certificate.py +++ b/plugins/doc_fragments/_module_certificate.py @@ -10,7 +10,6 @@ from __future__ import annotations class ModuleDocFragment: - # Standard files documentation fragment DOCUMENTATION = r""" description: diff --git a/plugins/doc_fragments/_module_csr.py b/plugins/doc_fragments/_module_csr.py index abb3ecb7..a14ac6cc 100644 --- a/plugins/doc_fragments/_module_csr.py +++ b/plugins/doc_fragments/_module_csr.py @@ -9,7 +9,6 @@ from __future__ import annotations class ModuleDocFragment: - # Standard files documentation fragment DOCUMENTATION = r""" description: diff --git a/plugins/doc_fragments/_module_privatekey.py b/plugins/doc_fragments/_module_privatekey.py index 2d4ae793..a5bcb2a2 100644 --- a/plugins/doc_fragments/_module_privatekey.py +++ b/plugins/doc_fragments/_module_privatekey.py @@ -9,7 +9,6 @@ from __future__ import annotations class ModuleDocFragment: - # Standard files documentation fragment DOCUMENTATION = r""" description: diff --git a/plugins/doc_fragments/_module_privatekey_convert.py b/plugins/doc_fragments/_module_privatekey_convert.py index 70c66f9f..b8fb28bb 100644 --- a/plugins/doc_fragments/_module_privatekey_convert.py +++ b/plugins/doc_fragments/_module_privatekey_convert.py @@ -9,7 +9,6 @@ from __future__ import annotations class ModuleDocFragment: - # Standard files documentation fragment DOCUMENTATION = r""" requirements: diff --git a/plugins/module_utils/_acme/account.py b/plugins/module_utils/_acme/account.py index 43516a7b..0b61e7f1 100644 --- a/plugins/module_utils/_acme/account.py +++ b/plugins/module_utils/_acme/account.py @@ -99,8 +99,7 @@ class ACMEAccount: and allow_creation ): raise ModuleFailException( - "To create an account, an external account binding must be specified. " - "Use the acme_account module with the external_account_binding option." + "To create an account, an external account binding must be specified. Use the acme_account module with the external_account_binding option." ) result, info = self.client.send_signed_request( diff --git a/plugins/module_utils/_acme/backend_cryptography.py b/plugins/module_utils/_acme/backend_cryptography.py index 86ecdac2..a1e51201 100644 --- a/plugins/module_utils/_acme/backend_cryptography.py +++ b/plugins/module_utils/_acme/backend_cryptography.py @@ -108,8 +108,7 @@ class CryptographyChainMatcher(ChainMatcher): ) else: module.warn( - f"Criterium {criterium_idx} in select_chain has invalid {name} value. " - "Ignoring criterium." + f"Criterium {criterium_idx} in select_chain has invalid {name} value. Ignoring criterium." ) return None diff --git a/plugins/module_utils/_acme/certificate.py b/plugins/module_utils/_acme/certificate.py index 8d3dd752..765d23c1 100644 --- a/plugins/module_utils/_acme/certificate.py +++ b/plugins/module_utils/_acme/certificate.py @@ -191,8 +191,7 @@ class ACMECertificateClient: if bad_authzs: bad_authzs_str = ", ".join(sorted(bad_authzs)) raise ModuleFailException( - "Some of the authorizations for the order are in a bad state, so the order" - f" can no longer be satisfied: {bad_authzs_str}", + f"Some of the authorizations for the order are in a bad state, so the order can no longer be satisfied: {bad_authzs_str}", ) def collect_invalid_authzs(self, order: Order) -> list[Authorization]: diff --git a/plugins/module_utils/_crypto/cryptography_support.py b/plugins/module_utils/_crypto/cryptography_support.py index e4f6db0e..cd370327 100644 --- a/plugins/module_utils/_crypto/cryptography_support.py +++ b/plugins/module_utils/_crypto/cryptography_support.py @@ -486,7 +486,7 @@ def _adjust_idn_email( idx = value.find("@") if idx < 0: return value - return f"{value[:idx]}@{_adjust_idn(value[idx + 1:], idn_rewrite=idn_rewrite)}" + return f"{value[:idx]}@{_adjust_idn(value[idx + 1 :], idn_rewrite=idn_rewrite)}" def _adjust_idn_url( diff --git a/plugins/module_utils/_crypto/module_backends/csr.py b/plugins/module_utils/_crypto/module_backends/csr.py index 426ae8f9..57d70b3e 100644 --- a/plugins/module_utils/_crypto/module_backends/csr.py +++ b/plugins/module_utils/_crypto/module_backends/csr.py @@ -525,8 +525,7 @@ class CertificateSigningRequestCryptographyBackend(CertificateSigningRequestBack if self.using_common_name_for_san: self.module.fail_json( msg=msg - + "This is probably caused because the Common Name is used as a SAN." - " Specifying use_common_name_for_san=false might fix this." + + "This is probably caused because the Common Name is used as a SAN. Specifying use_common_name_for_san=false might fix this." ) self.module.fail_json( msg=msg diff --git a/plugins/module_utils/_crypto/module_backends/privatekey.py b/plugins/module_utils/_crypto/module_backends/privatekey.py index 17651524..790374a2 100644 --- a/plugins/module_utils/_crypto/module_backends/privatekey.py +++ b/plugins/module_utils/_crypto/module_backends/privatekey.py @@ -312,7 +312,6 @@ class _Curve: # Implementation with using cryptography class PrivateKeyCryptographyBackend(PrivateKeyBackend): - def _add_curve( self, name: str, diff --git a/plugins/module_utils/_crypto/module_backends/privatekey_info.py b/plugins/module_utils/_crypto/module_backends/privatekey_info.py index 65acdc62..07f65a9f 100644 --- a/plugins/module_utils/_crypto/module_backends/privatekey_info.py +++ b/plugins/module_utils/_crypto/module_backends/privatekey_info.py @@ -283,10 +283,7 @@ class PrivateKeyInfoRetrieval(metaclass=abc.ABCMeta): ) if result["key_is_consistent"] is False: # Only fail when it is False, to avoid to fail on None (which means "we do not know") - msg = ( - "Private key is not consistent! (See " - "https://blog.hboeck.de/archives/888-How-I-tricked-Symantec-with-a-Fake-Private-Key.html)" - ) + msg = "Private key is not consistent! (See https://blog.hboeck.de/archives/888-How-I-tricked-Symantec-with-a-Fake-Private-Key.html)" raise PrivateKeyConsistencyError(msg, result=result) return result diff --git a/plugins/module_utils/_crypto/support.py b/plugins/module_utils/_crypto/support.py index 6a58eabb..d6525297 100644 --- a/plugins/module_utils/_crypto/support.py +++ b/plugins/module_utils/_crypto/support.py @@ -381,7 +381,6 @@ def select_message_digest( class OpenSSLObject(metaclass=abc.ABCMeta): - def __init__(self, *, path: str, state: str, force: bool, check_mode: bool) -> None: self.path = path self.state = state diff --git a/plugins/module_utils/_openssh/backends/keypair_backend.py b/plugins/module_utils/_openssh/backends/keypair_backend.py index 13363729..7c15de68 100644 --- a/plugins/module_utils/_openssh/backends/keypair_backend.py +++ b/plugins/module_utils/_openssh/backends/keypair_backend.py @@ -52,7 +52,6 @@ if t.TYPE_CHECKING: class KeypairBackend(OpensshModule, metaclass=abc.ABCMeta): - def __init__(self, *, module: AnsibleModule) -> None: super().__init__(module=module) @@ -567,8 +566,7 @@ def select_backend( else: module.fail_json( msg=( - "Cannot find either the OpenSSH binary in the PATH " - f"or cryptography >= {COLLECTION_MINIMUM_CRYPTOGRAPHY_VERSION} installed on this system" + f"Cannot find either the OpenSSH binary in the PATH or cryptography >= {COLLECTION_MINIMUM_CRYPTOGRAPHY_VERSION} installed on this system" ) ) diff --git a/plugins/module_utils/_openssh/certificate.py b/plugins/module_utils/_openssh/certificate.py index c86bcbd8..35c08980 100644 --- a/plugins/module_utils/_openssh/certificate.py +++ b/plugins/module_utils/_openssh/certificate.py @@ -779,8 +779,7 @@ def get_option_type(name: str) -> t.Literal["critical", "extension"]: if name in _EXTENSIONS: return "extension" raise ValueError( - f"{name} is not a valid option. " - "Custom options must start with 'critical:' or 'extension:' to indicate type" + f"{name} is not a valid option. Custom options must start with 'critical:' or 'extension:' to indicate type" ) diff --git a/plugins/module_utils/_openssh/cryptography.py b/plugins/module_utils/_openssh/cryptography.py index 93a6ca85..bde1bdf8 100644 --- a/plugins/module_utils/_openssh/cryptography.py +++ b/plugins/module_utils/_openssh/cryptography.py @@ -370,7 +370,8 @@ class AsymmetricKeypair: try: return self.__privatekey.sign( - data, **_ALGORITHM_PARAMETERS[self.__keytype]["signer_params"] # type: ignore + data, + **_ALGORITHM_PARAMETERS[self.__keytype]["signer_params"], # type: ignore ) except TypeError as e: raise InvalidDataError(e) from e @@ -788,7 +789,6 @@ def validate_comment(comment: str) -> None: def extract_comment(path: str | os.PathLike) -> str: - if not os.path.exists(path): raise InvalidPublicKeyFileError(f"No file was found at {path}") diff --git a/plugins/modules/acme_certificate_renewal_info.py b/plugins/modules/acme_certificate_renewal_info.py index 9ec02692..77b66fa1 100644 --- a/plugins/modules/acme_certificate_renewal_info.py +++ b/plugins/modules/acme_certificate_renewal_info.py @@ -310,8 +310,7 @@ def main() -> t.NoReturn: if timestamp < now: complete( True, - msg=f"The remaining percentage {module.params['remaining_percentage'] * 100}%" - f" of the certificate's lifespan was reached on {timestamp}", + msg=f"The remaining percentage {module.params['remaining_percentage'] * 100}% of the certificate's lifespan was reached on {timestamp}", ) complete(False) diff --git a/plugins/modules/certificate_complete_chain.py b/plugins/modules/certificate_complete_chain.py index 0e4bfdfc..172e2d5d 100644 --- a/plugins/modules/certificate_complete_chain.py +++ b/plugins/modules/certificate_complete_chain.py @@ -368,8 +368,7 @@ def main() -> t.NoReturn: if not is_parent(module, chain[i - 1], parent): module.fail_json( msg=( - f"Cannot verify input chain: certificate #{i + 1}: {format_cert(parent)} is not issuer " - f"of certificate #{i}: {format_cert(chain[i - 1])}" + f"Cannot verify input chain: certificate #{i + 1}: {format_cert(parent)} is not issuer of certificate #{i}: {format_cert(chain[i - 1])}" ) ) diff --git a/plugins/modules/luks_device.py b/plugins/modules/luks_device.py index d6b81205..e10a9ef4 100644 --- a/plugins/modules/luks_device.py +++ b/plugins/modules/luks_device.py @@ -474,7 +474,6 @@ def wipe_luks_headers(device: str) -> None: class Handler: - def __init__(self, module: AnsibleModule) -> None: self._module = module self._lsblk_bin = self._module.get_bin_path("lsblk", True) @@ -534,7 +533,6 @@ class Handler: class CryptHandler(Handler): - def __init__(self, module: AnsibleModule) -> None: super().__init__(module) self._cryptsetup_bin = self._module.get_bin_path("cryptsetup", True) @@ -807,8 +805,7 @@ class CryptHandler(Handler): keyslot_area = False if keyslot_count < 2: self._module.fail_json( - msg=f"LUKS device {device} has less than two active keyslots. " - "To be able to remove a key, please set `force_remove_last_key` to `true`." + msg=f"LUKS device {device} has less than two active keyslots. To be able to remove a key, please set `force_remove_last_key` to `true`." ) if keyslot is None: @@ -867,7 +864,6 @@ class CryptHandler(Handler): class ConditionsHandler(Handler): - def __init__(self, module: AnsibleModule, crypthandler: CryptHandler) -> None: super().__init__(module) self._crypthandler = crypthandler @@ -988,7 +984,7 @@ class ConditionsHandler(Handler): if self._module.params["state"] == "absent": self._module.fail_json( - msg="Contradiction in setup: Asking to " "add a key to absent LUKS." + msg="Contradiction in setup: Asking to add a key to absent LUKS." ) key_present = self._crypthandler.luks_test_key( @@ -1021,8 +1017,7 @@ class ConditionsHandler(Handler): if self._module.params["state"] == "absent": self._module.fail_json( - msg="Contradiction in setup: Asking to " - "remove a key from absent LUKS." + msg="Contradiction in setup: Asking to remove a key from absent LUKS." ) if self._module.params["remove_keyslot"] is not None: diff --git a/plugins/modules/openssh_keypair.py b/plugins/modules/openssh_keypair.py index 0b1ac4ad..a0f79905 100644 --- a/plugins/modules/openssh_keypair.py +++ b/plugins/modules/openssh_keypair.py @@ -207,7 +207,6 @@ from ansible_collections.community.crypto.plugins.module_utils._openssh.backends def main() -> t.NoReturn: - module = AnsibleModule( argument_spec={ "state": { diff --git a/plugins/modules/openssl_csr.py b/plugins/modules/openssl_csr.py index 8c90903d..ae6ad4c3 100644 --- a/plugins/modules/openssl_csr.py +++ b/plugins/modules/openssl_csr.py @@ -265,7 +265,6 @@ if t.TYPE_CHECKING: class CertificateSigningRequestModule(OpenSSLObject): - def __init__( self, module: AnsibleModule, module_backend: CertificateSigningRequestBackend ) -> None: diff --git a/plugins/modules/openssl_dhparam.py b/plugins/modules/openssl_dhparam.py index 9799b0fe..ec753aa6 100644 --- a/plugins/modules/openssl_dhparam.py +++ b/plugins/modules/openssl_dhparam.py @@ -173,7 +173,6 @@ class DHParameterError(Exception): class DHParameterBase: - def __init__(self, module: AnsibleModule) -> None: self.state: t.Literal["absent", "present"] = module.params["state"] self.path: str = module.params["path"] @@ -250,7 +249,6 @@ class DHParameterBase: class DHParameterAbsent(DHParameterBase): - def __init__(self, module: AnsibleModule) -> None: super().__init__(module) @@ -263,7 +261,6 @@ class DHParameterAbsent(DHParameterBase): class DHParameterOpenSSL(DHParameterBase): - def __init__(self, module: AnsibleModule) -> None: super().__init__(module) self.openssl_bin = module.get_bin_path("openssl", True) @@ -318,7 +315,6 @@ class DHParameterOpenSSL(DHParameterBase): class DHParameterCryptography(DHParameterBase): - def __init__(self, module: AnsibleModule) -> None: super().__init__(module) @@ -408,8 +404,7 @@ def main() -> t.NoReturn: if backend == "auto": module.fail_json( msg=( - f"Cannot detect either the required Python library cryptography (>= {MINIMAL_CRYPTOGRAPHY_VERSION}) " - "or the OpenSSL binary openssl" + f"Cannot detect either the required Python library cryptography (>= {MINIMAL_CRYPTOGRAPHY_VERSION}) or the OpenSSL binary openssl" ) ) diff --git a/plugins/modules/openssl_pkcs12.py b/plugins/modules/openssl_pkcs12.py index 4f12b2c8..548e9e24 100644 --- a/plugins/modules/openssl_pkcs12.py +++ b/plugins/modules/openssl_pkcs12.py @@ -599,7 +599,9 @@ class Pkcs(OpenSSLObject): self.backup_file = module.backup_local(self.path) super().remove(module) - def parse(self) -> tuple[ + def parse( + self, + ) -> tuple[ bytes | None, bytes | None, list[bytes], diff --git a/plugins/modules/openssl_privatekey.py b/plugins/modules/openssl_privatekey.py index 76118b7f..da0f5a0c 100644 --- a/plugins/modules/openssl_privatekey.py +++ b/plugins/modules/openssl_privatekey.py @@ -181,7 +181,6 @@ if t.TYPE_CHECKING: class PrivateKeyModule(OpenSSLObject): - def __init__( self, module: AnsibleModule, module_backend: PrivateKeyBackend ) -> None: @@ -255,7 +254,6 @@ class PrivateKeyModule(OpenSSLObject): def main() -> t.NoReturn: - argument_spec = get_privatekey_argument_spec() argument_spec.argument_spec.update( { diff --git a/plugins/modules/openssl_privatekey_convert.py b/plugins/modules/openssl_privatekey_convert.py index ee8e3735..2f01640b 100644 --- a/plugins/modules/openssl_privatekey_convert.py +++ b/plugins/modules/openssl_privatekey_convert.py @@ -142,7 +142,6 @@ class PrivateKeyConvertModule(OpenSSLObject): def main() -> t.NoReturn: - argument_spec = get_privatekey_argument_spec() argument_spec.argument_spec.update( { diff --git a/plugins/modules/openssl_privatekey_info.py b/plugins/modules/openssl_privatekey_info.py index 7cd8da55..242a7584 100644 --- a/plugins/modules/openssl_privatekey_info.py +++ b/plugins/modules/openssl_privatekey_info.py @@ -246,7 +246,8 @@ def main() -> t.NoReturn: data = f.read() except (IOError, OSError) as e: module.fail_json( - msg=f"Error while reading private key file from disk: {e}", **result # type: ignore + msg=f"Error while reading private key file from disk: {e}", + **result, # type: ignore ) result["can_load_key"] = True diff --git a/plugins/modules/openssl_publickey.py b/plugins/modules/openssl_publickey.py index 1aa89102..c82f75c9 100644 --- a/plugins/modules/openssl_publickey.py +++ b/plugins/modules/openssl_publickey.py @@ -231,7 +231,6 @@ class PublicKeyError(OpenSSLObjectError): class PublicKey(OpenSSLObject): - def __init__(self, module: AnsibleModule) -> None: super().__init__( path=module.params["path"], @@ -415,7 +414,6 @@ class PublicKey(OpenSSLObject): def main() -> t.NoReturn: - module = AnsibleModule( argument_spec={ "state": { diff --git a/plugins/modules/openssl_publickey_info.py b/plugins/modules/openssl_publickey_info.py index b923aa45..d5a55f34 100644 --- a/plugins/modules/openssl_publickey_info.py +++ b/plugins/modules/openssl_publickey_info.py @@ -194,7 +194,8 @@ def main() -> t.NoReturn: data = f.read() except (IOError, OSError) as e: module.fail_json( - msg=f"Error while reading public key file from disk: {e}", **result # type: ignore + msg=f"Error while reading public key file from disk: {e}", + **result, # type: ignore ) module_backend = select_backend(module=module, content=data) diff --git a/plugins/modules/openssl_signature.py b/plugins/modules/openssl_signature.py index ea7c9be0..846e08ec 100644 --- a/plugins/modules/openssl_signature.py +++ b/plugins/modules/openssl_signature.py @@ -132,7 +132,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.support i class SignatureBase(OpenSSLObject): - def __init__(self, module: AnsibleModule) -> None: super().__init__( path=module.params["path"], @@ -161,7 +160,6 @@ class SignatureBase(OpenSSLObject): # Implementation with using cryptography class SignatureCryptography(SignatureBase): - def __init__(self, module: AnsibleModule) -> None: super().__init__(module) diff --git a/plugins/modules/openssl_signature_info.py b/plugins/modules/openssl_signature_info.py index 76bc2221..3322f022 100644 --- a/plugins/modules/openssl_signature_info.py +++ b/plugins/modules/openssl_signature_info.py @@ -121,7 +121,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.support i class SignatureInfoBase(OpenSSLObject): - def __init__(self, module: AnsibleModule) -> None: super().__init__( path=module.params["path"], @@ -150,7 +149,6 @@ class SignatureInfoBase(OpenSSLObject): # Implementation with using cryptography class SignatureInfoCryptography(SignatureInfoBase): - def __init__(self, module: AnsibleModule) -> None: super().__init__(module) diff --git a/plugins/modules/x509_crl.py b/plugins/modules/x509_crl.py index 308b644c..e659e5ad 100644 --- a/plugins/modules/x509_crl.py +++ b/plugins/modules/x509_crl.py @@ -505,7 +505,6 @@ class CRLError(OpenSSLObjectError): class CRL(OpenSSLObject): - def __init__(self, module: AnsibleModule) -> None: super().__init__( path=module.params["path"], diff --git a/tests/unit/plugins/module_utils/_openssh/test_cryptography.py b/tests/unit/plugins/module_utils/_openssh/test_cryptography.py index a27cafe4..c77cb74b 100644 --- a/tests/unit/plugins/module_utils/_openssh/test_cryptography.py +++ b/tests/unit/plugins/module_utils/_openssh/test_cryptography.py @@ -230,7 +230,6 @@ def test_invalid_key_sizes( @pytest.mark.skipif(not HAS_OPENSSH_SUPPORT, reason="requires cryptography") def test_valid_comment_update() -> None: - pair = OpensshKeypair.generate() new_comment = "comment" try: diff --git a/tests/unit/plugins/modules/test_luks_device.py b/tests/unit/plugins/modules/test_luks_device.py index 45d22a64..b703f701 100644 --- a/tests/unit/plugins/modules/test_luks_device.py +++ b/tests/unit/plugins/modules/test_luks_device.py @@ -440,7 +440,6 @@ def test_luks_remove_key( expected: bool | t.Literal["exception"], monkeypatch, ) -> None: - module = DummyModule() module.params["device"] = device module.params["passphrase_encoding"] = "text"