1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-22 05:09:12 +00:00

[PR #11445/f9334656 backport][stable-12] Cleanup (#11446)

Cleanup (#11445)

* Correctly position BOTMETA entry.

* Standardize to 'import typing as t'.

* Remove platform attribute.

(cherry picked from commit f933465658)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2026-01-25 18:56:23 +01:00 committed by GitHub
parent 1670f8693a
commit ccdf82f163
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 14 deletions

View file

@ -11,7 +11,6 @@ from ansible.errors import AnsibleFilterError
if t.TYPE_CHECKING:
from collections.abc import Callable
from typing import Any
JSONPATCH_IMPORT_ERROR: ImportError | None
try:
@ -31,7 +30,7 @@ OPERATIONS_NEEDING_VALUE = ["add", "replace", "test"]
class FilterModule:
"""Filter plugin."""
def check_json_object(self, filter_name: str, object_name: str, inp: Any):
def check_json_object(self, filter_name: str, object_name: str, inp: t.Any):
if isinstance(inp, (str, bytes, bytearray)):
try:
return loads(inp)
@ -64,9 +63,9 @@ class FilterModule:
inp: str | list | dict | bytes | bytearray,
op: str,
path: str,
value: Any = None,
value: t.Any = None,
**kwargs: dict,
) -> Any:
) -> t.Any:
if not HAS_LIB:
raise AnsibleFilterError(
"You need to install 'jsonpatch' package prior to running 'json_patch' filter"
@ -110,7 +109,7 @@ class FilterModule:
operations: list,
/,
fail_test: bool = False,
) -> Any:
) -> t.Any:
if not HAS_LIB:
raise AnsibleFilterError(
"You need to install 'jsonpatch' package prior to running 'json_patch_recipe' filter"
@ -160,7 +159,7 @@ class FilterModule:
return result
def filters(self) -> dict[str, Callable[..., Any]]:
def filters(self) -> dict[str, Callable[..., t.Any]]:
"""Map filter plugin names to their functions.
Returns: