Package lib :: Module checks :: Class Check
[hide private]
[frames] | no frames]

Class Check

source code

Data checking class based on the strategy design pattern.

Instance Methods [hide private]
 
__init__(self, function)
Store the function argument for use in the __call__() method.
source code
bool
__call__(self, *args, **kargs)
Make the object callable, and perform the checks.
source code
Method Details [hide private]

__init__(self, function)
(Constructor)

source code 

Store the function argument for use in the __call__() method.

Parameters:
  • function (function) - The function to store as self.checks which is called from the __call__() method.

__call__(self, *args, **kargs)
(Call operator)

source code 

Make the object callable, and perform the checks.

This will call the function used to initialise the class and then

Parameters:
  • escalate (int) - The feedback to give if the check fails. This can be 0 for no printouts, 1 to throw a RelaxWarning, or 2 to raise a RelaxError.
Returns: bool
True if the check passes, False otherwise.
Raises:
  • RelaxError - If escalate is set to 2 and the check fails.