constants.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  2. # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
  3. import platform
  4. import sys
  5. import astroid
  6. import platformdirs
  7. from pylint.__pkginfo__ import __version__
  8. PY37_PLUS = sys.version_info[:2] >= (3, 7)
  9. PY38_PLUS = sys.version_info[:2] >= (3, 8)
  10. PY39_PLUS = sys.version_info[:2] >= (3, 9)
  11. IS_PYPY = platform.python_implementation() == "PyPy"
  12. PY_EXTS = (".py", ".pyc", ".pyo", ".pyw", ".so", ".dll")
  13. MSG_STATE_CONFIDENCE = 2
  14. _MSG_ORDER = "EWRCIF"
  15. MSG_STATE_SCOPE_CONFIG = 0
  16. MSG_STATE_SCOPE_MODULE = 1
  17. # The line/node distinction does not apply to fatal errors and reports.
  18. _SCOPE_EXEMPT = "FR"
  19. MSG_TYPES = {
  20. "I": "info",
  21. "C": "convention",
  22. "R": "refactor",
  23. "W": "warning",
  24. "E": "error",
  25. "F": "fatal",
  26. }
  27. MSG_TYPES_LONG = {v: k for k, v in MSG_TYPES.items()}
  28. MSG_TYPES_STATUS = {"I": 0, "C": 16, "R": 8, "W": 4, "E": 2, "F": 1}
  29. # You probably don't want to change the MAIN_CHECKER_NAME
  30. # This would affect rcfile generation and retro-compatibility
  31. # on all project using [MASTER] in their rcfile.
  32. MAIN_CHECKER_NAME = "master"
  33. # pylint: disable-next=fixme
  34. # TODO Remove in 3.0 with all the surrounding code
  35. OLD_DEFAULT_PYLINT_HOME = ".pylint.d"
  36. DEFAULT_PYLINT_HOME = platformdirs.user_cache_dir("pylint")
  37. class WarningScope:
  38. LINE = "line-based-msg"
  39. NODE = "node-based-msg"
  40. full_version = f"""pylint {__version__}
  41. astroid {astroid.__version__}
  42. Python {sys.version}"""