
    ^hi                     V    S r SSKrSSKJr  \R                  " S5      r " S S\5      rg)zHPreprocessor for merging consecutive stream outputs for easier handling.    N)Preprocessorz.*\r(?=[^\n])c                       \ rS rSrSrS rSrg)CoalesceStreamsPreprocessor   zs
Merge consecutive sequences of stream output into single stream
to prevent extra newlines inserted at flush calls
c                    UR                  S/ 5      nU(       d  X4$ US   nU/nUSS  Hq  nUR                  S:X  aK  UR                  S:X  a;  UR                  UR                  :X  a!  U=R                  UR                  -  sl        M^  UR	                  U5        UnMs     U HL  nUR                  S:X  d  M  SUR                  ;   d  M'  [
        R                  SUR                  5      Ul        MN     Xal        X4$ )z?
Apply a transformation on each cell. See base.py for details.
outputsr      Nstream )getoutput_typenametextappendCR_PATsubr   )selfcell	resources
cell_indexr   lastnew_outputsoutputs           a/home/james-whalen/.local/lib/python3.13/site-packages/nbconvert/preprocessors/coalescestreams.pypreprocess_cell+CoalesceStreamsPreprocessor.preprocess_cell   s     ((9b)?"qzfabkF""h.$$0II,		V[[(	""6* " "F!!X-$&++2E$jjV[[9 " #     N)__name__
__module____qualname____firstlineno____doc__r   __static_attributes__r   r   r   r   r      s    
r   r   )r$   renbconvert.preprocessorsr   compiler   r   r   r   r   <module>r)      s+    N 	 1	$	%!, !r   