o
    ¹iž
  ã                   @   sô   d 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 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lmZ ddlmZ ddlmZ  d	Z!dZ"d
d„ Z#dS )zDThe main API for the v2 notebook format.

Authors:

* Brian Granger
é    Né   )Ú	downgradeÚupgrade)ÚNotebookNodeÚ
new_authorÚnew_code_cellÚnew_metadataÚnew_notebookÚ
new_outputÚnew_text_cellÚnew_worksheet)Úreads)Úto_notebook)Úwritesé   c                 C   sT   t j | ¡\}}|dkrd}n|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
        extention (.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.
    z.ipynbÚjsonz.jsonz.pyÚpy)ÚosÚpathÚsplitext)ÚfnameÚbasenameÚextÚformat© r   úO/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/nbformat/v2/__init__.pyÚparse_filename8   s   
r   )$Ú__doc__r   Úconvertr   r   Únbbaser   r   r   r   r	   r
   r   r   Únbjsonr   Ú	read_jsonÚ
reads_jsonr   Úto_notebook_jsonr   Ú
write_jsonÚwrites_jsonÚnbpyÚread_pyÚreads_pyÚto_notebook_pyÚwrite_pyÚ	writes_pyÚnbxmlÚread_xmlÚ	reads_xmlÚto_notebook_xmlÚnbformatÚnbformat_minorr   r   r   r   r   Ú<module>   s(    (
