compiler/compiler/typechecking.py

18 lines
300 B
Python

from typing import Callable, TypeVar, ParamSpec
T = TypeVar("T")
P = ParamSpec("P")
def _typecheck_stub(func: Callable[P, T]) -> Callable[P, T]:
return func
typecheck: Callable[P, T] = _typecheck_stub
try:
import beartype
typecheck = beartype.beartype
except ImportError:
pass