Skip to content

Commit aaafa1e

Browse files
committed
Minor local variable tweaking.
1 parent 998a7c5 commit aaafa1e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

jsonschema/_validators.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,12 @@ def items(validator, items, instance, schema):
6767
return
6868

6969
prefix = len(schema.get("prefixItems", []))
70-
if items is False and len(instance) > prefix:
71-
message = f"Expected at most {prefix} items, but found {len(instance)}"
70+
total = len(instance)
71+
if items is False and total > prefix:
72+
message = f"Expected at most {prefix} items, but found {total}"
7273
yield ValidationError(message)
7374
else:
74-
for index in range(prefix, len(instance)):
75+
for index in range(prefix, total):
7576
yield from validator.descend(
7677
instance=instance[index],
7778
schema=items,

0 commit comments

Comments
 (0)