Commits vergleichen

..

Keine gemeinsamen Commits. „144ffc72a52503b5c4c4b46b34ce198e385b389c“ und „c5e6129682a32caaf74330ad6fc403deb83a33f6“ haben vollständig unterschiedliche Historien.

2 geänderte Dateien mit 10 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -23,9 +23,9 @@ def wrap_func(func, **updates):
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
attrs = set(('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__')).difference(
updates.keys()
)
attrs = frozenset(
('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__')
) - frozenset(updates.keys())
for attr in attrs:
try:
value = getattr(func, attr)
@ -90,7 +90,6 @@ class meta(type):
class Types(metaclass=meta):
@staticmethod
def list( # type: ignore[misc]
elements: Union[Type[object], str, AnsibleParameter],
required: bool = False,
@ -110,7 +109,7 @@ class Types(metaclass=meta):
option["elements"] = elements["type"]
if elements["type"] == "dict":
option["options"] = dict()
for name, value in elements["options"].items():
for name, value in elements["option"].items():
option["options"][name] = value
if "description" not in option["options"][name]:
warnings.warn( # pragma: nocover
@ -121,7 +120,6 @@ 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
@ -156,7 +154,6 @@ 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,

Datei anzeigen

@ -1,6 +1,7 @@
import pathlib
from copy import deepcopy
from typing import Any, Callable, ClassVar, Dict, NoReturn, Optional, Type, TypeVar, Union, overload, TypedDict
from ansible.utils.display import Display
import ansible.module_utils.basic as basic
@ -20,8 +21,8 @@ T = TypeVar("T")
class TypedDiff(TypedDict):
before: str
after: str
before_header: Optional[str]
after_header: Optional[str]
before_header: Optional[str] = None
after_header: Optional[str] = None
def docify(input: Union[dict, AnsibleParameter]) -> dict:
@ -62,6 +63,8 @@ class AnsibleModule(object):
module_spec: ClassVar[dict]
#: This is set by classes that define common things for their subclasses, like behaviour of the run and check methods. This is used by `SystemdUnitModule`
_common_args: ClassVar[dict[str, Any]] = dict()
#: For log messages
display: Display
@property
def params(self) -> Dict[str, Any]:
@ -77,6 +80,7 @@ class AnsibleModule(object):
specs["argument_spec"].update(modspec["argument_spec"])
del modspec["argument_spec"]
specs.update(modspec)
self.display = Display()
self.module = basic.AnsibleModule(**specs)
self.tmpdir = pathlib.Path(self.module.tmpdir)