From 1884f4045e58e1e0ad888854057ea50df2232f35 Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Sun, 23 Apr 2023 09:15:37 +0200 Subject: [PATCH] moved type definitons completly to overloaded methods --- plugins/module_utils/module.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/module_utils/module.py b/plugins/module_utils/module.py index 1b84b31..801f9f0 100644 --- a/plugins/module_utils/module.py +++ b/plugins/module_utils/module.py @@ -57,14 +57,24 @@ class AnsibleModule(object): def diff(self, diff: Dict[str, str]): pass + @overload def diff( self, - diff: Optional[Dict[str, str]] = None, - *, before: Optional[str] = None, after: Optional[str] = None, before_header: Optional[str] = None, after_header: Optional[str] = None, + ): + pass + + def diff( # type: ignore + self, + diff=None, + *, + before=None, + after=None, + before_header=None, + after_header=None, ): """adds the special return value "diff". This allows Modules to present the changes of files to the caller. it takes care of the special semantics of the return value""" if "diff" not in self.result: