@@ -152,7 +152,8 @@ def create(
152
152
153
153
format_checker (jsonschema.FormatChecker):
154
154
155
- a format checker, used when applying the :validator:`format` validator.
155
+ a format checker, used when applying the :validator:`format`
156
+ validator.
156
157
157
158
If unprovided, a `jsonschema.FormatChecker` will be created
158
159
with a set of default formats typical of JSON Schema drafts.
@@ -171,16 +172,16 @@ def create(
171
172
172
173
a new `jsonschema.protocols.Validator` class
173
174
"""
174
- # rename to not clash with "format_checker" argument of `Validator.__init__()`
175
- fmt_checker = format_checker
175
+ # preemptively don't shadow the `Validator.format_checker` local
176
+ format_checker_arg = format_checker
176
177
177
178
@attr .s
178
179
class Validator :
179
180
180
181
VALIDATORS = dict (validators )
181
182
META_SCHEMA = dict (meta_schema )
182
183
TYPE_CHECKER = type_checker
183
- FORMAT_CHECKER = fmt_checker
184
+ FORMAT_CHECKER = format_checker_arg
184
185
ID_OF = staticmethod (id_of )
185
186
186
187
schema = attr .ib (repr = reprlib .repr )
@@ -295,7 +296,13 @@ def is_valid(self, instance, _schema=None):
295
296
return Validator
296
297
297
298
298
- def extend (validator , validators = (), version = None , type_checker = None , format_checker = None ):
299
+ def extend (
300
+ validator ,
301
+ validators = (),
302
+ version = None ,
303
+ type_checker = None ,
304
+ format_checker = None ,
305
+ ):
299
306
"""
300
307
Create a new validator class by extending an existing one.
301
308
@@ -335,7 +342,8 @@ def extend(validator, validators=(), version=None, type_checker=None, format_che
335
342
336
343
format_checker (jsonschema.FormatChecker):
337
344
338
- a format checker, used when applying the :validator:`format` validator.
345
+ a format checker, used when applying the :validator:`format`
346
+ validator.
339
347
340
348
If unprovided, the format checker of the extended
341
349
`jsonschema.protocols.Validator` will be carried along.
0 commit comments