Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 regels
673 B

4 jaren geleden
  1. """Python 2/3 compatibility definitions.
  2. These are used by the rest of Elpy to keep compatibility definitions
  3. in one place.
  4. """
  5. import sys
  6. if sys.version_info >= (3, 0):
  7. PYTHON3 = True
  8. from io import StringIO
  9. def ensure_not_unicode(obj):
  10. return obj
  11. else:
  12. PYTHON3 = False
  13. from StringIO import StringIO # noqa
  14. def ensure_not_unicode(obj):
  15. """Return obj. If it's a unicode string, convert it to str first.
  16. Pydoc functions simply don't find anything for unicode
  17. strings. No idea why.
  18. """
  19. if isinstance(obj, unicode):
  20. return obj.encode("utf-8")
  21. else:
  22. return obj