|
4 | 4 | # Licensed under the terms of the MIT License |
5 | 5 | # (see spyderlib/__init__.py for details) |
6 | 6 |
|
7 | | -#============================================================================== |
8 | | -# This is the exact copy of spyderlib.py3compat from Spyder Project |
9 | | -#============================================================================== |
10 | | - |
11 | 7 | """ |
12 | | -winpython.py3compat |
13 | | -------------------- |
| 8 | +winpython.py3compat (exact copy of spyderlib.py3compat) |
| 9 | +------------------------------------------------------- |
14 | 10 |
|
15 | 11 | Transitional module providing compatibility functions intended to help |
16 | 12 | migrating from Python 2 to Python 3. |
|
28 | 24 | PY2 = sys.version[0] == '2' |
29 | 25 | PY3 = sys.version[0] == '3' |
30 | 26 |
|
| 27 | + |
| 28 | +#============================================================================== |
| 29 | +# Data types |
| 30 | +#============================================================================== |
| 31 | +if PY2: |
| 32 | + # Python 2 |
| 33 | + TEXT_TYPES = (str, unicode) |
| 34 | + INT_TYPES = (int, long) |
| 35 | +else: |
| 36 | + # Python 3 |
| 37 | + TEXT_TYPES = (str,) |
| 38 | + INT_TYPES = (int,) |
| 39 | +NUMERIC_TYPES = tuple(list(INT_TYPES) + [float, complex]) |
| 40 | + |
| 41 | + |
31 | 42 | #============================================================================== |
32 | 43 | # Renamed/Reorganized modules |
33 | 44 | #============================================================================== |
|
56 | 67 | import pickle |
57 | 68 | from collections import MutableMapping |
58 | 69 |
|
| 70 | + |
59 | 71 | #============================================================================== |
60 | 72 | # Strings |
61 | 73 | #============================================================================== |
62 | | -if PY2: |
63 | | - # Python 2 |
64 | | - text_types = (str, unicode) |
65 | | - int_types = (int, long) |
66 | | -else: |
67 | | - # Python 3 |
68 | | - text_types = (str,) |
69 | | - int_types = (int,) |
70 | | -numeric_types = tuple(list(int_types) + [float, complex]) |
71 | | - |
72 | 74 | if PY2: |
73 | 75 | # Python 2 |
74 | 76 | import codecs |
|
0 commit comments