Skip to content

Commit 7c19bc9

Browse files
committed
perf: Replace the Validator.evolve method with an equivalent class attribute
1 parent 9f86718 commit 7c19bc9

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ v4.3.0
55
certain input types (#893)
66
* Cache reference lookups for subschemas (#893)
77
* Use cached lookups for resolving fragments if the referent document is known (#893)
8+
* Replace the ``Validator.evolve`` method with an equivalent class attribute
89
* Implement a PEP544 Protocol for validator classes (#890)
910

1011
v4.2.1

jsonschema/validators.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ class Validator:
169169
schema = attr.ib(repr=reprlib.repr)
170170
resolver = attr.ib(default=None, repr=False)
171171
format_checker = attr.ib(default=None)
172+
evolve = attr.evolve
172173

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

185-
def evolve(self, **kwargs):
186-
return attr.evolve(self, **kwargs)
187-
188186
def iter_errors(self, instance, _schema=None):
189187
if _schema is not None:
190188
warnings.warn(

0 commit comments

Comments
 (0)