Skip to content

Commit 8e090fb

Browse files
committed
Micro-optimize an oft-called lambda to a methodcaller call.
1 parent e9e9019 commit 8e090fb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

jsonschema/validators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from collections import deque
77
from collections.abc import Sequence
88
from functools import lru_cache
9+
from operator import methodcaller
910
from urllib.parse import unquote, urldefrag, urljoin, urlsplit
1011
from urllib.request import urlopen
1112
from warnings import warn
@@ -112,7 +113,7 @@ def create(
112113
type_checker=_types.draft202012_type_checker,
113114
format_checker=_format.draft202012_format_checker,
114115
id_of=_id_of,
115-
applicable_validators=lambda schema: schema.items(),
116+
applicable_validators=methodcaller("items"),
116117
):
117118
"""
118119
Create a new validator class.

0 commit comments

Comments
 (0)