@@ -47,8 +47,8 @@ def get_what_txt(self):
4747 Overrides the base behaviour defined in ValidationError in order to add details about the function.
4848 :return:
4949 """
50- return 'input [{var} ] for function [{func}]' . format ( var = self .get_variable_str (),
51- func = self .validator .get_validated_func_display_name ())
50+ return 'input [%s ] for function [%s]' % ( self .get_variable_str (),
51+ self .validator .get_validated_func_display_name ())
5252
5353
5454class OutputValidationError (ValidationError ):
@@ -67,7 +67,7 @@ def get_what_txt(self):
6767 Overrides the base behaviour defined in ValidationError in order to add details about the function.
6868 :return:
6969 """
70- return 'output of function [{func}]' . format ( func = self .validator .get_validated_func_display_name () )
70+ return 'output of function [%s]' % self .validator .get_validated_func_display_name ()
7171
7272
7373class ClassFieldValidationError (ValidationError ):
@@ -85,8 +85,8 @@ def get_what_txt(self):
8585 Overrides the base behaviour defined in ValidationError in order to add details about the class field.
8686 :return:
8787 """
88- return 'field [{field} ] for class [{clazz}]' . format ( field = self .get_variable_str (),
89- clazz = self .validator .get_validated_class_display_name ())
88+ return 'field [%s ] for class [%s]' % ( self .get_variable_str (),
89+ self .validator .get_validated_class_display_name ())
9090
9191 def get_variable_str (self ):
9292 """ Utility method to get the variable value or 'var_name=value' if name is not None """
@@ -147,7 +147,7 @@ def __init__(self,
147147 error_type = error_type , help_msg = help_msg , ** kw_context_args )
148148
149149 def get_additional_info_for_repr (self ):
150- return 'validated_function={func}' . format ( func = get_callable_name (self .validated_func ) )
150+ return 'validated_function=%s' % get_callable_name (self .validated_func )
151151
152152 def get_validated_func_display_name (self ):
153153 """
@@ -330,8 +330,8 @@ def _get_name_for_errors(self,
330330 return self .validated_field_name
331331
332332 def get_additional_info_for_repr (self ):
333- return 'validated_class_field={clazz}.{field}' . format ( clazz = self .get_validated_class_display_name (),
334- field = self .validated_field_name )
333+ return 'validated_class_field=%s.%s' % ( self .get_validated_class_display_name (),
334+ self .validated_field_name )
335335
336336 def get_validated_class_display_name (self ):
337337 """
@@ -645,14 +645,14 @@ def decorate_cls_with_validation(cls,
645645 elif (hasattr (var , '__get__' ) and callable (var .__get__ )) \
646646 or (hasattr (var , '__delete__' ) and callable (var .__delete__ )):
647647 # this is a descriptor but it does not have any setter method: impossible to validate
648- raise ValueError ("Class field '{} ' is a valid class descriptor for class '{} ' but it does not implement "
648+ raise ValueError ("Class field '%s ' is a valid class descriptor for class '%s ' but it does not implement "
649649 "__set__ so it is not possible to add validation to it. See "
650- "https://docs.python.org/3.6/howto/descriptor.html" . format (field_name , cls .__name__ ))
650+ "https://docs.python.org/3.6/howto/descriptor.html" % (field_name , cls .__name__ ))
651651
652652 else :
653653 # this is not a descriptor: unsupported
654- raise ValueError ("Class field '{}.{} ' is not a valid class descriptor, see "
655- "https://docs.python.org/3.6/howto/descriptor.html" . format (cls .__name__ , field_name ))
654+ raise ValueError ("Class field '%s.%s ' is not a valid class descriptor, see "
655+ "https://docs.python.org/3.6/howto/descriptor.html" % (cls .__name__ , field_name ))
656656
657657 else :
658658 # ** No class field with that name exist
@@ -682,8 +682,8 @@ def decorate_cls_with_validation(cls,
682682 # (for __setattr__ see https://stackoverflow.com/questions/15750522/class-properties-and-setattr/15751159)
683683
684684 # finally raise an error
685- raise ValueError ("@validate_field definition exception: field '{} ' can not be found in class '{} ', and it "
686- "is also not an input argument of the __init__ method." . format (field_name , cls .__name__ ))
685+ raise ValueError ("@validate_field definition exception: field '%s ' can not be found in class '%s ', and it "
686+ "is also not an input argument of the __init__ method." % (field_name , cls .__name__ ))
687687
688688 return cls
689689
0 commit comments