]> crepu.dev Git - config.git/blob - djavu-asus/elpa/elpy-20230803.1455/elpy/compat.py
Configuracion en desarrollo PC pega
[config.git] / djavu-asus / elpa / elpy-20230803.1455 / elpy / compat.py
1 """Python 2/3 compatibility definitions.
2
3 These are used by the rest of Elpy to keep compatibility definitions
4 in one place.
5
6 """
7
8 import sys
9
10
11 if sys.version_info >= (3, 0):
12 PYTHON3 = True
13
14 from io import StringIO
15
16 def ensure_not_unicode(obj):
17 return obj
18 else:
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