
    Ud                     .    d Z ddlmZmZmZmZ ddZd Zy)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                    |dk(  rt               }t               }| j                  D ]  }|j                  dk(  r,t	        |j                  d      |j                  d            }n+|j                  dk(  rt        d|j                  d            }|j                  j                          |j                  j                  |       |S t        d|z        )	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newcells         5/usr/lib/python3/dist-packages/nbformat/v2/convert.pyupgrader      s     q_HH 	%D~~''((6*$((?:S 6)'
488F;KLHHOOG$	% 	#ClRSS    c                     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   msgs     r   	downgrader    6   s     ?C
C.r   N)r   )__doc__nbbaser   r   r   r   r   r     r   r   <module>r$      s   & N MT6	r   