summaryrefslogtreecommitdiff
path: root/jsonschema/validators.py
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2022-07-26 10:51:19 +0300
committerJulian Berman <Julian@GrayVines.com>2022-07-26 10:51:19 +0300
commit8e090fb258e6500940e2177dfc0fd5cd73fc5e14 (patch)
treeb1a7fc9af0e167b6962ae9a5d2d53e9aa37da749 /jsonschema/validators.py
parente9e90199ea43ab9f48ced4347b6ad95e70fa08ca (diff)
downloadjsonschema-8e090fb258e6500940e2177dfc0fd5cd73fc5e14.tar.gz
Micro-optimize an oft-called lambda to a methodcaller call.
Diffstat (limited to 'jsonschema/validators.py')
-rw-r--r--jsonschema/validators.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/jsonschema/validators.py b/jsonschema/validators.py
index f986f1c..7cedcff 100644
--- a/jsonschema/validators.py
+++ b/jsonschema/validators.py
@@ -6,6 +6,7 @@ from __future__ import annotations
from collections import deque
from collections.abc import Sequence
from functools import lru_cache
+from operator import methodcaller
from urllib.parse import unquote, urldefrag, urljoin, urlsplit
from urllib.request import urlopen
from warnings import warn
@@ -112,7 +113,7 @@ def create(
type_checker=_types.draft202012_type_checker,
format_checker=_format.draft202012_format_checker,
id_of=_id_of,
- applicable_validators=lambda schema: schema.items(),
+ applicable_validators=methodcaller("items"),
):
"""
Create a new validator class.