MCPcopy Index your code
hub / github.com/python-jsonschema/jsonschema / evolve

Method evolve

jsonschema/protocols.py:209–230  ·  view source on GitHub ↗

Create a new validator like this one, but with given changes. Preserves all other attributes, so can be used to e.g. create a validator with a different schema but with the same :kw:`$ref` resolution behavior. >>> validator = Draft202012Validator({})

(self, **kwargs)

Source from the content-addressed store, hash-verified

207 """
208
209 def evolve(self, **kwargs) -> Validator:
210 """
211 Create a new validator like this one, but with given changes.
212
213 Preserves all other attributes, so can be used to e.g. create a
214 validator with a different schema but with the same :kw:`$ref`
215 resolution behavior.
216
217 >>> validator = Draft202012Validator({})
218 >>> validator.evolve(schema={"type": "number"})
219 Draft202012Validator(schema={'type': 'number'}, format_checker=None)
220
221 The returned object satisfies the validator protocol, but may not
222 be of the same concrete class! In particular this occurs
223 when a :kw:`$ref` occurs to a schema with a different
224 :kw:`$schema` than this one (i.e. for a different draft).
225
226 >>> validator.evolve(
227 ... schema={"$schema": Draft7Validator.META_SCHEMA["$id"]}
228 ... )
229 Draft7Validator(schema=..., format_checker=None)
230 """

Callers 12

test_evolveMethod · 0.95
containsFunction · 0.45
oneOfFunction · 0.45
not_Function · 0.45
if_Function · 0.45
disallow_draft3Function · 0.45
contains_draft6_draft7Function · 0.45

Calls

no outgoing calls

Tested by 2

test_evolveMethod · 0.76