|
9 | 9 | from typing_extensions import TYPE_CHECKING |
10 | 10 |
|
11 | 11 | from spellbind.bool_values import BoolValue |
12 | | -from spellbind.functions import _clamp_float, _multiply_all_floats |
| 12 | +from spellbind.numbers import multiply_all_floats, clamp_float |
13 | 13 | from spellbind.values import Value, SimpleVariable, OneToOneValue, DerivedValueBase, Constant, \ |
14 | | - NotConstantError, ThreeToOneValue, _create_value_getter, get_constant_of_generic_like |
| 14 | + NotConstantError, ThreeToOneValue, create_value_getter, get_constant_of_generic_like |
15 | 15 |
|
16 | 16 | if TYPE_CHECKING: |
17 | 17 | from spellbind.int_values import IntValue, IntLike # pragma: no cover |
@@ -41,10 +41,10 @@ def __rsub__(self, other: int | float) -> FloatValue: |
41 | 41 | return FloatValue.derive_from_two(operator.sub, other, self) |
42 | 42 |
|
43 | 43 | def __mul__(self, other: FloatLike) -> FloatValue: |
44 | | - return FloatValue.derive_from_many(_multiply_all_floats, self, other, is_associative=True) |
| 44 | + return FloatValue.derive_from_many(multiply_all_floats, self, other, is_associative=True) |
45 | 45 |
|
46 | 46 | def __rmul__(self, other: int | float) -> FloatValue: |
47 | | - return FloatValue.derive_from_many(_multiply_all_floats, other, self, is_associative=True) |
| 47 | + return FloatValue.derive_from_many(multiply_all_floats, other, self, is_associative=True) |
48 | 48 |
|
49 | 49 | def __truediv__(self, other: FloatLike) -> FloatValue: |
50 | 50 | return FloatValue.derive_from_two(operator.truediv, self, other) |
@@ -110,7 +110,7 @@ def __pos__(self) -> Self: |
110 | 110 | return self |
111 | 111 |
|
112 | 112 | def clamp(self, min_value: FloatLike, max_value: FloatLike) -> FloatValue: |
113 | | - return FloatValue.derive_from_three_floats(_clamp_float, self, min_value, max_value) |
| 113 | + return FloatValue.derive_from_three_floats(clamp_float, self, min_value, max_value) |
114 | 114 |
|
115 | 115 | def decompose_float_operands(self, operator_: Callable[..., float]) -> Sequence[FloatLike]: |
116 | 116 | return (self,) |
@@ -204,7 +204,7 @@ def sum_floats(*values: FloatLike) -> FloatValue: |
204 | 204 |
|
205 | 205 |
|
206 | 206 | def multiply_floats(*values: FloatLike) -> FloatValue: |
207 | | - return FloatValue.derive_from_many(_multiply_all_floats, *values, is_associative=True) |
| 207 | + return FloatValue.derive_from_many(multiply_all_floats, *values, is_associative=True) |
208 | 208 |
|
209 | 209 |
|
210 | 210 | class OneToFloatValue(Generic[_S], OneToOneValue[_S, float], FloatValue): |
@@ -327,7 +327,7 @@ def __init__(self, transformer: Callable[[float, int], _S], |
327 | 327 | self._of_first = first |
328 | 328 | self._of_second = second |
329 | 329 | self._first_getter = _create_float_getter(first) |
330 | | - self._second_getter = _create_value_getter(second) |
| 330 | + self._second_getter = create_value_getter(second) |
331 | 331 | super().__init__(*[v for v in (first, second) if isinstance(v, Value)]) |
332 | 332 |
|
333 | 333 | @override |
|
0 commit comments