From 7e43432a0c1a2a951fa10bf2fd6930db9d4c4fcc Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 24 Sep 2021 13:59:48 -0700 Subject: interpreterbase/decorators: KwargIfno validator must take an relaxed type I've used any because it needs to be infinitely recursive, something that we simply can't model. But basically until it goes into validator we have no way of knowing what's going on, since one can write code like: ```python KwargInfo[str]('arg', object, validator=_some_very_complex_logic_to_get_specific_string) ``` As such, we can't assume that validator is receiving a type _T, it could be anything. --- mesonbuild/interpreterbase/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/interpreterbase/decorators.py b/mesonbuild/interpreterbase/decorators.py index 54f4be3..88449ed 100644 --- a/mesonbuild/interpreterbase/decorators.py +++ b/mesonbuild/interpreterbase/decorators.py @@ -373,7 +373,7 @@ class KwargInfo(T.Generic[_T]): since_values: T.Optional[T.Dict[str, str]] = None, deprecated: T.Optional[str] = None, deprecated_values: T.Optional[T.Dict[str, str]] = None, - validator: T.Optional[T.Callable[[_T], T.Optional[str]]] = None, + validator: T.Optional[T.Callable[[T.Any], T.Optional[str]]] = None, convertor: T.Optional[T.Callable[[_T], object]] = None, not_set_warning: T.Optional[str] = None): self.name = name -- cgit v1.1