Skip to content

Commit

Permalink
Simpler dictionary parsing (#2986)
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos authored Aug 1, 2023
1 parent 9c580df commit d1afa18
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions codespell_lib/_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,19 +637,14 @@ def build_dict(
if key in ignore_words:
continue
data = data.strip()
fix = data.rfind(",")

if fix < 0:
fix = True
reason = ""
elif fix == (len(data) - 1):
data = data[:fix]
reason = ""
if "," in data:
fix = False
data, reason = data.rsplit(",", 1)
reason = reason.lstrip()
else:
reason = data[fix + 1 :].strip()
data = data[:fix]
fix = False
fix = True
reason = ""

misspellings[key] = Misspelling(data, fix, reason)

Expand Down

0 comments on commit d1afa18

Please sign in to comment.