validations
validations
Module for validation actions inside of Blueprints.
Classes:
-
EqualToZeroError–Raised when a value is equal to zero.
-
GreaterThan90Error–Raised when a value is greater than 90.
-
LessOrEqualToZeroError–Raised when a value is less than or equal to zero.
-
ListsNotSameLengthError–Raised when two lists are not of the same length.
-
MismatchSignError–Raised when not all the keyword values have the same sign.
-
NegativeValueError–Raised when a value is negative.
validations.EqualToZeroError
EqualToZeroError(value_name: str, value: float)
Bases: Exception
Raised when a value is equal to zero.
Source code in blueprints/validations.py
17 18 19 | |
validations.GreaterThan90Error
GreaterThan90Error(value_name: str, value: float)
Bases: Exception
Raised when a value is greater than 90.
Source code in blueprints/validations.py
41 42 43 | |
validations.LessOrEqualToZeroError
LessOrEqualToZeroError(value_name: str, value: float)
Bases: Exception
Raised when a value is less than or equal to zero.
Source code in blueprints/validations.py
9 10 11 | |
validations.ListsNotSameLengthError
ListsNotSameLengthError(
list_name_1: str, list_name_2: str, length_1: int, length_2: int
)
Bases: Exception
Raised when two lists are not of the same length.
Source code in blueprints/validations.py
49 50 51 52 53 54 | |
validations.MismatchSignError
MismatchSignError(value_names: list[str])
Bases: Exception
Raised when not all the keyword values have the same sign.
Source code in blueprints/validations.py
33 34 35 | |
validations.NegativeValueError
NegativeValueError(value_name: str, value: float)
Bases: Exception
Raised when a value is negative.
Source code in blueprints/validations.py
25 26 27 | |
validations.raise_if_greater_than_90
raise_if_greater_than_90(**kwargs: float) -> None
Raise a GreaterThan90Error if any of the given keyword arguments are greater than 90.
Parameters:
-
**kwargs(dict[str, float], default:{}) –A dictionary of keyword arguments where keys are parameter names, and values are the values to validate.
Raises:
-
GreaterThan90Error–If any value is greater than 90.
Source code in blueprints/validations.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
validations.raise_if_less_or_equal_to_zero
raise_if_less_or_equal_to_zero(**kwargs: float) -> None
Raise a LessOrEqualToZeroError if any of the given keyword arguments are less than or equal to zero.
Parameters:
-
**kwargs(dict[str, float], default:{}) –A dictionary of keyword arguments where keys are parameter names, and values are the values to validate.
Raises:
-
LessOrEqualToZeroError–If any value is less than or equal to zero.
Source code in blueprints/validations.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
validations.raise_if_lists_differ_in_length
raise_if_lists_differ_in_length(**kwargs: Sequence) -> None
Check if all provided Sequences are of the same length.
Parameters:
-
**kwargs(dict[str, Sequence], default:{}) –A dictionary of keyword arguments where keys are list names and values are the Sequences to check.
Raises:
-
ListsNotSameLengthError–If any two Sequences are not of the same length.
Source code in blueprints/validations.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
validations.raise_if_mismatch_sign
raise_if_mismatch_sign(**kwargs: float) -> None
Raise a MismatchSignError if any of the given keyword arguments have different signs.
Parameters:
-
**kwargs(dict[str, float], default:{}) –A dictionary of keyword arguments where keys are parameter names, and values are the values to validate.
Raises:
-
MismatchSignError–If any values have different signs.
Source code in blueprints/validations.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
validations.raise_if_negative
raise_if_negative(**kwargs: float) -> None
Raise a NegativeValueError if any of the given keyword arguments are negative.
Parameters:
-
**kwargs(dict[str, float], default:{}) –A dictionary of keyword arguments where keys are parameter names, and values are the values to validate.
Raises:
-
NegativeValueError–If any value is negative.
Source code in blueprints/validations.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |