_compat.py 481 B

123456789101112131415161718192021
  1. import sys
  2. PY2 = sys.version_info[0] == 2
  3. PYPY = hasattr(sys, 'pypy_translation_info')
  4. JYTHON = sys.platform.startswith('java')
  5. IRONPYTHON = sys.platform == 'cli'
  6. CPYTHON = not PYPY and not JYTHON and not IRONPYTHON
  7. if PY2:
  8. import __builtin__
  9. range_type = xrange
  10. text_type = unicode
  11. long_type = long
  12. str_type = basestring
  13. unichr = __builtin__.unichr
  14. else:
  15. range_type = range
  16. text_type = str
  17. long_type = int
  18. str_type = str
  19. unichr = chr