hyped.core.ops.casting module¶
This module defines a type cast operator.
- hyped.core.ops.casting.cast(typ: Any, val: Any) Any¶
Cast a feature to a specified data type.
This function performs a type cast for a value if it is an instance of a
Feature. It infers the target data type from the provided type annotation, adds a cast node to the data flow graph, and retrieves the resulting feature.- Parameters:
typ (Any) – The target type to cast the value to. Typically, this is a type annotation.
val (Any) – The value to be cast. If the value is not a
Feature, it is returned unchanged.
- Returns:
The cast value. If the input
valis aFeature, the function returns the feature resulting from the cast operation. Otherwise, it returnsvalunchanged.- Return type:
Any