|
15 | 15 | import os.path |
16 | 16 | from itertools import count |
17 | 17 |
|
18 | | -PY3K = sys.version_info[0] >= 3 |
19 | | - |
20 | | -# python3 compatibility |
21 | | -# --------------------- |
22 | | -try: |
23 | | - from itertools import izip |
24 | | -except ImportError: |
25 | | - izip = zip |
26 | | - |
27 | | -try: |
28 | | - from types import ClassType |
29 | | -except ImportError: |
30 | | - ClassType = type |
31 | | - |
32 | | -try: |
33 | | - unicode |
34 | | -except NameError: |
35 | | - unicode = str |
36 | | - |
37 | | -# ---------------------- |
38 | | - |
39 | 18 | class Color: |
40 | 19 | black = '30' |
41 | 20 | darkred = '31' |
@@ -78,13 +57,12 @@ class DefaultConfig: |
78 | 57 | types.FunctionType: Color.blue, |
79 | 58 | types.BuiltinFunctionType: Color.blue, |
80 | 59 |
|
81 | | - ClassType: Color.fuchsia, |
82 | 60 | type: Color.fuchsia, |
83 | 61 |
|
84 | 62 | types.ModuleType: Color.teal, |
85 | 63 | type(None): Color.lightgray, |
86 | 64 | str: Color.green, |
87 | | - unicode: Color.green, |
| 65 | + bytes: Color.green, |
88 | 66 | int: Color.yellow, |
89 | 67 | float: Color.yellow, |
90 | 68 | complex: Color.yellow, |
@@ -257,12 +235,6 @@ def attr_matches(self, text): |
257 | 235 | except Exception: |
258 | 236 | val = None # Include even if attribute not set |
259 | 237 |
|
260 | | - if not PY3K and isinstance(word, unicode): |
261 | | - # this is needed because pyrepl doesn't like unicode |
262 | | - # completions: as soon as it finds something which is not str, |
263 | | - # it stops. |
264 | | - word = word.encode('utf-8') |
265 | | - |
266 | 238 | names.append(word) |
267 | 239 | values.append(val) |
268 | 240 | if names or not noprefix: |
@@ -292,7 +264,7 @@ def attr_matches(self, text): |
292 | 264 | def color_matches(self, names, values): |
293 | 265 | matches = [self.color_for_obj(i, name, obj) |
294 | 266 | for i, name, obj |
295 | | - in izip(count(), names, values)] |
| 267 | + in zip(count(), names, values)] |
296 | 268 | # We add a space at the end to prevent the automatic completion of the |
297 | 269 | # common prefix, which is the ANSI ESCAPE sequence. |
298 | 270 | return matches + [' '] |
|
0 commit comments