11
11
from pygments .lexers import get_lexer_by_name
12
12
13
13
from bpython .curtsiesfrontend .parse import parse
14
- from bpython .repl import RuntimeTimer
14
+ from bpython .repl import Interpreter as ReplInterpreter
15
15
16
16
default_colors = {
17
17
Generic .Error : 'R' ,
@@ -61,7 +61,7 @@ def format(self, tokensource, outfile):
61
61
outfile .write (parse (o .rstrip ()))
62
62
63
63
64
- class Interp (code . InteractiveInterpreter ):
64
+ class Interp (ReplInterpreter ):
65
65
def __init__ (self , locals = None ):
66
66
"""Constructor.
67
67
@@ -75,13 +75,13 @@ def __init__(self, locals=None):
75
75
"""
76
76
if locals is None :
77
77
locals = {"__name__" : "__console__" , "__doc__" : None }
78
+ ReplInterpreter .__init__ (self , locals )
78
79
self .locals = locals
79
80
self .compile = CommandCompiler ()
80
81
81
82
# typically changed after being instantiated
82
83
self .write = lambda stuff : sys .stderr .write (stuff )
83
84
self .outfile = self
84
- self .timer = RuntimeTimer ()
85
85
86
86
def showsyntaxerror (self , filename = None ):
87
87
"""Display the syntax error that just occurred.
@@ -160,11 +160,12 @@ def format(self, tbtext, lexer):
160
160
cur_line .append ((token , text ))
161
161
assert cur_line == [], cur_line
162
162
163
- def runsource (self , source , filename = "<input>" , symbol = "single" ):
163
+ def runsource (self , source , filename = "<input>" , symbol = "single" ,
164
+ encode = None ):
165
+ # TODO: encode does nothing
164
166
with self .timer :
165
167
return code .InteractiveInterpreter .runsource (
166
- self , source , filename = filename , symbol = symbol )
167
-
168
+ self , source , filename , symbol )
168
169
169
170
def code_finished_will_parse (s , compiler ):
170
171
"""Returns a tuple of whether the buffer could be complete and whether it
0 commit comments