chore: move to Ruff and add rules (#4483)

This commit is contained in:
Henry Schreiner
2023-02-22 06:18:55 -08:00
committed by GitHub
parent a19daeac16
commit 438034c5b8
35 changed files with 266 additions and 279 deletions

View File

@@ -17,14 +17,18 @@ def run(args: List[str]) -> None:
assert len(args) == 1, "codespell_errors.txt"
cache = {}
done = set()
for line in sorted(open(args[0]).read().splitlines()):
with open(args[0]) as f:
lines = f.read().splitlines()
for line in sorted(lines):
i = line.find(" ==> ")
if i > 0:
flds = line[:i].split(":")
if len(flds) >= 2:
filename, line_num = flds[:2]
if filename not in cache:
cache[filename] = open(filename).read().splitlines()
with open(filename) as f:
cache[filename] = f.read().splitlines()
supp = cache[filename][int(line_num) - 1]
if supp not in done:
print(supp)