]>
crepu.dev Git - config.git/blob - djavu-asus/elpa/elpy-20230803.1455/elpy/compat.py
1 """Python 2/3 compatibility definitions.
3 These are used by the rest of Elpy to keep compatibility definitions
11 if sys
.version_info
>= (3, 0):
14 from io
import StringIO
16 def ensure_not_unicode(obj
):
21 from StringIO
import StringIO
# noqa
23 def ensure_not_unicode(obj
):
24 """Return obj. If it's a unicode string, convert it to str first.
26 Pydoc functions simply don't find anything for unicode
30 if isinstance(obj
, unicode):
31 return obj
.encode("utf-8")