o
    i                     @   s2   d 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
   )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   cells	cell_typer   getr   append
worksheets
ValueError)nbfrom_versionnewnbwscellnewcell r   N/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/nbformat/v2/convert.pyupgrade   s   



r   c                 C   s   t d)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   r   r   r   	downgrade6   s   r   N)r   )__doc__nbbaser   r   r   r   r   r   r   r   r   r   <module>   s    
