]> crepu.dev Git - config.git/blame_incremental - djavu-asus/elpa/elpy-20230803.1455/elpy/compat.py
ActualizaciĆ³n de Readme
[config.git] / djavu-asus / elpa / elpy-20230803.1455 / elpy / compat.py
... / ...
CommitLineData
1"""Python 2/3 compatibility definitions.
2
3These are used by the rest of Elpy to keep compatibility definitions
4in one place.
5
6"""
7
8import sys
9
10
11if sys.version_info >= (3, 0):
12 PYTHON3 = True
13
14 from io import StringIO
15
16 def ensure_not_unicode(obj):
17 return obj
18else:
19 PYTHON3 = False
20
21 from StringIO import StringIO # noqa
22
23 def ensure_not_unicode(obj):
24 """Return obj. If it's a unicode string, convert it to str first.
25
26 Pydoc functions simply don't find anything for unicode
27 strings. No idea why.
28
29 """
30 if isinstance(obj, unicode):
31 return obj.encode("utf-8")
32 else:
33 return obj