@@ -32,13 +32,13 @@ def dependencies_draft3(validator, dependencies, instance, schema):
32
32
yield error
33
33
elif validator .is_type (dependency , "string" ):
34
34
if dependency not in instance :
35
- message = "%r is a dependency of %r "
36
- yield ValidationError (message % ( dependency , property ) )
35
+ message = f" { dependency !r } is a dependency of { property !r } "
36
+ yield ValidationError (message )
37
37
else :
38
38
for each in dependency :
39
39
if each not in instance :
40
- message = "%r is a dependency of %r "
41
- yield ValidationError (message % ( each , property ) )
40
+ message = f" { each !r } is a dependency of { property !r } "
41
+ yield ValidationError (message )
42
42
43
43
44
44
def dependencies_draft4_draft6_draft7 (
@@ -63,8 +63,8 @@ def dependencies_draft4_draft6_draft7(
63
63
if validator .is_type (dependency , "array" ):
64
64
for each in dependency :
65
65
if each not in instance :
66
- message = "%r is a dependency of %r "
67
- yield ValidationError (message % ( each , property ) )
66
+ message = f" { each !r } is a dependency of { property !r } "
67
+ yield ValidationError (message )
68
68
else :
69
69
for error in validator .descend (
70
70
instance , dependency , schema_path = property ,
@@ -75,9 +75,8 @@ def dependencies_draft4_draft6_draft7(
75
75
def disallow_draft3 (validator , disallow , instance , schema ):
76
76
for disallowed in _utils .ensure_list (disallow ):
77
77
if validator .is_valid (instance , {"type" : [disallowed ]}):
78
- yield ValidationError (
79
- "%r is disallowed for %r" % (disallowed , instance ),
80
- )
78
+ message = f"{ disallowed !r} is disallowed for { instance !r} "
79
+ yield ValidationError (message )
81
80
82
81
83
82
def extends_draft3 (validator , extends , instance , schema ):
@@ -134,9 +133,8 @@ def minimum_draft3_draft4(validator, minimum, instance, schema):
134
133
cmp = "less than"
135
134
136
135
if failed :
137
- yield ValidationError (
138
- "%r is %s the minimum of %r" % (instance , cmp , minimum ),
139
- )
136
+ message = f"{ instance !r} is { cmp } the minimum of { minimum !r} "
137
+ yield ValidationError (message )
140
138
141
139
142
140
def maximum_draft3_draft4 (validator , maximum , instance , schema ):
@@ -151,9 +149,8 @@ def maximum_draft3_draft4(validator, maximum, instance, schema):
151
149
cmp = "greater than"
152
150
153
151
if failed :
154
- yield ValidationError (
155
- "%r is %s the maximum of %r" % (instance , cmp , maximum ),
156
- )
152
+ message = f"{ instance !r} is { cmp } the maximum of { maximum !r} "
153
+ yield ValidationError (message )
157
154
158
155
159
156
def properties_draft3 (validator , properties , instance , schema ):
@@ -170,7 +167,7 @@ def properties_draft3(validator, properties, instance, schema):
170
167
):
171
168
yield error
172
169
elif subschema .get ("required" , False ):
173
- error = ValidationError ("%r is a required property" % property )
170
+ error = ValidationError (f" { property !r } is a required property" )
174
171
error ._set (
175
172
validator = "required" ,
176
173
validator_value = subschema ["required" ],
@@ -207,7 +204,7 @@ def contains_draft6_draft7(validator, contains, instance, schema):
207
204
208
205
if not any (validator .is_valid (element , contains ) for element in instance ):
209
206
yield ValidationError (
210
- "None of %r are valid under the given schema" % ( instance ,) ,
207
+ f "None of { instance !r } are valid under the given schema" ,
211
208
)
212
209
213
210
0 commit comments