From 48e280fcb3f2789f520ba0ce87cdbd7b5731ba60 2014-04-10 05:07:33 From: MinRK Date: 2014-04-10 05:07:33 Subject: [PATCH] only process cr if it's found because re.sub is crazy slow. --- diff --git a/IPython/nbconvert/preprocessors/coalescestreams.py b/IPython/nbconvert/preprocessors/coalescestreams.py index 5226303..12dbc51 100644 --- a/IPython/nbconvert/preprocessors/coalescestreams.py +++ b/IPython/nbconvert/preprocessors/coalescestreams.py @@ -70,7 +70,7 @@ def coalesce_streams(cell, resources, index): # process \r characters for output in new_outputs: - if output.output_type == 'stream': + if output.output_type == 'stream' and '\r' in output.text: output.text = cr_pat.sub('', output.text) cell.outputs = new_outputs