3 try: import pygments
as PYG
5 try: import prompt_toolkit
as PTK
11 c
.InteractiveShell
.autocall
= 0
12 c
.InteractiveShell
.autoindent
= True
13 c
.InteractiveShell
.automagic
= False
15 c
.InteractiveShell
.color_info
= True
16 c
.InteractiveShell
.colors
= 'Linux'
18 c
.TerminalIPythonApp
.display_banner
= False
19 c
.TerminalInteractiveShell
.confirm_exit
= False
20 c
.TerminalInteractiveShell
.display_completions
= 'readlinelike'
21 c
.TerminalInteractiveShell
.extra_open_editor_shortcuts
= True
22 c
.TerminalInteractiveShell
.term_title
= False
25 if PYG
and getattr(PYG
, 'token', None):
27 c
.TerminalInteractiveShell
.highlighting_style
= 'emacs'
28 c
.TerminalInteractiveShell
.highlighting_style_overrides
= {
29 T
.Keyword
: 'bold #fff',
30 T
.Comment
: 'italic #54ff9f',
31 T
.Literal
.Number
: '#ffff00',
32 T
.Literal
.String
: '#87ceff',
33 T
.Literal
.String
.Escape
: '#87ceff',
34 T
.Literal
.String
.Interpol
: '#87ceff',
36 T
.Name
.Builtin
: '#fff',
38 T
.Name
.Constant
: 'italic #fff',
39 T
.Name
.Decorator
: '#fff',
40 T
.Name
.Exception: '#fff',
41 T
.Name
.Function
: '#fff',
42 T
.Name
.Function
.Magic
: '#fff',
44 T
.Name
.Namespace
: '#fff',
45 T
.Name
.Variable
: '#fff',
46 T
.Name
.Variable
.Class
: '#fff',
47 T
.Name
.Variable
.Global
: '#fff',
48 T
.Name
.Variable
.Instance
: '#fff',
49 T
.Name
.Variable
.Magic
: '#fff',
50 T
.Operator
: '#eec591',
51 T
.Operator
.Word
: 'bold #fff',
52 T
.Punctuation
: '#eec591',
57 PTK
.token
.Token
.MatchingBracket
: '',
58 PTK
.token
.Token
.MatchingBracket
.Cursor
: '',
59 PTK
.token
.Token
.MatchingBracket
.Other
: 'bg:#006400'
61 c
.TerminalInteractiveShell
.highlighting_style_overrides
.update(d
)
63 ## Set the indent level. `Look what you made me do.'
64 import IPython
.core
.inputsplitter
as _IPCIP
65 def my_find_indent(self
, line
):
66 """Compute the new indentation level for a single line.
71 A single new line of non-whitespace, non-comment Python input.
76 New value for the indent level (it may be equal to self.indent_spaces
77 if indentation doesn't change.
80 Whether the new line causes a full flush-left dedent.
82 indent_spaces
= self
.indent_spaces
83 full_dedent
= self
._full_dedent
85 inisp
= _IPCIP
.num_ini_spaces(line
)
86 if inisp
< indent_spaces
:
88 if indent_spaces
<= 0:
89 #print 'Full dedent in text',self.source # dbg
92 if line
.rstrip()[-1] == ':':
94 elif _IPCIP
.dedent_re
.match(line
):
96 if indent_spaces
<= 0:
100 if indent_spaces
< 0:
102 #print 'safety' # dbg
104 return indent_spaces
, full_dedent
105 _IPCIP
.InputSplitter
._find_indent
= my_find_indent