Skip to content

Commit ba04eb6

Browse files
superficial unicode output
1 parent c131d61 commit ba04eb6

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import unicode_literals
2+
13
import code
24
import contextlib
35
import errno
@@ -1124,10 +1126,10 @@ def move_screen_up(current_line_start_row):
11241126
info_max_rows = max(visible_space_above, visible_space_below)
11251127
infobox = paint.paint_infobox(info_max_rows,
11261128
int(width * self.config.cli_suggestion_width),
1127-
self.matches_iter.matches,
1129+
[s.decode('ascii') for s in self.matches_iter.matches],
11281130
self.argspec,
1129-
self.current_match,
1130-
self.docstring,
1131+
None if self.current_match is None else self.current_match.decode('ascii'),
1132+
None if self.docstring is None else self.docstring.decode('utf8'),
11311133
self.config,
11321134
self.matches_iter.completer.format if self.matches_iter.completer else None)
11331135

bpython/curtsiesfrontend/replpainter.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
23
import logging
34

45
from curtsies import fsarray, fmtstr
@@ -83,7 +84,7 @@ def formatted_argspec(argspec, columns, config):
8384
bolds = {token_color: lambda x: bold(token_color(x)),
8485
arg_color: lambda x: bold(arg_color(x))}
8586

86-
s = func_color(func) + arg_color(': (')
87+
s = func_color(func.decode('utf8')) + arg_color(': (')
8788

8889
if is_bound_method and isinstance(in_arg, int): #TODO what values could this have?
8990
in_arg += 1
@@ -97,13 +98,13 @@ def formatted_argspec(argspec, columns, config):
9798
color = bolds[color]
9899

99100
if not py3:
100-
s += color(inspect.strseq(arg, str))
101+
s += color(inspect.strseq(arg, str).decode('utf8'))
101102
else:
102103
s += color(arg)
103104

104105
if kw is not None:
105106
s += punctuation_color('=')
106-
s += token_color(kw)
107+
s += token_color(kw.decode('utf8'))
107108

108109
if i != len(args) - 1:
109110
s += punctuation_color(', ')
@@ -124,11 +125,11 @@ def formatted_argspec(argspec, columns, config):
124125
color = token_color
125126
if in_arg:
126127
color = bolds[color]
127-
s += color(arg)
128+
s += color(arg.decode('utf8'))
128129
default = kwonly_defaults.get(arg, marker)
129130
if default is not marker:
130131
s += punctuation_color('=')
131-
s += token_color(repr(default))
132+
s += token_color(repr(default).decode('utf8'))
132133

133134
if _kwargs:
134135
if args or _args or (py3 and kwonly):

bpython/repl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#
2323

2424
from __future__ import with_statement
25+
from __future__ import unicode_literals
2526
import code
2627
import codecs
2728
import errno
@@ -72,7 +73,7 @@ def __init__(self, locals=None, encoding=None):
7273
def runsource(self, source, filename='<input>', symbol='single',
7374
encode=True):
7475
if encode:
75-
source = '# coding: %s\n%s' % (self.encoding,
76+
source = b'# coding: %s\n%s' % (self.encoding,
7677
source.encode(self.encoding))
7778
return code.InteractiveInterpreter.runsource(self, source,
7879
filename, symbol)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def initialize_options(self):
153153

154154
if sys.version_info[:2] >= (2, 6):
155155
# curtsies only supports 2.6 and onwards
156-
extras_require['curtsies'] = ['curtsies >=0.1.15, <0.2.0', 'greenlet']
156+
extras_require['curtsies'] = ['curtsies >=0.2.0, <0.3.0', 'greenlet']
157157
extras_require['watch'] = ['watchdog']
158158
packages.append("bpython.curtsiesfrontend")
159159
entry_points['console_scripts'].append(

0 commit comments

Comments
 (0)