Commits vergleichen
2 Commits
8190ee94d3
...
85880d2867
Autor | SHA1 | Datum |
---|---|---|
Sebastian Tobie | 85880d2867 | |
Sebastian Tobie | 380bc582e3 |
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
minor_changes:
|
||||||
|
- Added an type hint to the update_doc function
|
||||||
|
- Added Type hint to the dictionary argument of the diff method
|
|
@ -1,6 +1,6 @@
|
||||||
import pathlib
|
import pathlib
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from typing import Any, Callable, ClassVar, Dict, NoReturn, Optional, Type, TypeVar, Union, overload
|
from typing import Any, Callable, ClassVar, Dict, NoReturn, Optional, Type, TypeVar, Union, overload, TypedDict
|
||||||
from ansible.utils.display import Display
|
from ansible.utils.display import Display
|
||||||
|
|
||||||
import ansible.module_utils.basic as basic
|
import ansible.module_utils.basic as basic
|
||||||
|
@ -18,6 +18,13 @@ __all__ = (
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
|
|
||||||
|
class TypedDiff(TypedDict):
|
||||||
|
before: str
|
||||||
|
after: str
|
||||||
|
before_header: Optional[str] = None
|
||||||
|
after_header: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
def docify(input: Union[dict, AnsibleParameter]) -> dict:
|
def docify(input: Union[dict, AnsibleParameter]) -> dict:
|
||||||
options = dict()
|
options = dict()
|
||||||
for name, help in input.items():
|
for name, help in input.items():
|
||||||
|
@ -82,7 +89,7 @@ class AnsibleModule(object):
|
||||||
self.result[key] = value
|
self.result[key] = value
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def diff(self, diff: Dict[str, str]): # pragma: nocover
|
def diff(self, diff: TypedDiff): # pragma: nocover
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
|
|
|
@ -10,7 +10,7 @@ moduledir = pathlib.Path("plugins/modules")
|
||||||
regex = re.compile("DOCUMENTATION *= *r?(?P<quote>\"{3}|'{3})(---)?.*?(?P=quote)", re.MULTILINE | re.DOTALL)
|
regex = re.compile("DOCUMENTATION *= *r?(?P<quote>\"{3}|'{3})(---)?.*?(?P=quote)", re.MULTILINE | re.DOTALL)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main() -> None:
|
||||||
try:
|
try:
|
||||||
modules = list(moduledir.iterdir())
|
modules = list(moduledir.iterdir())
|
||||||
except:
|
except:
|
||||||
|
|
Laden…
In neuem Issue referenzieren