_typing.py 402 B

123456789101112131415161718
  1. from __future__ import annotations
  2. import sys
  3. if sys.version_info >= (3, 10):
  4. from typing import TypeGuard
  5. else:
  6. try:
  7. from typing_extensions import TypeGuard
  8. except ImportError:
  9. from typing import Any
  10. class TypeGuard: # type: ignore[no-redef]
  11. def __class_getitem__(cls, item: Any) -> type[bool]:
  12. return bool
  13. __all__ = ["TypeGuard"]