_compat.py 521 B

12345678910111213141516171819202122232425262728293031
  1. from six import string_types
  2. # enum compat
  3. try:
  4. from enum import Enum
  5. except:
  6. class Enum(object): pass
  7. # no objects will be instances of this class
  8. # collections compat
  9. try:
  10. from collections.abc import (
  11. Container,
  12. Hashable,
  13. Iterable,
  14. Mapping,
  15. Sequence,
  16. Set,
  17. Sized,
  18. )
  19. except ImportError:
  20. from collections import (
  21. Container,
  22. Hashable,
  23. Iterable,
  24. Mapping,
  25. Sequence,
  26. Set,
  27. Sized,
  28. )