compat.py 1.1 KB

123456789101112131415161718192021222324252627282930
  1. # flake8: noqa
  2. # pylint: skip-file
  3. # no sane linter can figure out the hackiness in this compatability layer...
  4. try:
  5. from astroid.nodes import AssignName, Attribute, ClassDef, FunctionDef, ImportFrom
  6. except ImportError:
  7. from astroid.nodes import AssName as AssignName
  8. from astroid.nodes import Class as ClassDef
  9. from astroid.nodes import From as ImportFrom
  10. from astroid.nodes import Function as FunctionDef
  11. from astroid.nodes import Getattr as Attribute
  12. # pylint 2.04->2.2 : YES was renamed to Uninferable, then YES became deprecated, then was removed
  13. try:
  14. from astroid.bases import YES as Uninferable
  15. except ImportError:
  16. try:
  17. from astroid.util import YES as Uninferable
  18. except ImportError:
  19. from astroid.util import Uninferable
  20. import pylint
  21. # pylint before version 2.3 does not support load_configuration() hook.
  22. LOAD_CONFIGURATION_SUPPORTED = False
  23. try:
  24. LOAD_CONFIGURATION_SUPPORTED = tuple(pylint.__version__.split(".")) >= ("2", "3")
  25. except AttributeError:
  26. LOAD_CONFIGURATION_SUPPORTED = pylint.__pkginfo__.numversion >= (2, 3)