U
    kuf®	  ã                   @  s  d Z ddlmZ ddddddd	d
dddddddddddddddddgZddlZddlmZmZ ddlm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZ dd lmZ dd lmZ dd!lmZ dd"lmZ dd"lmZ dd lmZ dd lmZ  dd!lmZ! dd"lmZ" dd"lmZ# d#d„ Z$dS )$z)The main API for the v3 notebook format.
é    )ÚannotationsÚNotebookNodeÚnew_code_cellÚnew_text_cellÚnew_notebookÚ
new_outputÚnew_worksheetÚnew_metadataÚ
new_authorÚnew_heading_cellÚnbformatÚnbformat_minorÚnbformat_schemaÚ
reads_jsonÚwrites_jsonÚ	read_jsonÚ
write_jsonÚto_notebook_jsonÚreads_pyÚ	writes_pyÚread_pyÚwrite_pyÚto_notebook_pyÚ	downgradeÚupgradeÚparse_filenameNé   )r   r   )r   r   r   r   r
   r   r   r	   r   r   r   r   )Úreads)Úto_notebook)Úwritesc                 C  sF   t j | ¡\}}|dkrd}n|dkr,d}n| }| d } d}| ||fS )a÷  Parse a notebook filename.

    This function takes a notebook filename and returns the notebook
    format (json/py) and the notebook name. This logic can be
    summarized as follows:

    * notebook.ipynb -> (notebook.ipynb, notebook, json)
    * notebook.json  -> (notebook.json, notebook, json)
    * notebook.py    -> (notebook.py, notebook, py)
    * notebook       -> (notebook.ipynb, notebook, json)

    Parameters
    ----------
    fname : unicode
        The notebook filename. The filename can use a specific filename
        extension (.ipynb, .json, .py) or none, in which case .ipynb will
        be assumed.

    Returns
    -------
    (fname, name, format) : (unicode, unicode, unicode)
        The filename, notebook name and format.
    )ú.ipynbz.jsonÚjsonz.pyÚpyr    )ÚosÚpathÚsplitext)ÚfnameÚbasenameÚextZformat_© r)   ú8/tmp/pip-unpacked-wheel-zj9qk9v2/nbformat/v3/__init__.pyr   A   s    )%Ú__doc__Ú
__future__r   Ú__all__r#   Úconvertr   r   Znbbaser   r   r   r   r
   r   r   r	   r   r   r   r   Znbjsonr   r   r   r   r   r   r   r   Znbpyr   r   r   r   r   r   r)   r)   r)   r*   Ú<module>   sR   ç8