Code refactoring (#889)

* Add __all__ to all module and plugin utils.

* Convert quite a few positional args to keyword args.

* Avoid Python 3.8+ syntax.
This commit is contained in:
Felix Fontein
2025-05-16 06:55:57 +02:00
committed by GitHub
parent a5a4e022ba
commit 44bcc8cebc
101 changed files with 1510 additions and 748 deletions

View File

@@ -19,7 +19,9 @@ from ansible_collections.community.crypto.plugins.module_utils._gnupg.cli import
class PluginGPGRunner(GPGRunner):
def __init__(self, executable: str | None = None, cwd: str | None = None) -> None:
def __init__(
self, *, executable: str | None = None, cwd: str | None = None
) -> None:
if executable is None:
try:
executable = get_bin_path("gpg")
@@ -29,7 +31,7 @@ class PluginGPGRunner(GPGRunner):
self.cwd = cwd
def run_command(
self, command: list[str], check_rc: bool = True, data: bytes | None = None
self, command: list[str], *, check_rc: bool = True, data: bytes | None = None
) -> tuple[int, str, str]:
"""
Run ``[gpg] + command`` and return ``(rc, stdout, stderr)``.
@@ -54,3 +56,6 @@ class PluginGPGRunner(GPGRunner):
f'Running {" ".join(command)} yielded return code {p.returncode} with stdout: "{stdout_n}" and stderr: "{stderr_n}")'
)
return t.cast(int, p.returncode), stdout_n, stderr_n
__all__ = ("PluginGPGRunner",)