Skip to content

Commit

Permalink
perf: Replace the Validator.evolve method with an equivalent class …
Browse files Browse the repository at this point in the history
…attribute
  • Loading branch information
Stranger6667 committed Dec 16, 2021
1 parent 9f86718 commit 7c19bc9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ v4.3.0
certain input types (#893)
* Cache reference lookups for subschemas (#893)
* Use cached lookups for resolving fragments if the referent document is known (#893)
* Replace the ``Validator.evolve`` method with an equivalent class attribute
* Implement a PEP544 Protocol for validator classes (#890)

v4.2.1
Expand Down
4 changes: 1 addition & 3 deletions jsonschema/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class Validator:
schema = attr.ib(repr=reprlib.repr)
resolver = attr.ib(default=None, repr=False)
format_checker = attr.ib(default=None)
evolve = attr.evolve

def __attrs_post_init__(self):
if self.resolver is None:
Expand All @@ -182,9 +183,6 @@ def check_schema(cls, schema):
for error in cls(cls.META_SCHEMA).iter_errors(schema):
raise exceptions.SchemaError.create_from(error)

def evolve(self, **kwargs):
return attr.evolve(self, **kwargs)

def iter_errors(self, instance, _schema=None):
if _schema is not None:
warnings.warn(
Expand Down

0 comments on commit 7c19bc9

Please sign in to comment.