Klimi's new dotfiles with stow.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

33 行
673 B

  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