def validate_and_convert(self, value: Any) -> Any: from ._utils import _is_primitive_type if not _is_primitive_type(value): raise UnsupportedValueType( f"Unsupported value type, type={type(value)}, value={value}" ) return value
def validate_and_convert(self, value: Any) -> Any: from ._utils import is_primitive_type if not is_primitive_type(value): t = get_type_of(value) raise UnsupportedValueType( f"Value '{t.__name__}' is not a supported primitive type") return value
def validate_and_convert(self, value: Any) -> Any: from ._utils import is_primitive_type # allow_objects is internal and not an official API. use at your own risk. # Please be aware that this support is subject to change without notice. # If this is deemed useful and supportable it may become an official API. if self._get_flag("allow_objects") is not True and not is_primitive_type(value): t = get_type_of(value) raise UnsupportedValueType( f"Value '{t.__name__}' is not a supported primitive type" ) return value