Open
Description
Make assert_type
use ReifiedGeneric
so that it can check at runtime.
basedtyping/basedtyping/typetime_only.py
Line 24 in 997af52
class assert_type(Generic[T]):
"""Used to assert that a value is type ``T``.
note: This is more like a function than a class,
but it's defined as a class so that you can explicitly specify the generic.
"""
# TODO: make this use ReifiedGeneric so that it can check at runtime
# None return type on __new__ is supported in pyright but not mypy
def __new__(cls, _value: T) -> None: # type: ignore[misc]
pass
6accd9872dcd509eea9f2a1ce1cd2138f21bd85f