mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-06 21:33:00 +00:00
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:
@@ -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",)
|
||||
|
||||
Reference in New Issue
Block a user