mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-07 13:53:06 +00:00
Improve type hints. (#913)
This commit is contained in:
@@ -301,7 +301,9 @@ def openssl_csr_info_filter(
|
||||
raise AnsibleFilterError(
|
||||
f"The name_encoding option must be of a text type, not {type(name_encoding)}"
|
||||
)
|
||||
name_encoding = to_text(name_encoding)
|
||||
name_encoding = t.cast(
|
||||
t.Literal["ignore", "idna", "unicode"], to_text(name_encoding)
|
||||
)
|
||||
if name_encoding not in ("ignore", "idna", "unicode"):
|
||||
raise AnsibleFilterError(
|
||||
f'The name_encoding option must be one of the values "ignore", "idna", or "unicode", not "{name_encoding}"'
|
||||
|
||||
@@ -335,7 +335,9 @@ def x509_certificate_info_filter(
|
||||
raise AnsibleFilterError(
|
||||
f"The name_encoding option must be of a text type, not {type(name_encoding)}"
|
||||
)
|
||||
name_encoding = to_text(name_encoding)
|
||||
name_encoding = t.cast(
|
||||
t.Literal["ignore", "idna", "unicode"], to_text(name_encoding)
|
||||
)
|
||||
if name_encoding not in ("ignore", "idna", "unicode"):
|
||||
raise AnsibleFilterError(
|
||||
f'The name_encoding option must be one of the values "ignore", "idna", or "unicode", not "{name_encoding}"'
|
||||
|
||||
@@ -191,7 +191,9 @@ def x509_crl_info_filter(
|
||||
raise AnsibleFilterError(
|
||||
f"The list_revoked_certificates option must be a boolean, not {type(list_revoked_certificates)}"
|
||||
)
|
||||
name_encoding = to_text(name_encoding)
|
||||
name_encoding = t.cast(
|
||||
t.Literal["ignore", "idna", "unicode"], to_text(name_encoding)
|
||||
)
|
||||
if name_encoding not in ("ignore", "idna", "unicode"):
|
||||
raise AnsibleFilterError(
|
||||
f'The name_encoding option must be one of the values "ignore", "idna", or "unicode", not "{name_encoding}"'
|
||||
|
||||
Reference in New Issue
Block a user