download
raw
626 Bytes
"""Useful internal functions."""
from typing import Any, Callable, NoReturn, TypeVar
from ._compat import TypeAlias
from .errors import StructureHandlerNotFoundError
T = TypeVar("T")
Predicate: TypeAlias = Callable[[Any], bool]
"""A predicate function determines if a type can be handled."""
def identity(obj: T) -> T:
"""The identity function."""
return obj
def raise_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."
raise StructureHandlerNotFoundError(msg, type_=cl)

Xet Storage Details

Size:
626 Bytes
·
Xet hash:
603f5566c802d7d5a195b7253185e076ddd4c73963958aaa8e83f2242212535b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.