From 144ffc72a52503b5c4c4b46b34ce198e385b389c Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Fri, 14 Mar 2025 08:35:47 +0100 Subject: [PATCH] some clean up of the code --- plugins/module_utils/generic.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/module_utils/generic.py b/plugins/module_utils/generic.py index 5e4c5b4..c187eac 100644 --- a/plugins/module_utils/generic.py +++ b/plugins/module_utils/generic.py @@ -23,9 +23,9 @@ def wrap_func(func, **updates): def wrapper(*args, **kwargs): return func(*args, **kwargs) - attrs = frozenset( - ('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__') - ) - frozenset(updates.keys()) + attrs = set(('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__')).difference( + updates.keys() + ) for attr in attrs: try: value = getattr(func, attr) @@ -90,6 +90,7 @@ class meta(type): class Types(metaclass=meta): + @staticmethod def list( # type: ignore[misc] elements: Union[Type[object], str, AnsibleParameter], required: bool = False, @@ -120,6 +121,7 @@ class Types(metaclass=meta): option["description"] = help.split("\n") return option + @staticmethod def dict(required: bool = False, help: Optional[str] = None, **options: AnsibleParameter) -> AnsibleParameter: # type: ignore[misc] """Wrapper for the Ansible dict type @@ -154,6 +156,7 @@ def modspec( supports_check_mode: bool = False, add_file_common_args: bool = False, ) -> Dict[str, Any]: # pragma: nocover + """Wrapper to properly Type the module specs""" return dict( argument_spec=argument_spec, mutually_exclusive=mutually_exclusive,