mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Add basic typing for module_utils.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
|
||||
|
||||
@@ -18,7 +19,7 @@ def _values_fmt(values, value_types):
|
||||
return result
|
||||
|
||||
|
||||
def xfconf_runner(module, **kwargs):
|
||||
def xfconf_runner(module: AnsibleModule, **kwargs) -> CmdRunner:
|
||||
runner = CmdRunner(
|
||||
module,
|
||||
command="xfconf-query",
|
||||
@@ -37,7 +38,7 @@ def xfconf_runner(module, **kwargs):
|
||||
return runner
|
||||
|
||||
|
||||
def get_xfconf_version(runner):
|
||||
def get_xfconf_version(runner: CmdRunner) -> str:
|
||||
with runner("version") as ctx:
|
||||
rc, out, err = ctx.run()
|
||||
return out.splitlines()[0].split()[1]
|
||||
|
||||
Reference in New Issue
Block a user