Show More
@@ -30,7 +30,6 b' ESC_SEQUENCES = [ESC_SHELL, ESC_SH_CAP, ESC_HELP ,\\' | |||||
30 | ESC_QUOTE, ESC_QUOTE2, ESC_PAREN ] |
|
30 | ESC_QUOTE, ESC_QUOTE2, ESC_PAREN ] | |
31 |
|
31 | |||
32 |
|
32 | |||
33 |
|
||||
34 | class InputTransformer(object): |
|
33 | class InputTransformer(object): | |
35 | __metaclass__ = abc.ABCMeta |
|
34 | __metaclass__ = abc.ABCMeta | |
36 |
|
35 | |||
@@ -193,6 +192,7 b' def has_comment(src):' | |||||
193 | pass |
|
192 | pass | |
194 | return(tokenize.COMMENT in toktypes) |
|
193 | return(tokenize.COMMENT in toktypes) | |
195 |
|
194 | |||
|
195 | ||||
196 | @stateless_input_transformer |
|
196 | @stateless_input_transformer | |
197 | def help_end(line): |
|
197 | def help_end(line): | |
198 | """Translate lines with ?/?? at the end""" |
|
198 | """Translate lines with ?/?? at the end""" | |
@@ -207,8 +207,8 b' def help_end(line):' | |||||
207 | next_input = line.rstrip('?') if line.strip() != m.group(0) else None |
|
207 | next_input = line.rstrip('?') if line.strip() != m.group(0) else None | |
208 |
|
208 | |||
209 | return _make_help_call(target, esc, lspace, next_input) |
|
209 | return _make_help_call(target, esc, lspace, next_input) | |
210 |
|
210 | |||
211 |
|
211 | |||
212 | @coroutine_input_transformer |
|
212 | @coroutine_input_transformer | |
213 | def cellmagic(): |
|
213 | def cellmagic(): | |
214 | tpl = 'get_ipython().run_cell_magic(%r, %r, %r)' |
|
214 | tpl = 'get_ipython().run_cell_magic(%r, %r, %r)' | |
@@ -235,6 +235,7 b' def cellmagic():' | |||||
235 | magic_name = magic_name.lstrip(ESC_MAGIC2) |
|
235 | magic_name = magic_name.lstrip(ESC_MAGIC2) | |
236 | line = tpl % (magic_name, first, u'\n'.join(body)) |
|
236 | line = tpl % (magic_name, first, u'\n'.join(body)) | |
237 |
|
237 | |||
|
238 | ||||
238 | def _strip_prompts(prompt1_re, prompt2_re): |
|
239 | def _strip_prompts(prompt1_re, prompt2_re): | |
239 | """Remove matching input prompts from a block of input.""" |
|
240 | """Remove matching input prompts from a block of input.""" | |
240 | line = '' |
|
241 | line = '' | |
@@ -272,6 +273,7 b' def ipy_prompt():' | |||||
272 |
|
273 | |||
273 | ipy_prompt.look_in_string = True |
|
274 | ipy_prompt.look_in_string = True | |
274 |
|
275 | |||
|
276 | ||||
275 | @coroutine_input_transformer |
|
277 | @coroutine_input_transformer | |
276 | def leading_indent(): |
|
278 | def leading_indent(): | |
277 | space_re = re.compile(r'^[ \t]+') |
|
279 | space_re = re.compile(r'^[ \t]+') | |
@@ -296,6 +298,7 b' def leading_indent():' | |||||
296 |
|
298 | |||
297 | leading_indent.look_in_string = True |
|
299 | leading_indent.look_in_string = True | |
298 |
|
300 | |||
|
301 | ||||
299 | def _special_assignment(assignment_re, template): |
|
302 | def _special_assignment(assignment_re, template): | |
300 | line = '' |
|
303 | line = '' | |
301 | while True: |
|
304 | while True: |
General Comments 0
You need to be logged in to leave comments.
Login now