This commit is contained in:
Khaleel Al-Adhami 2025-01-10 11:48:40 -08:00
parent f57b3348d0
commit bbc3287632

View File

@ -20,7 +20,6 @@ from typing import (
from reflex.constants.base import Dirs from reflex.constants.base import Dirs
from reflex.utils.exceptions import PrimitiveUnserializableToJSON, VarTypeError from reflex.utils.exceptions import PrimitiveUnserializableToJSON, VarTypeError
from reflex.utils.imports import ImportDict, ImportVar from reflex.utils.imports import ImportDict, ImportVar
from reflex.utils.types import is_optional
from .base import ( from .base import (
CustomVarOperationReturn, CustomVarOperationReturn,
@ -516,16 +515,6 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
raise_unsupported_operand_types(">=", (type(self), type(other))) raise_unsupported_operand_types(">=", (type(self), type(other)))
return greater_than_or_equal_operation(+self, +other) return greater_than_or_equal_operation(+self, +other)
def bool(self):
"""Boolean conversion.
Returns:
The boolean value of the number.
"""
if is_optional(self._var_type):
return boolify((self != None) & (self != 0)) # noqa: E711
return self != 0
def _is_strict_float(self) -> bool: def _is_strict_float(self) -> bool:
"""Check if the number is a float. """Check if the number is a float.