Show More
@@ -49,7 +49,7 c = get_config() | |||
|
49 | 49 | |
|
50 | 50 | # c.TerminalInteractiveShell.autoedit_syntax = False |
|
51 | 51 | |
|
52 |
# c. |
|
|
52 | # c.InteractiveShell.autoindent = True | |
|
53 | 53 | |
|
54 | 54 | # c.InteractiveShell.automagic = False |
|
55 | 55 | |
@@ -116,9 +116,9 c = get_config() | |||
|
116 | 116 | |
|
117 | 117 | # c.TerminalInteractiveShell.screen_length = 0 |
|
118 | 118 | |
|
119 |
# c. |
|
|
120 |
# c. |
|
|
121 |
# c. |
|
|
119 | # c.InteractiveShell.separate_in = '\n' | |
|
120 | # c.InteractiveShell.separate_out = '' | |
|
121 | # c.InteractiveShell.separate_out2 = '' | |
|
122 | 122 | |
|
123 | 123 | # c.InteractiveShell.system_header = "IPython system call: " |
|
124 | 124 |
@@ -10,9 +10,9 c.InteractiveShell.prompt_out = '<\#> ' | |||
|
10 | 10 | |
|
11 | 11 | c.InteractiveShell.prompts_pad_left = True |
|
12 | 12 | |
|
13 |
c. |
|
|
14 |
c. |
|
|
15 |
c. |
|
|
13 | c.InteractiveShell.separate_in = '' | |
|
14 | c.InteractiveShell.separate_out = '' | |
|
15 | c.InteractiveShell.separate_out2 = '' | |
|
16 | 16 | |
|
17 | 17 | c.PrefilterManager.multi_line_specials = True |
|
18 | 18 |
@@ -131,6 +131,18 def get_default_colors(): | |||
|
131 | 131 | return 'Linux' |
|
132 | 132 | |
|
133 | 133 | |
|
134 | class SeparateStr(Str): | |
|
135 | """A Str subclass to validate separate_in, separate_out, etc. | |
|
136 | ||
|
137 | This is a Str based trait that converts '0'->'' and '\\n'->'\n'. | |
|
138 | """ | |
|
139 | ||
|
140 | def validate(self, obj, value): | |
|
141 | if value == '0': value = '' | |
|
142 | value = value.replace('\\n','\n') | |
|
143 | return super(SeparateStr, self).validate(obj, value) | |
|
144 | ||
|
145 | ||
|
134 | 146 | #----------------------------------------------------------------------------- |
|
135 | 147 | # Main IPython class |
|
136 | 148 | #----------------------------------------------------------------------------- |
@@ -140,6 +152,9 class InteractiveShell(Configurable, Magic): | |||
|
140 | 152 | """An enhanced, interactive shell for Python.""" |
|
141 | 153 | |
|
142 | 154 | autocall = Enum((0,1,2), default_value=1, config=True) |
|
155 | # TODO: remove all autoindent logic and put into frontends. | |
|
156 | # We can't do this yet because even runlines uses the autoindent. | |
|
157 | autoindent = CBool(True, config=True) | |
|
143 | 158 | automagic = CBool(True, config=True) |
|
144 | 159 | cache_size = Int(1000, config=True) |
|
145 | 160 | color_info = CBool(True, config=True) |
@@ -187,6 +202,11 class InteractiveShell(Configurable, Magic): | |||
|
187 | 202 | '"\C-u": unix-line-discard', |
|
188 | 203 | ], allow_none=False, config=True) |
|
189 | 204 | |
|
205 | # TODO: this part of prompt management should be moved to the frontends. | |
|
206 | # Use custom TraitTypes that convert '0'->'' and '\\n'->'\n' | |
|
207 | separate_in = SeparateStr('\n', config=True) | |
|
208 | separate_out = SeparateStr('', config=True) | |
|
209 | separate_out2 = SeparateStr('', config=True) | |
|
190 | 210 | system_header = Str('IPython system call: ', config=True) |
|
191 | 211 | system_verbose = CBool(False, config=True) |
|
192 | 212 | wildcards_case_sensitive = CBool(True, config=True) |
@@ -55,18 +55,6 def get_default_editor(): | |||
|
55 | 55 | raw_input_original = raw_input |
|
56 | 56 | |
|
57 | 57 | |
|
58 | class SeparateStr(Str): | |
|
59 | """A Str subclass to validate separate_in, separate_out, etc. | |
|
60 | ||
|
61 | This is a Str based trait that converts '0'->'' and '\\n'->'\n'. | |
|
62 | """ | |
|
63 | ||
|
64 | def validate(self, obj, value): | |
|
65 | if value == '0': value = '' | |
|
66 | value = value.replace('\\n','\n') | |
|
67 | return super(SeparateStr, self).validate(obj, value) | |
|
68 | ||
|
69 | ||
|
70 | 58 | #----------------------------------------------------------------------------- |
|
71 | 59 | # Main class |
|
72 | 60 | #----------------------------------------------------------------------------- |
@@ -75,7 +63,6 class SeparateStr(Str): | |||
|
75 | 63 | class TerminalInteractiveShell(InteractiveShell): |
|
76 | 64 | |
|
77 | 65 | autoedit_syntax = CBool(False, config=True) |
|
78 | autoindent = CBool(True, config=True) | |
|
79 | 66 | banner = Str('') |
|
80 | 67 | banner1 = Str(default_banner, config=True) |
|
81 | 68 | banner2 = Str('', config=True) |
@@ -93,11 +80,6 class TerminalInteractiveShell(InteractiveShell): | |||
|
93 | 80 | pager = Str('less', config=True) |
|
94 | 81 | |
|
95 | 82 | screen_length = Int(0, config=True) |
|
96 | ||
|
97 | # Use custom TraitTypes that convert '0'->'' and '\\n'->'\n' | |
|
98 | separate_in = SeparateStr('\n', config=True) | |
|
99 | separate_out = SeparateStr('', config=True) | |
|
100 | separate_out2 = SeparateStr('', config=True) | |
|
101 | 83 | term_title = CBool(False, config=True) |
|
102 | 84 | |
|
103 | 85 | def __init__(self, config=None, ipython_dir=None, user_ns=None, |
@@ -85,10 +85,10 class IPAppConfigLoader(BaseAppConfigLoader): | |||
|
85 | 85 | The default is '1'.""", |
|
86 | 86 | metavar='InteractiveShell.autocall') |
|
87 | 87 | paa('--autoindent', |
|
88 |
action='store_true', dest=' |
|
|
88 | action='store_true', dest='InteractiveShell.autoindent', | |
|
89 | 89 | help='Turn on autoindenting.') |
|
90 | 90 | paa('--no-autoindent', |
|
91 |
action='store_false', dest=' |
|
|
91 | action='store_false', dest='InteractiveShell.autoindent', | |
|
92 | 92 | help='Turn off autoindenting.') |
|
93 | 93 | paa('--automagic', |
|
94 | 94 | action='store_true', dest='InteractiveShell.automagic', |
@@ -241,17 +241,17 class IPAppConfigLoader(BaseAppConfigLoader): | |||
|
241 | 241 | default.""", |
|
242 | 242 | metavar='TerminalInteractiveShell.screen_length') |
|
243 | 243 | paa('--separate-in','-si', |
|
244 |
type=str, dest=' |
|
|
244 | type=str, dest='InteractiveShell.separate_in', | |
|
245 | 245 | help="Separator before input prompts. Default '\\n'.", |
|
246 |
metavar=' |
|
|
246 | metavar='InteractiveShell.separate_in') | |
|
247 | 247 | paa('--separate-out','-so', |
|
248 |
type=str, dest=' |
|
|
248 | type=str, dest='InteractiveShell.separate_out', | |
|
249 | 249 | help="Separator before output prompts. Default 0 (nothing).", |
|
250 |
metavar=' |
|
|
250 | metavar='InteractiveShell.separate_out') | |
|
251 | 251 | paa('--separate-out2','-so2', |
|
252 |
type=str, dest=' |
|
|
252 | type=str, dest='InteractiveShell.separate_out2', | |
|
253 | 253 | help="Separator after output prompts. Default 0 (nonight).", |
|
254 |
metavar=' |
|
|
254 | metavar='InteractiveShell.separate_out2') | |
|
255 | 255 | paa('--no-sep', |
|
256 | 256 | action='store_true', dest='Global.nosep', |
|
257 | 257 | help="Eliminate all spacing between prompts.") |
@@ -448,17 +448,17 class IPythonApp(Application): | |||
|
448 | 448 | config.InteractiveShell.prompt_in1 = '>>> ' |
|
449 | 449 | config.InteractiveShell.prompt_in2 = '... ' |
|
450 | 450 | config.InteractiveShell.prompt_out = '' |
|
451 |
config. |
|
|
452 |
config. |
|
|
453 |
config. |
|
|
451 | config.InteractiveShell.separate_in = \ | |
|
452 | config.InteractiveShell.separate_out = \ | |
|
453 | config.InteractiveShell.separate_out2 = '' | |
|
454 | 454 | config.InteractiveShell.colors = 'NoColor' |
|
455 | 455 | config.InteractiveShell.xmode = 'Plain' |
|
456 | 456 | |
|
457 | 457 | if hasattr(config.Global, 'nosep'): |
|
458 | 458 | if config.Global.nosep: |
|
459 |
config. |
|
|
460 |
config. |
|
|
461 |
config. |
|
|
459 | config.InteractiveShell.separate_in = \ | |
|
460 | config.InteractiveShell.separate_out = \ | |
|
461 | config.InteractiveShell.separate_out2 = '' | |
|
462 | 462 | |
|
463 | 463 | # if there is code of files to run from the cmd line, don't interact |
|
464 | 464 | # unless the -i flag (Global.force_interact) is true. |
@@ -267,8 +267,8 def main(): | |||
|
267 | 267 | print >>sys.__stdout__, "REQ Channel on port", req_port |
|
268 | 268 | |
|
269 | 269 | # Redirect input streams and set a display hook. |
|
270 | sys.stdout = OutStream(session, pub_socket, u'stdout') | |
|
271 | sys.stderr = OutStream(session, pub_socket, u'stderr') | |
|
270 | # sys.stdout = OutStream(session, pub_socket, u'stdout') | |
|
271 | # sys.stderr = OutStream(session, pub_socket, u'stderr') | |
|
272 | 272 | sys.displayhook = DisplayHook(session, pub_socket) |
|
273 | 273 | |
|
274 | 274 | # Create the kernel. |
General Comments 0
You need to be logged in to leave comments.
Login now