|
33 | 33 |
|
34 | 34 | import urwid |
35 | 35 |
|
36 | | -if not py3: |
37 | | - import inspect |
38 | | - |
| 36 | +import inspect |
39 | 37 | from inspect import ArgSpec # we eval an ArgSpec repr, see ipython_get_argspec |
40 | 38 |
|
41 | | -from Queue import Empty |
| 39 | +try: |
| 40 | + #python 3 |
| 41 | + from queue import Empty |
| 42 | +except ImportError: |
| 43 | + #python 2 |
| 44 | + from Queue import Empty |
42 | 45 |
|
43 | 46 | Parenthesis = Token.Punctuation.Parenthesis |
44 | 47 |
|
@@ -1508,7 +1511,7 @@ def prompt(self, more): |
1508 | 1511 | # ps1 is getting loaded from. If anyone wants to make |
1509 | 1512 | # non-ascii prompts work feel free to fix this. |
1510 | 1513 | if not more: |
1511 | | - caption = ('prompt', "\n" + self.ipy_ps1.decode('ascii')) |
| 1514 | + caption = ('prompt', "\n" + self.ipy_ps1) |
1512 | 1515 | self.stdout_hist += self.ps1 |
1513 | 1516 | else: |
1514 | 1517 | caption = ('prompt_more', self.ps2.decode('ascii')) |
@@ -1562,7 +1565,7 @@ def handle_input(self, event): |
1562 | 1565 | self.history.append(inp) |
1563 | 1566 | self.edit.make_readonly() |
1564 | 1567 | # XXX what is this s_hist thing? |
1565 | | - self.stdout_hist += inp.encode(locale.getpreferredencoding()) + '\n' |
| 1568 | + self.stdout_hist += inp + '\n' |
1566 | 1569 | self.edit = None |
1567 | 1570 | # This may take a while, so force a redraw first: |
1568 | 1571 | self.main_loop.draw_screen() |
@@ -1635,7 +1638,7 @@ def tab(self, back=False): |
1635 | 1638 | if back: |
1636 | 1639 | current_match = self.matches_iter.previous() |
1637 | 1640 | else: |
1638 | | - current_match = self.matches_iter.next() |
| 1641 | + current_match = next(self.matches_iter) |
1639 | 1642 | if current_match: |
1640 | 1643 | self.overlay.tooltip_focus = True |
1641 | 1644 | if self.tooltip.grid: |
@@ -1694,7 +1697,7 @@ def main(args=None, locals_=None, banner=None): |
1694 | 1697 | palette = [ |
1695 | 1698 | (name, COLORMAP[color.lower()], 'default', |
1696 | 1699 | 'bold' if color.isupper() else 'default') |
1697 | | - for name, color in config.color_scheme.iteritems()] |
| 1700 | + for name, color in config.color_scheme.items()] |
1698 | 1701 | palette.extend([ |
1699 | 1702 | ('bold ' + name, color + ',bold', background, monochrome) |
1700 | 1703 | for name, color, background, monochrome in palette]) |
|
0 commit comments