gh-99016: Make build scripts compatible with Python 3.8 (GH-99017)

This commit is contained in:
Serhiy Storchaka 2022-11-02 20:30:09 +02:00 committed by GitHub
parent 276d77724f
commit f520d720f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View file

@ -1,7 +1,7 @@
"""Generate 10,000 unique examples for the Levenshtein short-circuit tests."""
import argparse
from functools import cache
from functools import lru_cache
import json
import os.path
from random import choices, randrange
@ -22,7 +22,7 @@ def _substitution_cost(ch_a, ch_b):
return _MOVE_COST
@cache
@lru_cache(None)
def levenshtein(a, b):
if not a or not b:
return (len(a) + len(b)) * _MOVE_COST