From 3096afa2d4c749c6c70bae7c38536e02c287d56d 2013-06-29 18:32:41 From: Min RK Date: 2013-06-29 18:32:41 Subject: [PATCH] Merge pull request #3483 from takluyver/i2790 Inputtransformer: Allow classic prompts without space --- diff --git a/IPython/core/inputtransformer.py b/IPython/core/inputtransformer.py index 4559a7b..f9c22e1 100644 --- a/IPython/core/inputtransformer.py +++ b/IPython/core/inputtransformer.py @@ -381,7 +381,7 @@ def _strip_prompts(prompt_re): @CoroutineInputTransformer.wrap def classic_prompt(): """Strip the >>>/... prompts of the Python interactive shell.""" - prompt_re = re.compile(r'^(>>> |^\.\.\. )') + prompt_re = re.compile(r'^(>>> ?|^\.\.\. ?)') return _strip_prompts(prompt_re) @CoroutineInputTransformer.wrap diff --git a/IPython/core/tests/test_inputtransformer.py b/IPython/core/tests/test_inputtransformer.py index 5c4adad..ddc82ec 100644 --- a/IPython/core/tests/test_inputtransformer.py +++ b/IPython/core/tests/test_inputtransformer.py @@ -180,6 +180,10 @@ syntax_ml = \ ('123','123'), ('... 456"""','... 456"""'), ], + [('>>> def f(x):', 'def f(x):'), + ('...', ''), + ('... return x', ' return x'), + ], ], ipy_prompt =