compat.py 367 B

12345678910111213141516171819
  1. import sys
  2. __all__ = ['string_types', 'text_type', 'lru_cache']
  3. if sys.version_info[0] == 2:
  4. # Python 2
  5. PY2 = True
  6. PY3 = False
  7. string_types = basestring,
  8. text_type = unicode
  9. from ._lru_cache import lru_cache
  10. else:
  11. # Python 3
  12. PY2 = False
  13. PY3 = True
  14. string_types = str,
  15. text_type = str
  16. from functools import lru_cache