abracudabra._validate#
Attributes#
Mapping from library names to functions that return a mapping of concrete types. |
Classes#
Library names. |
Functions#
|
|
|
|
|
|
|
|
|
|
|
|
Validate an object ensuring it matches the type from a specified library. |
Module Contents#
- abracudabra._validate.LIBRARY_TO_CONCRETE_TYPES: dict[Library, collections.abc.Callable[[], collections.abc.Mapping[str, type]]][source]#
Mapping from library names to functions that return a mapping of concrete types.
- abracudabra._validate._get_concrete_types(library: Library, types: str | collections.abc.Iterable[str] | None = None) type | tuple[type, Ellipsis] [source]#
- abracudabra._validate.validate_obj_type(obj: object, /, library: Literal[Library], types: str | collections.abc.Iterable[str] | None = ...) TypeGuard[numpy.ndarray] [source]#
- abracudabra._validate.validate_obj_type(obj: object, /, library: Literal[Library], types: str | collections.abc.Iterable[str] | None = ...) TypeGuard[Any]
- abracudabra._validate.validate_obj_type(obj: object, /, library: Literal[Library], types: str | collections.abc.Iterable[str] | None = ...) TypeGuard[torch.Tensor]
- abracudabra._validate.validate_obj_type(obj: object, /, library: Literal[Library], types: str | collections.abc.Iterable[str] | None = ...) TypeGuard[pandas.Index | pandas.Series[Any] | pandas.DataFrame]
- abracudabra._validate.validate_obj_type(obj: object, /, library: Literal[Library], types: str | collections.abc.Iterable[str] | None = ...) TypeGuard[cudf.Index | cudf.Series | cudf.DataFrame]
- abracudabra._validate.validate_obj_type(obj: object, /, library: Library, types: str | collections.abc.Iterable[str] | None = ...) bool
Validate an object ensuring it matches the type from a specified library.
- Parameters:
obj – The object to validate.
library – Library name from Enum ‘Library’.
types – The type(s) to validate against. For example,
'array'
,'index'
,'series'
,'dataframe'
,'tensor'
.
- Returns:
The input object, if validation succeeds.
- Raises:
ValueError – If an unsupported library is provided.
TypeError – If the object type doesn’t match the expected type.