
    f                        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y)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y)NotebookNodezA notebook node object.N)__name__
__module____qualname____doc__     M/var/www/cvtools/html/venv/lib/python3.12/site-packages/nbformat/v2/nbbase.pyr   r       s    !r   r   c                    t        | t              r2t               }| j                         D ]  \  }}t	        |      ||<    |S t        | t
        t        f      r| D cg c]  }t	        |       c}S | S c c}w )z%Create notebook node(s) from a value.)
isinstancedictr   items	from_dicttuplelist)dnewdkvis        r   r   r   $   sk    !T~GGI 	#DAqlDG	#!eT]#&'(	!((H )s   A4Nc                D   t               }| t        |       |_        | dk7  r|t        |      |_        |t	        |      |_        |t	        |      |_        |t        |      |_        |t        |      |_        |t        |      |_	        |t        |      |_
        |t        |      |_        | dk(  r|	t        |	      |_        | dk(  rM|
t        |
      |_        |t        |      |_        |'t!        |      D cg c]  }t        |       c}|_        |S c c}w ),Create a new code cell with input and outputpyerrpyout)r   str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*   r+   r,   r-   outputframes                  r   
new_outputr8   0   s'     ^F -g"k*FK!z*FJ",FK"k*FK!ZFJ#|,FL"k*FK( #$5 6Fg-";"=1gu:FLKFM 8<YHuE
HFM  Is   Dc                    t               }d|_        |t        |      |_        | t        |       |_        |t        |      |_        |g |_        n||_        |t        |      |_	        |S )r   code)
r   	cell_typer   languageinputr)   r*   outputsbool	collapsed)r=   r*   r>   r<   r@   cells         r   new_code_cellrB   d   sp     >DDNHZ
  /iKr   c                p    t               }|t        |      |_        |t        |      |_        | |_        |S )zCreate a new text cell.)r   r   sourcerenderedr;   )r;   rD   rE   rA   s       r   new_text_cellrF   ~   s7    >D&kHDNKr   c                t    t               }| t        |       |_        |	g |_        |S t	        |      |_        |S )z5Create a worksheet by name with with a list of cells.)r   r   namecellsr   )rH   rI   wss      r   new_worksheetrK      s?    	Bd)} I ;Ir   c                    t               }d|_        |g |_        nt        |      |_        | t	               |_        |S t        |       |_        |S )z7Create a notebook by name, id and a list of worksheets.   )r   nbformat
worksheetsr   new_metadatametadata)rQ   rO   nbs      r   new_notebookrS      sR    	BBKZ("n I #8,Ir   c                    t               }| t        |       |_        |t        |      |_        |t        |      |_        |t        |      |_        |t        |      |_        |t        |      |_        |S )zCreate a new metadata node.)	r   r   rH   r   authorscreatedmodifiedlicensegistid)rH   rU   rX   rV   rW   rY   rQ   s          r   rP   rP      sz     ~HD	=w<Mw<f+Or   c                    t               }| t        |       |_        |t        |      |_        |t        |      |_        |t        |      |_        |S )zCreate a new author.)r   r   rH   emailaffiliationurl)rH   r[   r\   r]   authors        r   
new_authorr_      sS    ^F$i5z -
X
Mr   )NNNNNNNNNNNNN)NNNpythonF)NN)NNNNNN)NNNN)r
   
__future__r   nbformat._structr   r   r   r8   rB   rF   rK   rS   rP   r_   r   r   r   <module>rc      s   
, # #"6 "	 
1j 4	  
2r   