daf.typing.descriptions

Support functions for describing data in messages.

Functions:

data_description(data)

Return a not-too-long description of some (hopefully 1D/2D) data for error messages and logging.

assert_data(condition, kind, data, *[, ...])

Assert that the data satisfies some condition, which tested whether it is of some kind (and optionally dtype and/or shape and/or layout), with a friendly message if it fails.

daf.typing.descriptions.data_description(data: Any) str[source]

Return a not-too-long description of some (hopefully 1D/2D) data for error messages and logging.

daf.typing.descriptions.assert_data(condition: bool, kind: str, data: Any, *, dtype: Optional[Union[str, dtype, Collection[str], Collection[dtype], Collection[Union[str, dtype]]]] = None, shape: Optional[Tuple[int, int]] = None, size: Optional[int] = None, layout: Optional[AnyMajor] = None) None[source]

Assert that the data satisfies some condition, which tested whether it is of some kind (and optionally dtype and/or shape and/or layout), with a friendly message if it fails.