B
    [o                 @   s<   d Z ddlmZ ddlZddlmZmZ G dd deZdS )zNotebookExporter class   )Exporter    N)Enumdefaultc                   sX   e Zd ZdZeeejejddj	ddZ
eddd Zd	Zd
Zd fdd	Z  ZS )NotebookExporterzExports to an IPython notebook.

    This is useful when you want to use nbconvert's preprocessors to operate on
    a notebook (e.g. to execute it) and then write it back to a notebook file.
    zPThe nbformat version to write.
        Use this to downgrade notebooks.
        )Zdefault_valuehelpT)ZconfigZfile_extensionc             C   s   dS )Nz.ipynb )selfr   r   ;lib/python3.7/site-packages/nbconvert/exporters/notebook.py_file_extension_default   s    z(NotebookExporter._file_extension_defaultzapplication/jsonZnotebookNc                sh   t t| j||f|\}}| j|jkr6d| j |d< nd|d< tj|| jd}|ds`|d }||fS )Nz.v%iZoutput_suffixz
.nbconvert)version
)superr   from_notebook_nodenbformat_versionnbformatZwritesendswith)r	   ZnbZ	resourceskwZnb_copyoutput)	__class__r   r
   r      s    
z#NotebookExporter.from_notebook_node)N)__name__
__module____qualname____doc__r   listr   ZversionsZcurrent_nbformattagr   r   r   Zoutput_mimetypeZexport_from_notebookr   __classcell__r   r   )r   r
   r   
   s   
r   )r   Zexporterr   r   Z	traitletsr   r   r   r   r   r   r
   <module>   s   