rizer.misc.check_utils#

Functions#

validate_positive(→ None)

Check if the value is a positive, finite, number.

Module Contents#

rizer.misc.check_utils.validate_positive(name: str, value: int | float, allow_zero: bool = False) None#

Check if the value is a positive, finite, number.

Parameters:
  • name (str) – Name of the variable for error messages.

  • value (int or float) – Value to check.

  • allow_zero (bool, optional) – Whether to allow zero as a valid value. Default is False.

Raises:
  • TypeError – Raised if the value is not a number.

  • ValueError – Raised if the value is not finite.

  • ValueError – Raised if the value is not positive.