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

Function apply_uri_ignore_words

codespell_lib/_codespell.py:890–908  ·  view source on GitHub ↗
(
    check_matches: list[Match[str]],
    line: str,
    word_regex: Pattern[str],
    ignore_word_regex: Optional[Pattern[str]],
    uri_regex: Pattern[str],
    uri_ignore_words: set[str],
)

Source from the content-addressed store, hash-verified

888
889
890def apply_uri_ignore_words(
891 check_matches: list[Match[str]],
892 line: str,
893 word_regex: Pattern[str],
894 ignore_word_regex: Optional[Pattern[str]],
895 uri_regex: Pattern[str],
896 uri_ignore_words: set[str],
897) -> list[Match[str]]:
898 if not uri_ignore_words:
899 return check_matches
900 for uri in uri_regex.findall(line):
901 for uri_word in extract_words(uri, word_regex, ignore_word_regex):
902 if uri_word in uri_ignore_words:
903 # determine/remove only the first among matches
904 for i, match in enumerate(check_matches):
905 if match.group() == uri_word:
906 check_matches = check_matches[:i] + check_matches[i + 1 :]
907 break
908 return check_matches
909
910
911def _format_colored_output(

Callers 1

parse_linesFunction · 0.85

Calls 1

extract_wordsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…