defaults.py 1.1 KB

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