"""Useful internal functions."""fromtypingimportAny,Callable,NoReturn,TypeVarfrom._compatimportTypeAliasfrom.errorsimportStructureHandlerNotFoundErrorT=TypeVar("T")Predicate:TypeAlias=Callable[[Any],bool]"""A predicate function determines if a type can be handled."""
[docs]defraise_error(_,cl:Any)->NoReturn:"""At the bottom of the condition stack, we explode if we can't handle it."""msg=f"Unsupported type: {cl!r}. Register a structure hook for it."raiseStructureHandlerNotFoundError(msg,type_=cl)