From d8cd1be23b3fcbd24a51c815dc7125fdcce0fed7 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Tue, 29 Nov 2022 15:05:03 +0530 Subject: [PATCH] fix: Skip type checking if any allowed type is stringified --- frappe/utils/typing_validations.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/frappe/utils/typing_validations.py b/frappe/utils/typing_validations.py index b751a37839..e5742df8ab 100644 --- a/frappe/utils/typing_validations.py +++ b/frappe/utils/typing_validations.py @@ -1,5 +1,5 @@ from inspect import _empty, isclass, signature -from typing import Callable, ForwardRef, Sequence, Union +from typing import Callable, ForwardRef, Union def qualified_name(obj) -> str: @@ -48,11 +48,8 @@ def validate_argument_types(func: Callable, args: tuple, kwargs: dict): # if the type is a ForwardRef or str, ignore it if isinstance(current_arg_type, (ForwardRef, str)): continue - - if isinstance(current_arg_type, Sequence): - current_arg_type = tuple( - x for x in current_arg_type.__args__ if not isinstance(x, (ForwardRef, str)) - ) + elif any(isinstance(x, (ForwardRef, str)) for x in getattr(current_arg_type, "__args__", [])): + continue param_def = func_params.get(current_arg)