1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-05-02 08:22:52 +00:00

CI: add type checking (#10997)

* Set up type checking with mypy.

* Make mypy pass.

* Use list() instead of sorted().
This commit is contained in:
Felix Fontein 2025-10-29 18:13:38 +01:00 committed by GitHub
parent 831787619a
commit 6088b0cff5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
73 changed files with 442 additions and 175 deletions

View file

@ -5,13 +5,15 @@
from __future__ import annotations
import typing as t
from ansible.module_utils.common.text.converters import to_native
class ModuleHelperException(Exception):
def __init__(self, msg, update_output=None, *args, **kwargs):
self.msg = to_native(msg or f"Module failed with exception: {self}")
def __init__(self, msg: str, update_output: dict[str, t.Any] | None = None, *args, **kwargs):
self.msg: str = to_native(msg or f"Module failed with exception: {self}")
if update_output is None:
update_output = {}
self.update_output = update_output
self.update_output: dict[str, t.Any] = update_output
super(ModuleHelperException, self).__init__(*args)