@@ -141,14 +141,13 @@ def result(evaluation_result) -> Tuple[Dict, bool]:
141141class ExactMatchType (CheckType ):
142142 """Exact Match class docstring."""
143143
144- @staticmethod
145- def _validate (** kwargs ) -> None :
146- """Method to validate arguments."""
147- # reference_data = getattr(kwargs, "reference_data")
144+ def _validate (referece_data ):
145+ # No need for _validate method as exact-match does not take any specific arguments.
146+ pass
148147
149148 def evaluate (self , value_to_compare : Any , reference_data : Any ) -> Tuple [Dict , bool ]:
150149 """Returns the difference between values and the boolean."""
151- self . _validate ( reference_data = reference_data )
150+
152151 evaluation_result = diff_generator (reference_data , value_to_compare )
153152 return self .result (evaluation_result )
154153
@@ -157,10 +156,9 @@ class ToleranceType(CheckType):
157156 """Tolerance class docstring."""
158157
159158 @staticmethod
160- def _validate (** kwargs ) -> None :
159+ def _validate (tolerance ) -> None :
161160 """Method to validate arguments."""
162161 # reference_data = getattr(kwargs, "reference_data")
163- tolerance = kwargs .get ("tolerance" )
164162 if not tolerance :
165163 raise ValueError ("'tolerance' argument is mandatory for Tolerance Check Type." )
166164 if not isinstance (tolerance , (int , float )):
@@ -170,7 +168,7 @@ def _validate(**kwargs) -> None:
170168
171169 def evaluate (self , value_to_compare : Any , reference_data : Any , tolerance : int ) -> Tuple [Dict , bool ]:
172170 """Returns the difference between values and the boolean. Overwrites method in base class."""
173- self ._validate (reference_data = reference_data , tolerance = tolerance )
171+ self ._validate (tolerance = tolerance )
174172 evaluation_result = diff_generator (reference_data , value_to_compare )
175173 self ._remove_within_tolerance (evaluation_result , tolerance )
176174 return self .result (evaluation_result )
@@ -206,16 +204,14 @@ class ParameterMatchType(CheckType):
206204 """Parameter Match class implementation."""
207205
208206 @staticmethod
209- def _validate (** kwargs ) -> None :
207+ def _validate (params , mode ) -> None :
210208 """Method to validate arguments."""
211209 mode_options = ["match" , "no-match" ]
212- params = kwargs .get ("params" )
213210 if not params :
214211 raise ValueError ("'params' argument is mandatory for ParameterMatch Check Type." )
215212 if not isinstance (params , dict ):
216213 raise ValueError (f"'params' argument must be a dict. You have: { type (params )} ." )
217214
218- mode = kwargs .get ("mode" )
219215 if not mode :
220216 raise ValueError ("'mode' argument is mandatory for ParameterMatch Check Type." )
221217 if mode not in mode_options :
@@ -235,16 +231,14 @@ class RegexType(CheckType):
235231 """Regex Match class implementation."""
236232
237233 @staticmethod
238- def _validate (** kwargs ) -> None :
234+ def _validate (regex , mode ) -> None :
239235 """Method to validate arguments."""
240236 mode_options = ["match" , "no-match" ]
241- regex = kwargs .get ("regex" )
242237 if not regex :
243238 raise ValueError ("'regex' argument is mandatory for Regex Check Type." )
244239 if not isinstance (regex , str ):
245240 raise ValueError (f"'regex' argument must be a string. You have: { type (regex )} ." )
246241
247- mode = kwargs .get ("mode" )
248242 if not mode :
249243 raise ValueError ("'mode' argument is mandatory for Regex Check Type." )
250244 if mode not in mode_options :
@@ -261,7 +255,7 @@ class OperatorType(CheckType):
261255 """Operator class implementation."""
262256
263257 @staticmethod
264- def _validate (** kwargs ) -> None :
258+ def _validate (params ) -> None :
265259 """Validate operator parameters."""
266260 in_operators = ("is-in" , "not-in" , "in-range" , "not-range" )
267261 bool_operators = ("all-same" ,)
@@ -275,15 +269,16 @@ def _validate(**kwargs) -> None:
275269 )
276270
277271 # Validate "params" argument is not None.
278- if not kwargs or list (kwargs .keys ())[0 ] != "params" :
279- raise ValueError (f"'params' argument must be provided. You have: { list (kwargs .keys ())[0 ]} ." )
272+ # {'params': {'mode': 'all-same', 'operator_data': True}}
273+ if not params or list (params .keys ())[0 ] != "params" :
274+ raise ValueError (f"'params' argument must be provided. You have: { list (params .keys ())[0 ]} ." )
280275
281- params_key = kwargs [ " params" ] .get ("mode" )
282- params_value = kwargs [ " params" ] .get ("operator_data" )
276+ params_key = params .get ("mode" )
277+ params_value = params .get ("operator_data" )
283278
284279 if not params_key or not params_value :
285280 raise ValueError (
286- f"'mode' and 'operator_data' arguments must be provided. You have: { list (kwargs ['params' ].keys ())} ."
281+ f"'mode' and 'operator_data' arguments must be provided. You have: { list (params ['params' ].keys ())} ."
287282 )
288283
289284 # Validate "params" value is legal.
@@ -334,7 +329,7 @@ def _validate(**kwargs) -> None:
334329
335330 def evaluate (self , value_to_compare : Any , params : Any ) -> Tuple [Dict , bool ]:
336331 """Operator evaluator implementation."""
337- self ._validate (** params )
332+ self ._validate (params )
338333 # For name consistency.
339334 reference_data = params
340335 evaluation_result = operator_evaluator (reference_data ["params" ], value_to_compare )
0 commit comments