From 8b3b68577e6ed626756cc013b64d730c3ed4c2fb Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 2 Jul 2025 14:05:47 +0900 Subject: [PATCH] For delete keys do not allow Any, ignore sub error only dict, list or str, str will be returned as list Ignore any errors for recursive call because it thinks value is [unknown] -> this should be checked that value is [str, Any] or list[dict[str, Any]] --- src/CoreLibs/list_dict_handling/manage_dict.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/CoreLibs/list_dict_handling/manage_dict.py b/src/CoreLibs/list_dict_handling/manage_dict.py index 446eb9b..31b4056 100644 --- a/src/CoreLibs/list_dict_handling/manage_dict.py +++ b/src/CoreLibs/list_dict_handling/manage_dict.py @@ -6,7 +6,7 @@ from typing import Any, cast def delete_keys_from_set( - set_data: dict[str, Any] | list[Any] | Any, keys: list[str] + set_data: dict[str, Any] | list[Any] | str, keys: list[str] ) -> dict[str, Any] | list[Any] | Any: """ remove all keys from set_data @@ -26,11 +26,13 @@ def delete_keys_from_set( if key in keys: del set_data[key] if isinstance(value, (dict, list)): - delete_keys_from_set(value, keys) + delete_keys_from_set(value, keys) # type: ignore Partly unknown elif isinstance(set_data, list): for value in set_data: if isinstance(value, (dict, list)): - delete_keys_from_set(value, keys) + delete_keys_from_set(value, keys) # type: ignore Partly unknown + else: + set_data = [set_data] return set_data