Show More
@@ -1,4 +1,8 b'' | |||||
|
1 | """IPython terminal interface using prompt_toolkit in place of readline""" | |||
|
2 | from __future__ import print_function | |||
|
3 | ||||
1 | from IPython.core.interactiveshell import InteractiveShell |
|
4 | from IPython.core.interactiveshell import InteractiveShell | |
|
5 | from IPython.utils.py3compat import PY3 | |||
2 | from traitlets import Bool, Unicode, Dict |
|
6 | from traitlets import Bool, Unicode, Dict | |
3 |
|
7 | |||
4 | from prompt_toolkit.completion import Completer, Completion |
|
8 | from prompt_toolkit.completion import Completer, Completion | |
@@ -15,7 +19,7 b' from prompt_toolkit.layout.lexers import PygmentsLexer' | |||||
15 | from prompt_toolkit.styles import PygmentsStyle |
|
19 | from prompt_toolkit.styles import PygmentsStyle | |
16 |
|
20 | |||
17 | from pygments.styles import get_style_by_name |
|
21 | from pygments.styles import get_style_by_name | |
18 | from pygments.lexers import Python3Lexer |
|
22 | from pygments.lexers import Python3Lexer, PythonLexer | |
19 | from pygments.token import Token |
|
23 | from pygments.token import Token | |
20 |
|
24 | |||
21 |
|
25 | |||
@@ -116,7 +120,7 b' class PTInteractiveShell(InteractiveShell):' | |||||
116 | style_dict=style_overrides) |
|
120 | style_dict=style_overrides) | |
117 |
|
121 | |||
118 | app = create_prompt_application(multiline=True, |
|
122 | app = create_prompt_application(multiline=True, | |
119 | lexer=PygmentsLexer(Python3Lexer), |
|
123 | lexer=PygmentsLexer(Python3Lexer if PY3 else PythonLexer), | |
120 | get_prompt_tokens=self.get_prompt_tokens, |
|
124 | get_prompt_tokens=self.get_prompt_tokens, | |
121 | key_bindings_registry=kbmanager.registry, |
|
125 | key_bindings_registry=kbmanager.registry, | |
122 | history=history, |
|
126 | history=history, |
General Comments 0
You need to be logged in to leave comments.
Login now