MCPcopy Create free account
hub / github.com/codespell-project/codespell / _check_aspell

Function _check_aspell

codespell_lib/tests/test_dictionary.py:102–125  ·  view source on GitHub ↗
(
    phrase: str,
    msg: str,
    in_aspell: Optional[bool],
    fname: str,
    languages: Iterable[str],
)

Source from the content-addressed store, hash-verified

100
101
102def _check_aspell(
103 phrase: str,
104 msg: str,
105 in_aspell: Optional[bool],
106 fname: str,
107 languages: Iterable[str],
108) -> None:
109 if not spellers: # if no spellcheckers exist
110 return # cannot check
111 if in_aspell is None:
112 return # don't check
113 if " " in phrase:
114 for word in phrase.split():
115 _check_aspell(word, msg, in_aspell, fname, languages)
116 return # stop normal checking as we've done each word above
117 this_in_aspell = any(
118 spellers[lang].check(phrase.encode(spellers[lang].ConfigKeys()["encoding"][1]))
119 for lang in languages
120 )
121 end = f"be in aspell dictionaries ({', '.join(languages)}) for dictionary {fname}"
122 if in_aspell: # should be an error in aspell
123 assert this_in_aspell, f"{msg} should {end}"
124 else: # shouldn't be
125 assert not this_in_aspell, f"{msg} should not {end}"
126
127
128whitespace = re.compile(r"\s")

Callers 1

_check_err_repFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…