Source code for text_lint.operations.validators.expressions.exponent

"""Exponent class."""
from typing import Union

from text_lint.operations.validators.expressions.bases import expression_base


[docs] class Exponent(expression_base.ExpressionBase): """Apply the exponent to a value of another.""" operator = "^"
[docs] def apply(self, value_a: float, value_b: float) -> Union[float, bool]: """Apply the mathematical operator to these two values.""" return float(value_a**value_b)