_compat.py 307 B

123456789101112131415
  1. """
  2. Avoid depending on any particular Python 3 compatibility approach.
  3. """
  4. import sys
  5. PY3 = sys.version_info[0] == 3
  6. if PY3: # pragma: nocover
  7. maketrans = bytes.maketrans
  8. text_type = str
  9. else: # pragma: nocover
  10. import string
  11. maketrans = string.maketrans
  12. text_type = unicode # noqa