some clean up of the code

Dieser Commit ist enthalten in:
Sebastian Tobie 2025-03-14 08:35:47 +01:00
Ursprung c8d7d4e286
Commit 144ffc72a5

Datei anzeigen

@ -23,9 +23,9 @@ def wrap_func(func, **updates):
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
return func(*args, **kwargs) return func(*args, **kwargs)
attrs = frozenset( attrs = set(('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__')).difference(
('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__') updates.keys()
) - frozenset(updates.keys()) )
for attr in attrs: for attr in attrs:
try: try:
value = getattr(func, attr) value = getattr(func, attr)
@ -90,6 +90,7 @@ class meta(type):
class Types(metaclass=meta): class Types(metaclass=meta):
@staticmethod
def list( # type: ignore[misc] def list( # type: ignore[misc]
elements: Union[Type[object], str, AnsibleParameter], elements: Union[Type[object], str, AnsibleParameter],
required: bool = False, required: bool = False,
@ -120,6 +121,7 @@ class Types(metaclass=meta):
option["description"] = help.split("\n") option["description"] = help.split("\n")
return option return option
@staticmethod
def dict(required: bool = False, help: Optional[str] = None, **options: AnsibleParameter) -> AnsibleParameter: # type: ignore[misc] def dict(required: bool = False, help: Optional[str] = None, **options: AnsibleParameter) -> AnsibleParameter: # type: ignore[misc]
"""Wrapper for the Ansible dict type """Wrapper for the Ansible dict type
@ -154,6 +156,7 @@ def modspec(
supports_check_mode: bool = False, supports_check_mode: bool = False,
add_file_common_args: bool = False, add_file_common_args: bool = False,
) -> Dict[str, Any]: # pragma: nocover ) -> Dict[str, Any]: # pragma: nocover
"""Wrapper to properly Type the module specs"""
return dict( return dict(
argument_spec=argument_spec, argument_spec=argument_spec,
mutually_exclusive=mutually_exclusive, mutually_exclusive=mutually_exclusive,