restrict#
- blueprints.restrict(func)#
Used as a decorator it ansurses that the decorated methods or functions arguments are type restricted according to the arguments type hints if provided. You can use None as an optional type hint instead of Nonetype.
- Parameters:
func (
FunctionType | MethodType) – A function or method to be type restricted.- Returns:
A wrapped function that resitrcts argument and return value types and raises a TypeError if violated.
- Return type:
TYPE