defaults.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. """Constants that define defaults."""
  2. import re
  3. EXCLUDE = (
  4. ".svn",
  5. "CVS",
  6. ".bzr",
  7. ".hg",
  8. ".git",
  9. "__pycache__",
  10. ".tox",
  11. ".nox",
  12. ".eggs",
  13. "*.egg",
  14. )
  15. IGNORE = ("E121", "E123", "E126", "E226", "E24", "E704", "W503", "W504")
  16. SELECT = ("E", "F", "W", "C90")
  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. # https://regex101.com/r/4XUuax/2 full explanation of the regex
  35. r"# noqa(?::[\s]?(?P<codes>([A-Z]+[0-9]+(?:[,\s]+)?)+))?",
  36. re.IGNORECASE,
  37. )
  38. NOQA_FILE = re.compile(r"\s*# flake8[:=]\s*noqa", re.I)