@@ -129,7 +129,7 @@ def evaluate(self, *args, **kwargs) -> Tuple[Dict, bool]:
129
129
130
130
@staticmethod
131
131
@abstractmethod
132
- def _validate (** kwargs ) -> None :
132
+ def _validate (* args ) -> None :
133
133
"""Method to validate arguments that raises proper exceptions."""
134
134
135
135
@staticmethod
@@ -141,13 +141,13 @@ def result(evaluation_result) -> Tuple[Dict, bool]:
141
141
class ExactMatchType (CheckType ):
142
142
"""Exact Match class docstring."""
143
143
144
- def _validate (referece_data ):
144
+ @staticmethod
145
+ def _validate (reference_data ):
145
146
# No need for _validate method as exact-match does not take any specific arguments.
146
147
pass
147
148
148
149
def evaluate (self , value_to_compare : Any , reference_data : Any ) -> Tuple [Dict , bool ]: # type: ignore[override]
149
150
"""Returns the difference between values and the boolean."""
150
-
151
151
evaluation_result = diff_generator (reference_data , value_to_compare )
152
152
return self .result (evaluation_result )
153
153
@@ -156,7 +156,7 @@ class ToleranceType(CheckType):
156
156
"""Tolerance class docstring."""
157
157
158
158
@staticmethod
159
- def _validate (tolerance ) -> None :
159
+ def _validate (tolerance ) -> None : # type: ignore[override]
160
160
"""Method to validate arguments."""
161
161
# reference_data = getattr(kwargs, "reference_data")
162
162
if not tolerance :
@@ -204,7 +204,7 @@ class ParameterMatchType(CheckType):
204
204
"""Parameter Match class implementation."""
205
205
206
206
@staticmethod
207
- def _validate (params , mode ) -> None :
207
+ def _validate (params , mode ) -> None : # type: ignore[override]
208
208
"""Method to validate arguments."""
209
209
mode_options = ["match" , "no-match" ]
210
210
if not params :
@@ -231,7 +231,7 @@ class RegexType(CheckType):
231
231
"""Regex Match class implementation."""
232
232
233
233
@staticmethod
234
- def _validate (regex , mode ) -> None :
234
+ def _validate (regex , mode ) -> None : # type: ignore[override]
235
235
"""Method to validate arguments."""
236
236
mode_options = ["match" , "no-match" ]
237
237
if not regex :
@@ -255,7 +255,7 @@ class OperatorType(CheckType):
255
255
"""Operator class implementation."""
256
256
257
257
@staticmethod
258
- def _validate (params ) -> None :
258
+ def _validate (params ) -> None : # type: ignore[override]
259
259
"""Validate operator parameters."""
260
260
in_operators = ("is-in" , "not-in" , "in-range" , "not-range" )
261
261
bool_operators = ("all-same" ,)
@@ -273,8 +273,8 @@ def _validate(params) -> None:
273
273
if not params or list (params .keys ())[0 ] != "params" :
274
274
raise ValueError (f"'params' argument must be provided. You have: { list (params .keys ())[0 ]} ." )
275
275
276
- params_key = params .get ("mode" )
277
- params_value = params .get ("operator_data" )
276
+ params_key = params .get ("params" , {}). get ( " mode" )
277
+ params_value = params .get ("params" , {}). get ( " operator_data" )
278
278
279
279
if not params_key or not params_value :
280
280
raise ValueError (
0 commit comments