
    Mh                        d Z ddlmZ ddlmZ  G d de          Zd Z	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	 	 	 	 	 ddZddZ	ddZ
ddZ	 	 	 	 	 	 ddZddZdS )a  The basic dict based notebook format.

The Python representation of a notebook is a nested structure of
dictionary subclasses that support attribute access.
The functions in this module are merely
helpers to build the structs in the right form.

Authors:

* Brian Granger
    )annotations)Structc                      e Zd ZdZdS )NotebookNodezA notebook node object.N)__name__
__module____qualname____doc__     R/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/nbformat/v2/nbbase.pyr   r       s        !!!!r   r   c                    t          | t                    r<t                      }|                                 D ]\  }}t	          |          ||<   |S t          | t
          t          f          rd | D             S | S )z%Create notebook node(s) from a value.c                ,    g | ]}t          |          S r   )	from_dict).0is     r   
<listcomp>zfrom_dict.<locals>.<listcomp>,   s    (((	!(((r   )
isinstancedictr   itemsr   tuplelist)dnewdkvs       r   r   r   $   s}    !T ~~GGII 	# 	#DAqllDGG!eT]## )((a((((Hr   Nc                   t                      }| t          |           |_        | dk    r|t          |          |_        |t	          |          |_        |t	          |          |_        |t          |          |_        |t          |          |_        |t          |          |_	        |t          |          |_
        |t          |          |_        | dk    r|	t          |	          |_        | dk    rL|
t          |
          |_        |t          |          |_        |d t!          |          D             |_        |S ),Create a new code cell with input and outputNpyerrpyoutc                ,    g | ]}t          |          S r   )str)r   frames     r   r   znew_output.<locals>.<listcomp>_   s    HHHuE

HHHr   )r   r"   output_typetextbytespngjpeghtmlsvglatexjson
javascriptintprompt_numberetypeevaluer   	traceback)r$   output_text
output_pngoutput_html
output_svgoutput_latexoutput_jsonoutput_javascriptoutput_jpegr/   r0   r1   r2   outputs                 r   
new_outputr<   0   sN     ^^F --g"k**FK!z**FJ",,FK"k**FK!ZFJ#|,,FL"k**FK( #$5 6 6Fg-";"=11gu::FLKKFM HHYHHHFMr   pythonFc                   t                      }d|_        |t          |          |_        | t          |           |_        |t          |          |_        |g |_        n||_        |t          |          |_	        |S )r   code)
r   	cell_typer"   languageinputr.   r/   outputsbool	collapsed)rB   r/   rC   rA   rE   cells         r   new_code_cellrG   d   s}     >>DDNHZZ
  //iKr   c                    t                      }|t          |          |_        |t          |          |_        | |_        |S )zCreate a new text cell.)r   r"   sourcerenderedr@   )r@   rI   rJ   rF   s       r   new_text_cellrK   ~   s=    >>D&kkHDNKr   c                    t                      }| t          |           |_        |g |_        nt	          |          |_        |S )z5Create a worksheet by name with with a list of cells.)r   r"   namecellsr   )rM   rN   wss      r   new_worksheetrP      s>    	Bd))};;Ir   c                    t                      }d|_        |g |_        nt          |          |_        | t	                      |_        nt          |           |_        |S )z7Create a notebook by name, id and a list of worksheets.   )r   nbformat
worksheetsr   new_metadatametadata)rV   rT   nbs      r   new_notebookrX      sW    	BBKZ(("nn"8,,Ir   c                *   t                      }| t          |           |_        |t          |          |_        |t          |          |_        |t          |          |_        |t          |          |_        |t          |          |_        |S )zCreate a new metadata node.)	r   r"   rM   r   authorscreatedmodifiedlicensegistid)rM   rZ   r]   r[   r\   r^   rV   s          r   rU   rU      s     ~~HD		==w<<MMw<<f++Or   c                    t                      }| t          |           |_        |t          |          |_        |t          |          |_        |t          |          |_        |S )zCreate a new author.)r   r"   rM   emailaffiliationurl)rM   r`   ra   rb   authors        r   
new_authorrd      s^    ^^F$ii5zz --
XX
Mr   )NNNNNNNNNNNNN)NNNr=   F)NN)NNNNNN)NNNN)r
   
__future__r   nbformat._structr   r   r   r<   rG   rK   rP   rX   rU   rd   r   r   r   <module>rg      sS  
 
, # " " " " " # # # # # #" " " " "6 " " "	 	 	 
1 1 1 1j    4   	 	 	 	     
   2     r   