check_smaller_than#

check_smaller_than(max_value: Number, value: Number, name: str, allow_none: bool = False) Number[source]#

Check if value is non-negative.

Parameters:
max_valueint, float

Maximum allowed value.

valueint, float

Value to check.

namestr

Name of the parameter to be shown in the error message.

allow_nonebool, optional (default=False)

Whether to allow None values.

Returns:
valueint, float

Input value.

Raises:
ValueError

If value is negative.