exceptions module#

class exceptions.Exceptions#

Bases: object

Handles exceptions

Parameters:
  • origin (str) – The name of the function that called this function

  • param (list) – The parameters that should be checked

  • check (list) – The types that the parameters should have

  • strict (bool, optional) – If True, the types have to match exactly, if False, the types have to be subclasses of the given types, defaults to False

bound_checker(varname: str, val: float, lower: float, upper: float)#

Checks if the given value is in the given range

Parameters:
  • origin (str) – The name of the function that called this function

  • varname (str) – The name of the variable that should be checked

  • val (float) – The value that should be checked

  • lower (float) – The lower bound of the range

  • upper (float) – The upper bound of the range

type_checker(param: list, check: list, strict=False)#

Checks if the types of the given parameters are correct

Parameters:
  • origin (str) – The name of the function that called this function

  • param (list) – The parameters that should be checked

  • check (list) – The types that the parameters should have

  • strict (bool, optional) – If True, the types have to match exactly, if False, the types have to be subclasses of the given types, defaults to False

type_checker_rek(origin: str, param: list, check: list, strict: bool)#

Recursively checks if the types of the given parameters are correct

Parameters:
  • origin (str) – The name of the function that called this function

  • param (list) – The parameters that should be checked

  • check (list) – The types that the parameters should have

  • strict (bool, optional) – If True, the types have to match exactly, if False, the types have to be subclasses of the given types, defaults to False