dtype

Helper functions for validation of dtype.

For literal dtypes intended for use by end-users, see numpydantic.dtype

validate_dtype(dtype: Any, target: str | type | Any | generic) bool[source]

Validate a dtype against the target dtype

Parameters:
  • dtype – The dtype to validate

  • target (DtypeType) – The target dtype

Returns:

True if valid, False otherwise

Return type:

bool

is_union(dtype: str | type | Any | generic) bool[source]

Check if a dtype is a union