B
    £'=[‘  ã               @   sf   d Z ddlZddlZddlmZ ddlmZ G dd„ deƒZdd„ Zdd	d
„Z	ddd„Z
ddd„ZdS )zAThe basic dict based notebook format.

Authors:

* Brian Granger
é    N)ÚStruct)Úunicode_typec               @   s   e Zd ZdS )ÚNotebookNodeN)Ú__name__Ú
__module__Ú__qualname__© r   r   ú1lib/python3.7/site-packages/nbformat/v1/nbbase.pyr      s   r   c             C   sZ   t | tƒr6tƒ }x |  ¡ D ]\}}t|ƒ||< qW |S t | ttfƒrRdd„ | D ƒS | S d S )Nc             S   s   g | ]}t |ƒ‘qS r   )Ú	from_dict)Ú.0Úir   r   r	   ú
<listcomp>(   s    zfrom_dict.<locals>.<listcomp>)Ú
isinstanceÚdictr   Úitemsr
   ÚtupleÚlist)ÚdZnewdÚkÚvr   r   r	   r
   !   s    
r
   c             C   s4   t ƒ }d|_| dk	rt| ƒ|_|dk	r0t|ƒ|_|S )z,Create a new code cell with input and outputÚcodeN)r   Ú	cell_typer   r   ÚintÚprompt_number)r   r   Úcellr   r   r	   Únew_code_cell-   s    

r   c             C   s"   t ƒ }| dk	rt| ƒ|_d|_|S )zCreate a new text cell.NÚtext)r   r   r   r   )r   r   r   r   r	   Únew_text_cell8   s
    
r   c             C   s    t ƒ }| dk	r| |_ng |_|S )z7Create a notebook by name, id and a list of worksheets.N)r   Úcells)r   Znbr   r   r	   Únew_notebookA   s
    r   )NN)N)N)Ú__doc__ZpprintZuuidZipython_genutils.ipstructr   Zipython_genutils.py3compatr   r   r
   r   r   r   r   r   r   r	   Ú<module>   s   

	