]>
Commit | Line | Data |
---|---|---|
53e6db90 DC |
1 | """Constants that define defaults.""" |
2 | from __future__ import annotations | |
3 | ||
4 | import re | |
5 | ||
6 | EXCLUDE = ( | |
7 | ".svn", | |
8 | "CVS", | |
9 | ".bzr", | |
10 | ".hg", | |
11 | ".git", | |
12 | "__pycache__", | |
13 | ".tox", | |
14 | ".nox", | |
15 | ".eggs", | |
16 | "*.egg", | |
17 | ) | |
18 | IGNORE = ("E121", "E123", "E126", "E226", "E24", "E704", "W503", "W504") | |
19 | MAX_LINE_LENGTH = 79 | |
20 | INDENT_SIZE = 4 | |
21 | ||
22 | # Other constants | |
23 | WHITESPACE = frozenset(" \t") | |
24 | ||
25 | STATISTIC_NAMES = ("logical lines", "physical lines", "tokens") | |
26 | ||
27 | NOQA_INLINE_REGEXP = re.compile( | |
28 | # We're looking for items that look like this: | |
29 | # ``# noqa`` | |
30 | # ``# noqa: E123`` | |
31 | # ``# noqa: E123,W451,F921`` | |
32 | # ``# noqa:E123,W451,F921`` | |
33 | # ``# NoQA: E123,W451,F921`` | |
34 | # ``# NOQA: E123,W451,F921`` | |
35 | # ``# NOQA:E123,W451,F921`` | |
36 | # We do not want to capture the ``: `` that follows ``noqa`` | |
37 | # We do not care about the casing of ``noqa`` | |
38 | # We want a comma-separated list of errors | |
39 | r"# noqa(?::[\s]?(?P<codes>([A-Z]+[0-9]+(?:[,\s]+)?)+))?", | |
40 | re.IGNORECASE, | |
41 | ) | |
42 | ||
43 | NOQA_FILE = re.compile(r"\s*# flake8[:=]\s*noqa", re.I) | |
44 | ||
45 | VALID_CODE_PREFIX = re.compile("^[A-Z]{1,3}[0-9]{0,3}$", re.ASCII) |