mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-06 13:22:58 +00:00
Fix/improve typing. (#905)
This commit is contained in:
@@ -144,7 +144,7 @@ class CertificateSigningRequestBackend(metaclass=abc.ABCMeta):
|
||||
)
|
||||
|
||||
self.ordered_subject = False
|
||||
self.subject = [
|
||||
subject = [
|
||||
("C", module.params["country_name"]),
|
||||
("ST", module.params["state_or_province_name"]),
|
||||
("L", module.params["locality_name"]),
|
||||
@@ -153,7 +153,9 @@ class CertificateSigningRequestBackend(metaclass=abc.ABCMeta):
|
||||
("CN", module.params["common_name"]),
|
||||
("emailAddress", module.params["email_address"]),
|
||||
]
|
||||
self.subject = [(entry[0], entry[1]) for entry in self.subject if entry[1]]
|
||||
self.subject: list[tuple[str, str]] = [
|
||||
(entry[0], entry[1]) for entry in subject if entry[1]
|
||||
]
|
||||
|
||||
try:
|
||||
if module.params["subject"]:
|
||||
|
||||
@@ -292,11 +292,27 @@ def load_certificate_request(
|
||||
raise OpenSSLObjectError(exc) from exc
|
||||
|
||||
|
||||
@t.overload
|
||||
def parse_name_field(
|
||||
input_dict: dict[str, list[str] | str],
|
||||
*,
|
||||
name_field_name: str | None = None,
|
||||
) -> list[tuple[str, str]]: ...
|
||||
|
||||
|
||||
@t.overload
|
||||
def parse_name_field(
|
||||
input_dict: dict[str, list[str | bytes] | str | bytes],
|
||||
*,
|
||||
name_field_name: str | None = None,
|
||||
) -> list[tuple[str, str | bytes]]:
|
||||
) -> list[tuple[str, str | bytes]]: ...
|
||||
|
||||
|
||||
def parse_name_field(
|
||||
input_dict: dict[str, t.Any],
|
||||
*,
|
||||
name_field_name: str | None = None,
|
||||
) -> list:
|
||||
"""Take a dict with key: value or key: list_of_values mappings and return a list of tuples"""
|
||||
|
||||
def error_str(key: str) -> str:
|
||||
@@ -328,11 +344,27 @@ def parse_name_field(
|
||||
return result
|
||||
|
||||
|
||||
@t.overload
|
||||
def parse_ordered_name_field(
|
||||
input_list: list[dict[str, list[str] | str]],
|
||||
*,
|
||||
name_field_name: str,
|
||||
) -> list[tuple[str, str]]: ...
|
||||
|
||||
|
||||
@t.overload
|
||||
def parse_ordered_name_field(
|
||||
input_list: list[dict[str, list[str | bytes] | str | bytes]],
|
||||
*,
|
||||
name_field_name: str,
|
||||
) -> list[tuple[str, str | bytes]]:
|
||||
) -> list[tuple[str, str | bytes]]: ...
|
||||
|
||||
|
||||
def parse_ordered_name_field(
|
||||
input_list: list[dict[str, t.Any]],
|
||||
*,
|
||||
name_field_name: str,
|
||||
) -> list:
|
||||
"""Take a dict with key: value or key: list_of_values mappings and return a list of tuples"""
|
||||
|
||||
result = []
|
||||
|
||||
Reference in New Issue
Block a user