We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc3ba8e commit d2aa2baCopy full SHA for d2aa2ba
jsonschema/exceptions.py
@@ -8,7 +8,6 @@
8
from textwrap import dedent, indent
9
from typing import TYPE_CHECKING, Any, ClassVar
10
import heapq
11
-import itertools
12
import warnings
13
14
from attrs import define
@@ -471,11 +470,9 @@ def best_match(errors, key=relevance):
471
470
set of inputs from version to version if better heuristics are added.
472
473
"""
474
- errors = iter(errors)
475
- best = next(errors, None)
+ best = max(errors, key=key, default=None)
476
if best is None:
477
return
478
- best = max(itertools.chain([best], errors), key=key)
479
480
while best.context:
481
# Calculate the minimum via nsmallest, because we don't recurse if
0 commit comments