a
    ø£Be  ã                   @   s0   d Z ddlmZ ddlmZ G dd„ deƒZdS )zªModule containing a preprocessor that converts outputs in the notebook from
one format to another.

Converts all of the outputs in a notebook from one format to another.
é    )ÚUnicodeé   )ÚPreprocessorc                       sT   e Zd ZdZedd�jdd�Zedd�jdd�Z‡ fdd„Zd	d
„ Z	dd„ Z
‡  ZS )ÚConvertFiguresPreprocessorzO
    Converts all of the outputs in a notebook from one format to another.
    zFormat the converter accepts)ÚhelpT)ÚconfigzFormat the converter writesc                    s   t ƒ jf i |¤Ž dS )z$
        Public constructor
        N)ÚsuperÚ__init__)ÚselfÚkw©Ú	__class__© úi/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/nbconvert/preprocessors/convertfigures.pyr	      s    z#ConvertFiguresPreprocessor.__init__c                 C   s
   t ƒ ‚dS )zConvert the figure.N)ÚNotImplementedError)r
   Zdata_formatÚdatar   r   r   Úconvert_figure   s    z)ConvertFiguresPreprocessor.convert_figurec                 C   sZ   |  dg ¡D ]D}|jdv r| j|jv r| j|jvr|  | j|j| j ¡|j| j< q||fS )zK
        Apply a transformation on each cell,

        See base.py
        Úoutputs>   Zdisplay_dataZexecute_result)ÚgetÚoutput_typeÚfrom_formatr   Ú	to_formatr   )r
   ÚcellÚ	resourcesZ
cell_indexÚoutputr   r   r   Úpreprocess_cell!   s    ÿ
þ
ýÿz*ConvertFiguresPreprocessor.preprocess_cell)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Útagr   r   r	   r   r   Ú__classcell__r   r   r   r   r      s   r   N)r   Z	traitletsr   Úbaser   r   r   r   r   r   Ú<module>   s   	