_compat.py 483 B

123456789101112131415161718192021222324
  1. # -*- coding: utf-8 -*-
  2. """
  3. markupsafe._compat
  4. ~~~~~~~~~~~~~~~~~~
  5. Compatibility module for different Python versions.
  6. :copyright: (c) 2013 by Armin Ronacher.
  7. :license: BSD, see LICENSE for more details.
  8. """
  9. import sys
  10. PY2 = sys.version_info[0] == 2
  11. if not PY2:
  12. text_type = str
  13. string_types = (str,)
  14. unichr = chr
  15. int_types = (int,)
  16. else:
  17. text_type = unicode
  18. string_types = (str, unicode)
  19. unichr = unichr
  20. int_types = (int, long)