o
    tf                     @  s>   d Z ddlmZ ddlmZmZmZmZ d
ddZdd Z	d	S )zhCode for converting notebooks to and from the v2 format.

Authors:

* Brian Granger
* Jonathan Frederic
    )annotations   )new_code_cellnew_notebooknew_text_cellnew_worksheetc                 C  s   |dkr>t  }t }| jD ](}|jdkr!t|d|dd}n|jdkr/td|dd}|j| q|j| |S t	d| )	zConvert a notebook to the v2 format.

    Parameters
    ----------
    nb : NotebookNode
        The Python representation of the notebook to convert.
    from_version : int
        The version of the notebook to convert from.
    r   codeprompt_number)inputr	   textmarkdown)sourcez(Cannot convert a notebook from v%s to v2)
r   r   cellsZ	cell_typer   getr   appendZ
worksheets
ValueError)nbZfrom_versionZnewnbwscellZnewcell r   \/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/nbformat/v2/convert.pyupgrade   s   



r   c                 C  s   d}t |)zConvert a v2 notebook to v1.

    Parameters
    ----------
    nb : NotebookNode
        The Python representation of the notebook to convert.
    z2Downgrade from notebook v2 to v1 is not supported.)	Exception)r   msgr   r   r   	downgrade7   s   r   N)r   )
__doc__
__future__r   Znbbaser   r   r   r   r   r   r   r   r   r   <module>   s
    
