Method: pylint.checkers.spelling.SpellingChecker.open
Calls: 1002, Exceptions: 0, Paths: 1Back
Path 1: 1002 calls (1.0)
None (1002)
1def open(self) -> None:
2 self.initialized = False
3 if enchant is None:
4 return
5 dict_name = self.linter.config.spelling_dict
6 if not dict_name:
7 return
8
9 self.ignore_list = [
10 w.strip() for w in self.linter.config.spelling_ignore_words.split(",")
11 ]
12 # "param" appears in docstring in param description and
13 # "pylint" appears in comments in pylint pragmas.
14 self.ignore_list.extend(["param", "pylint"])
15
16 self.ignore_comment_directive_list = [
17 w.strip()
18 for w in self.linter.config.spelling_ignore_comment_directives.split(",")
19 ]
20
21 if self.linter.config.spelling_private_dict_file:
22 self.spelling_dict = enchant.DictWithPWL(
23 dict_name, self.linter.config.spelling_private_dict_file
24 )
25 else:
26 self.spelling_dict = enchant.Dict(dict_name)
27
28 if self.linter.config.spelling_store_unknown_words:
29 self.unknown_words: set[str] = set()
30
31 self.tokenizer = get_tokenizer(
32 dict_name,
33 chunkers=[ForwardSlashChunker],
34 filters=[
35 EmailFilter,
36 URLFilter,
37 WikiWordFilter,
38 WordsWithDigitsFilter,
39 WordsWithUnderscores,
40 CamelCasedWord,
41 SphinxDirectives,
42 ],
43 )
44 self.initialized = True