Clean up other Python files (#11379)

* Address issues found by ruff check.

* Make mypy happy; remove some Python 2 compat code.

* Also declare port1.
This commit is contained in:
Felix Fontein
2026-01-05 17:59:58 +01:00
committed by GitHub
parent 75234597bc
commit b3dc06a7dd
16 changed files with 52 additions and 47 deletions

View File

@@ -9,7 +9,7 @@ from ansible.playbook.conditional import Conditional
from ansible.plugins.action import ActionBase
try:
from ansible.utils.datatag import trust_value as _trust_value
from ansible.utils.datatag import trust_value as _trust_value # type: ignore[import-not-found]
except ImportError:
def _trust_value(input):

View File

@@ -51,11 +51,10 @@ def main():
with runner.context(p["arg_order"], check_mode_skip=p["check_mode_skip"]) as ctx:
result = ctx.run(**p["arg_values"])
info = ctx.run_info
check = "check"
rc, out, err = result if result is not None else (None, None, None)
module.exit_json(rc=rc, out=out, err=err, info=info)
except Exception as exc:
except Exception:
module.fail_json(rc=1, module_stderr=traceback.format_exc(), msg="Module crashed with exception")