mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-09 05:27:17 +00:00
Apply suggestions from code review.
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
65f546b4fd
commit
f6eb6d743d
5 changed files with 11 additions and 11 deletions
|
|
@ -88,7 +88,7 @@ class CmdRunner:
|
|||
default_args_order: str | Sequence[str] = (),
|
||||
check_rc: bool = False,
|
||||
force_lang: str = "C",
|
||||
path_prefix: list[str] | None = None,
|
||||
path_prefix: Sequence[str] | None = None,
|
||||
environ_update: dict[str, str] | None = None,
|
||||
):
|
||||
self.module = module
|
||||
|
|
@ -128,9 +128,9 @@ class CmdRunner:
|
|||
def __call__(
|
||||
self,
|
||||
args_order: str | Sequence[str] | None = None,
|
||||
output_process=None,
|
||||
output_process: Callable[[int, str, str], t.Any] | None = None,
|
||||
check_mode_skip: bool = False,
|
||||
check_mode_return=None,
|
||||
check_mode_return: t.Any | None = None,
|
||||
**kwargs,
|
||||
):
|
||||
if output_process is None:
|
||||
|
|
@ -162,9 +162,9 @@ class _CmdRunnerContext:
|
|||
self,
|
||||
runner: CmdRunner,
|
||||
args_order: tuple[str, ...],
|
||||
output_process,
|
||||
output_process: Callable[[int, str, str], t.Any],
|
||||
check_mode_skip: bool,
|
||||
check_mode_return,
|
||||
check_mode_return: t.Any,
|
||||
**kwargs,
|
||||
) -> None:
|
||||
self.runner = runner
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ from ansible.module_utils.common.collections import is_sequence
|
|||
if t.TYPE_CHECKING:
|
||||
from collections.abc import Callable, Mapping, Sequence
|
||||
|
||||
ArgFormatType = Callable[[t.Any], list[str]]
|
||||
ArgFormatType = Callable[[t.Any], Sequence[t.Any]]
|
||||
_T = t.TypeVar("_T")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ def gio_mime_runner(module: AnsibleModule, **kwargs) -> CmdRunner:
|
|||
)
|
||||
|
||||
|
||||
def gio_mime_get(runner: CmdRunner, mime_type):
|
||||
def process(rc, out, err):
|
||||
def gio_mime_get(runner: CmdRunner, mime_type) -> str | None:
|
||||
def process(rc, out, err) -> str | None:
|
||||
if err.startswith("No default applications for"):
|
||||
return None
|
||||
out = out.splitlines()[0]
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ class VarDict:
|
|||
def output(self, verbosity: int = 0) -> dict[str, t.Any]:
|
||||
return {n: v.value for n, v in self.__vars__.items() if v.output and v.is_visible(verbosity)}
|
||||
|
||||
def diff(self, verbosity: int = 0) -> dict[str, t.Any] | None:
|
||||
def diff(self, verbosity: int = 0) -> dict[str, dict[str, t.Any]] | None:
|
||||
diff_results = [
|
||||
(n, v.diff_result) for n, v in self.__vars__.items() if v.diff_result and v.is_visible(verbosity)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ def xdg_mime_runner(module: AnsibleModule, **kwargs) -> CmdRunner:
|
|||
)
|
||||
|
||||
|
||||
def xdg_mime_get(runner: CmdRunner, mime_type):
|
||||
def process(rc, out, err):
|
||||
def xdg_mime_get(runner: CmdRunner, mime_type) -> str | None:
|
||||
def process(rc, out, err) -> str | None:
|
||||
if not out.strip():
|
||||
return None
|
||||
out = out.splitlines()[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue