Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6c6a0ce

Browse files
committed
3 at last, 3 at last! Thank Guido almighty, we're python 3 at last!
closes #7
1 parent 68debb6 commit 6c6a0ce

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

bipython/__init__.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@
3333

3434
import urwid
3535

36-
if not py3:
37-
import inspect
38-
36+
import inspect
3937
from inspect import ArgSpec # we eval an ArgSpec repr, see ipython_get_argspec
4038

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
4245

4346
Parenthesis = Token.Punctuation.Parenthesis
4447

@@ -1508,7 +1511,7 @@ def prompt(self, more):
15081511
# ps1 is getting loaded from. If anyone wants to make
15091512
# non-ascii prompts work feel free to fix this.
15101513
if not more:
1511-
caption = ('prompt', "\n" + self.ipy_ps1.decode('ascii'))
1514+
caption = ('prompt', "\n" + self.ipy_ps1)
15121515
self.stdout_hist += self.ps1
15131516
else:
15141517
caption = ('prompt_more', self.ps2.decode('ascii'))
@@ -1562,7 +1565,7 @@ def handle_input(self, event):
15621565
self.history.append(inp)
15631566
self.edit.make_readonly()
15641567
# XXX what is this s_hist thing?
1565-
self.stdout_hist += inp.encode(locale.getpreferredencoding()) + '\n'
1568+
self.stdout_hist += inp + '\n'
15661569
self.edit = None
15671570
# This may take a while, so force a redraw first:
15681571
self.main_loop.draw_screen()
@@ -1635,7 +1638,7 @@ def tab(self, back=False):
16351638
if back:
16361639
current_match = self.matches_iter.previous()
16371640
else:
1638-
current_match = self.matches_iter.next()
1641+
current_match = next(self.matches_iter)
16391642
if current_match:
16401643
self.overlay.tooltip_focus = True
16411644
if self.tooltip.grid:
@@ -1694,7 +1697,7 @@ def main(args=None, locals_=None, banner=None):
16941697
palette = [
16951698
(name, COLORMAP[color.lower()], 'default',
16961699
'bold' if color.isupper() else 'default')
1697-
for name, color in config.color_scheme.iteritems()]
1700+
for name, color in config.color_scheme.items()]
16981701
palette.extend([
16991702
('bold ' + name, color + ',bold', background, monochrome)
17001703
for name, color, background, monochrome in palette])

0 commit comments

Comments
 (0)