mlrl.util.validation module

Author: Michael Rapp (michael.rapp.ml@gmail.com)

Provides utility functions for validation.

exception mlrl.util.validation.ValidationError(message: str)

Bases: Exception

An exception to be raised when a validation error occurs.

mlrl.util.validation.assert_greater(name: str, value, threshold)

Raises a ValidationError if a given value is not greater than a specific threshold.

Parameters:
  • name – The name of the argument or parameter, the value corresponds to

  • value – The value

  • threshold – The threshold

mlrl.util.validation.assert_greater_or_equal(name: str, value, threshold)

Raises a ValidationError if a given value is not greater or equal to a specific threshold.

Parameters:
  • name – The name of the argument or parameter, the value corresponds to

  • value – The value

  • threshold – The threshold

mlrl.util.validation.assert_less(name: str, value, threshold)

Raises a ValidationError if a given value is not less than a specific threshold.

Parameters:
  • name – The name of the argument or parameter, the value corresponds to

  • value – The value

  • threshold – The threshold

mlrl.util.validation.assert_less_or_equal(name: str, value, threshold)

Raises a ValidationError if a given value is not less or equal to a specific threshold.

Parameters:
  • name – The name of the argument or parameter, the value corresponds to

  • value – The value

  • threshold – The threshold

mlrl.util.validation.assert_multiple(name: str, value, other)

Raises a ValidationError if a given value is not a multiple of another value.

Parameters:
  • name – The name of the argument or parameter, the value corresponds to

  • value – The value that should be a multiple of other

  • other – The other value

mlrl.util.validation.assert_not_none(name: str, value)

Raises a ValueError if a given value is None.

Parameters:
  • name – The name of the argument or parameter, the value corresponds to

  • value – The value