reprospect.utils.types module
Type information for numeric scalar types.
The minimal information needed to describe a numeric type is:
kind and signedness — integer or floating-point, signed or unsigned (see
Kind)bits — width in bits (e.g. 16, 32, 64, 128)
This module provides TypeInfo to carry this information.
Note
Several alternatives to writing this module have been considered:
numpydoes not support arbitrarily wide types such asint128.https://github.com/jax-ml/ml_dtypes focuses on small types used in machine learning.
- class reprospect.utils.types.Kind(*values)View on GitHub
Bases:
Enum- FLOAT = 3
- INT = 1
- UINT = 2
- classmethod from_numpy(kind: str) SelfView on GitHub
See https://numpy.org/doc/stable/reference/generated/numpy.dtype.kind.html.
- property signed: boolView on GitHub
- class reprospect.utils.types.TypeInfo(bits: int, kind: Kind)View on GitHub
Bases:
objectMinimal type information.
- property itemsize: intView on GitHub
- classmethod normalize(*, dtype: TypeInfo | int | DTypeLike) SelfView on GitHub
- property signed: boolView on GitHub