mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-07 22:03:01 +00:00
Avoid deprecated typing.Callable. (#959)
This commit is contained in:
@@ -9,6 +9,7 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
import typing as t
|
||||
from collections.abc import Callable
|
||||
|
||||
from ansible_collections.community.crypto.plugins.module_utils._acme.account import (
|
||||
ACMEAccount,
|
||||
@@ -213,7 +214,7 @@ class ACMECertificateClient:
|
||||
self,
|
||||
pending_authzs: list[Authorization],
|
||||
*,
|
||||
get_challenge: t.Callable[[Authorization], str],
|
||||
get_challenge: Callable[[Authorization], str],
|
||||
wait: bool = True,
|
||||
) -> list[tuple[Authorization, str, Challenge | None]]:
|
||||
authzs_with_challenges_to_wait_for = []
|
||||
|
||||
@@ -10,6 +10,7 @@ from __future__ import annotations
|
||||
|
||||
import time
|
||||
import typing as t
|
||||
from collections.abc import Callable
|
||||
|
||||
from ansible_collections.community.crypto.plugins.module_utils._acme.challenges import (
|
||||
Authorization,
|
||||
@@ -126,7 +127,7 @@ class Order:
|
||||
error_max_retries: int = 3,
|
||||
replaces_cert_id: str | None = None,
|
||||
profile: str | None = None,
|
||||
message_callback: t.Callable[[str], None] | None = None,
|
||||
message_callback: Callable[[str], None] | None = None,
|
||||
) -> _Order:
|
||||
"""
|
||||
error_strategy can be one of the following strings:
|
||||
|
||||
@@ -15,6 +15,7 @@ import re
|
||||
import textwrap
|
||||
import traceback
|
||||
import typing as t
|
||||
from collections.abc import Callable
|
||||
from urllib.parse import unquote
|
||||
|
||||
from ansible_collections.community.crypto.plugins.module_utils._acme.errors import (
|
||||
@@ -85,7 +86,7 @@ def pem_to_der(
|
||||
|
||||
|
||||
def process_links(
|
||||
*, info: dict[str, t.Any], callback: t.Callable[[str, str], None]
|
||||
*, info: dict[str, t.Any], callback: Callable[[str, str], None]
|
||||
) -> None:
|
||||
"""
|
||||
Process link header, calls callback for every link header with the URL and relation as options.
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import typing as t
|
||||
from collections.abc import Callable
|
||||
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_text
|
||||
|
||||
@@ -131,7 +132,7 @@ def _is_cryptography_key_consistent(
|
||||
*,
|
||||
key_public_data: dict[str, t.Any],
|
||||
key_private_data: dict[str, t.Any],
|
||||
warn_func: t.Callable[[str], None] | None = None,
|
||||
warn_func: Callable[[str], None] | None = None,
|
||||
) -> bool | None:
|
||||
if isinstance(key, cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey):
|
||||
# key._backend was removed in cryptography 42.0.0
|
||||
|
||||
@@ -12,6 +12,7 @@ import os
|
||||
import stat
|
||||
import traceback
|
||||
import typing as t
|
||||
from collections.abc import Callable
|
||||
|
||||
from ansible_collections.community.crypto.plugins.module_utils._openssh.utils import (
|
||||
parse_openssh_version,
|
||||
@@ -33,8 +34,8 @@ if t.TYPE_CHECKING:
|
||||
|
||||
|
||||
def restore_on_failure(
|
||||
f: t.Callable[t.Concatenate[AnsibleModule, str | os.PathLike, Param], None],
|
||||
) -> t.Callable[t.Concatenate[AnsibleModule, str | os.PathLike, Param], None]:
|
||||
f: Callable[t.Concatenate[AnsibleModule, str | os.PathLike, Param], None],
|
||||
) -> Callable[t.Concatenate[AnsibleModule, str | os.PathLike, Param], None]:
|
||||
def backup_and_restore(
|
||||
module: AnsibleModule,
|
||||
path: str | os.PathLike,
|
||||
@@ -63,13 +64,13 @@ def safe_atomic_move(
|
||||
|
||||
|
||||
def _restore_all_on_failure(
|
||||
f: t.Callable[
|
||||
f: Callable[
|
||||
t.Concatenate[
|
||||
OpensshModule, list[tuple[str | os.PathLike, str | os.PathLike]], Param
|
||||
],
|
||||
None,
|
||||
],
|
||||
) -> t.Callable[
|
||||
) -> Callable[
|
||||
t.Concatenate[
|
||||
OpensshModule, list[tuple[str | os.PathLike, str | os.PathLike]], Param
|
||||
],
|
||||
@@ -149,8 +150,8 @@ class OpensshModule(metaclass=abc.ABCMeta):
|
||||
|
||||
@staticmethod
|
||||
def skip_if_check_mode(
|
||||
f: t.Callable[t.Concatenate[_OpensshModule, Param], None],
|
||||
) -> t.Callable[t.Concatenate[_OpensshModule, Param], None]:
|
||||
f: Callable[t.Concatenate[_OpensshModule, Param], None],
|
||||
) -> Callable[t.Concatenate[_OpensshModule, Param], None]:
|
||||
def wrapper(
|
||||
self: _OpensshModule, *args: Param.args, **kwargs: Param.kwargs
|
||||
) -> None:
|
||||
@@ -161,8 +162,8 @@ class OpensshModule(metaclass=abc.ABCMeta):
|
||||
|
||||
@staticmethod
|
||||
def trigger_change(
|
||||
f: t.Callable[t.Concatenate[_OpensshModule, Param], None],
|
||||
) -> t.Callable[t.Concatenate[_OpensshModule, Param], None]:
|
||||
f: Callable[t.Concatenate[_OpensshModule, Param], None],
|
||||
) -> Callable[t.Concatenate[_OpensshModule, Param], None]:
|
||||
def wrapper(
|
||||
self: _OpensshModule, *args: Param.args, **kwargs: Param.kwargs
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user