from python_static_type import decorate_static_type, ExceptionStaticType class Test: pass @decorate_static_type def func1(x: int, y: str) -> list: return (x, y) # Указали неправильный тип. @decorate_static_type def func2(*, key: str = '', tuple_var: tuple = (), list_var: list = [[[[]]]]) -> str: return key func2() # Отработает хорошо. try: func1(1, "str") except ExceptionStaticType as e: print(e) # Функция func1: Возвращает неожиданное значение, ожидалось "list" try: func1(y=1, x="2") except ExceptionStaticType as e: print(e) # Функция func1: Аргумент "y" имеет тип "int", а ожидался "str" try: func1('2', 1) except ExceptionStaticType as e: print(e) # Функция func1: Аргумент "x" имеет тип "str", а ожидался "int" try: func1(1, Test) except ExceptionStaticType as e: print(e) # Функция func1: Аргумент "y" имеет тип "type", а ожидался "str". try: func1(1, True) except ExceptionStaticType as e: print(e) # Функция func1: Аргумент "y" имеет тип "bool", а ожидался "str".