Open
Description
basedtyping/basedtyping/__init__.py
Line 347 in da37631
super().__init_subclass__()
if sys.version_info >= (3, 10):
from types import UnionType
_UnionTypes = (UnionType, OldUnionType)
_Forms: TypeAlias = type | UnionType | _SpecialForm # type: ignore[unused-ignore, no-any-expr]
else:
_UnionTypes = (OldUnionType,)
_Forms: TypeAlias = Union[type, _SpecialForm]
# TODO: make this work with any "form", not just unions
# should be (form: TypeForm, forminfo: TypeForm)
# TODO: form/forminfo can include _UnionGenericAlias
def issubform(form: _Forms, forminfo: _Forms) -> bool:
"""EXPERIMENTAL: Warning, this function currently only supports unions and ``Never``.
Returns ``True`` if ``form`` is a subform (specialform or subclass) of ``forminfo``.