fastcs.datatypes.datatype#
Members
A builtin (or numpy) type supported by a corresponding FastCS Attribute DataType |
|
A TypeVar of |
|
Generic datatype mapping to a python type, with additional metadata. |
- fastcs.datatypes.datatype.DType = int | float | bool | str | enum.Enum | numpy.ndarray#
A builtin (or numpy) type supported by a corresponding FastCS Attribute DataType
- class fastcs.datatypes.datatype.DType_T#
A TypeVar of
DTypefor use in generic classes and functionsalias of TypeVar(‘DType_T’, bound=
int|float|bool|str|Enum|ndarray)
- class fastcs.datatypes.datatype.DataType[source]#
Generic datatype mapping to a python type, with additional metadata.
- validate(value: Any) DType_T[source]#
Validate a value against the datatype.
The base implementation is to try the cast and raise a useful error if it fails.
Child classes can implement logic before calling
super.validate(value)to modify the value passed in and help the cast succeed or after to perform further validation of the coerced type.- Parameters:
value – The value to validate
- Returns:
The validated value
- Raises:
ValueError – If the value cannot be coerced
- static equal(value1: DType_T, value2: DType_T) bool[source]#
Compare two values for equality
Child classes can override this if the underlying type does not implement
__eq__or to define custom logic.- Parameters:
value1 – The first value to compare
value2 – The second value to compare
- Returns:
Trueif the values are equal