
    e                     r    d Z ddlmZ ddlmZ dZdZdddd	d
dddZddZ	ddZ
d ZddZddZddZd ZdS )zPython API for composing notebook elements

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.
    )generate_corpus_id)NotebookNode      znbformat.v4.schema.jsonznbformat.v4.0.schema.jsonznbformat.v4.1.schema.jsonznbformat.v4.2.schema.jsonznbformat.v4.3.schema.jsonznbformat.v4.4.schema.jsonznbformat.v4.5.schema.json))NN)r   r   )r      )r      )r      )r   r   )r   r   Nc                 4    ddl m}  || |t                     S )zvalidate a v4 noder   )validate)refversion)nbformatr   )noder   validate_origs      2lib/python3.11/site-packages/nbformat/v4/nbbase.pyr   r   $   s+    222222=39999    c                    t          |           }| dk    rd|_        d|_        n|| dk    r't                      |_        t                      |_        nO| dk    r.t                      |_        t                      |_        d|_        n| dk    rd	|_        d|_        g |_        |	                    |           |||_        t          ||            |S )
zGCreate a new output, to go in the ``cell.outputs`` list of a code cell.)output_typestreamstdout display_dataexecute_resultNerrorNotImplementedError)r   nametextmetadatadataexecution_countenameevalue	tracebackupdater   )r   r   kwargsoutputs       r   
new_outputr'   +   s    k222F h		&	&&.."nn	(	(	(&.."nn!%			, MM&V[!!!Mr   c                    | d         d         }| d         }|dk    r%t          ||d         |d         |d                   S |d	k    rt          ||d
         |d                   S |dk    rt          ||d         |d                   S |dk    r%t          ||d         |d         |d                   S t          d|z            )zCreate a NotebookNode for an output from a kernel's IOPub message.

    Returns
    -------
    NotebookNode: the output as a notebook node.

    Raises
    ------
    ValueError: if the message is not an output message.

    headermsg_typecontentr   r   r   r    )r   r   r   r    r   r   r   )r   r   r   r   )r   r   r   r   r!   r"   r#   )r   r!   r"   r#   z Unrecognized output msg type: %r)r'   
ValueError)msgr*   r+   s      r   output_from_msgr.   H   s    8}Z(H)nG### Z(#$56	
 
 
 	
 
X		 
 
 
 	

 
^	#	# Z(
 
 
 	

 
W		 '"8$k*	
 
 
 	
 ;hFGGGr   r   c                     t          t                      dt                      d| g           }|                    |           t          |d           |S )zCreate a new code cellcodeN)id	cell_typer   r    sourceoutputs	code_cellr   random_cell_idr$   r   r3   r%   cells      r   new_code_cellr:   u   s[      D 	KKT;Kr   c                     t          t                      d| t                                }|                    |           t          |d           |S )zCreate a new markdown cellmarkdownr1   r2   r3   r   markdown_cellr6   r8   s      r   new_markdown_cellr?      sU    	  D 	KKT?###Kr   c                     t          t                      d| t                                }|                    |           t          |d           |S )zCreate a new raw cellrawr=   raw_cellr6   r8   s      r   new_raw_cellrC      sU    	  D 	KKT:Kr   c                      t          t          t          t                      g           }|                    |            t	          |           |S )zCreate a new notebook)r   nbformat_minorr   cells)r   r   rE   r$   r   )r%   nbs     r   new_notebookrH      sJ    	%	
 
 
B IIfRLLLIr   )N)r   )__doc__nbformat.corpus.wordsr   r7   nbformat.notebooknoder   r   rE   nbformat_schemar   r'   r.   r:   r?   rC   rH    r   r   <module>rN      s     G F F F F F . . . . . .   ,'''''' : : : :   :*H *H *HZ          
 
 
 
 
r   