survive.utils
.check_float¶
-
survive.utils.
check_float
(num, *, positive=False, minimum=None, maximum=None, allow_none=False)[source]¶ Validate floating-point number function arguments.
Parameters: - num : object
The object to be validated.
- positive : bool, optional
If True, num must be positive. If False, num can be any float.
- minimum : float, optional
The minimum value that num can take (inclusive).
- maximum : float, optional
The maximum value that num can take (inclusive).
- allow_none : bool, optional
Indicates whether the value None should be allowed.
Returns: - num : float type or None
The validated float.
Raises: - TypeError
If num is not a float.
- ValueError
If any of the optional positivity or minimum and maximum value constraints are violated.