diplomat.processing.type_casters.attach_hint

diplomat.processing.type_casters.attach_hint(hint: Type) Callable[[Callable], Callable][source]

Decorator, attach a type hint to a function, allowing it to behave like a full type caster.

Parameters:

hint – A type hint using python’s standard typing module. The decorated function, if used as an argument or return value in a typecaster function, will get converted to this type when inspected by other python functions and code.

Returns:

A decorator, accepts a function and returns it with the type hint attached.