Skip to content

Commit 1867fb3

Browse files
committed
make additional_dictionary.txt file optional
1 parent cd73a02 commit 1867fb3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

codespell.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import glob
66
import argparse
77
import re
8+
from pathlib import Path
89

910
from enchant.checker import SpellChecker
1011
from enchant.tokenize import EmailFilter, URLFilter
@@ -195,9 +196,11 @@ def add_dict(enchant_dict, filename):
195196
args = parse_args()
196197
# print(args)
197198

198-
thisdir = os.path.dirname(os.path.abspath(__file__))
199+
initial_dct = Path(__file__) / 'additional_dictionary.txt'
200+
if not initial_dct.exists():
201+
initial_dct = None
199202

200-
sitk_dict = DictWithPWL('en_US', thisdir+'/additional_dictionary.txt')
203+
sitk_dict = DictWithPWL('en_US', initial_dct)
201204

202205
if args.dict is not None:
203206
for d in args.dict:

0 commit comments

Comments
 (0)