const.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
  2. # For details: https://github.com/PyCQA/astroid/blob/main/LICENSE
  3. # Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt
  4. import enum
  5. import sys
  6. from pathlib import Path
  7. PY38 = sys.version_info[:2] == (3, 8)
  8. PY38_PLUS = sys.version_info >= (3, 8)
  9. PY39_PLUS = sys.version_info >= (3, 9)
  10. PY310_PLUS = sys.version_info >= (3, 10)
  11. PY311_PLUS = sys.version_info >= (3, 11)
  12. BUILTINS = "builtins" # TODO Remove in 2.8
  13. WIN32 = sys.platform == "win32"
  14. IS_PYPY = sys.implementation.name == "pypy"
  15. IS_JYTHON = sys.implementation.name == "jython"
  16. # pylint: disable-next=no-member
  17. PYPY_7_3_11_PLUS = IS_PYPY and sys.pypy_version_info >= (7, 3, 11) # type: ignore[attr-defined]
  18. class Context(enum.Enum):
  19. Load = 1
  20. Store = 2
  21. Del = 3
  22. # TODO Remove in 3.0 in favor of Context
  23. Load = Context.Load
  24. Store = Context.Store
  25. Del = Context.Del
  26. ASTROID_INSTALL_DIRECTORY = Path(__file__).parent
  27. BRAIN_MODULES_DIRECTORY = ASTROID_INSTALL_DIRECTORY / "brain"
  28. _EMPTY_OBJECT_MARKER = object()