
     Ce                         U d Z ddlZddlZddlZddlmZ ddlZddlmZ ddl	m
Z
mZmZmZmZ ddlmZ ddlmZ dd	lmZ d
dddZeed<   ddddiidfiZeed<    G d de          Zej        ZdS )znbclient cli.    N)dedent)
JupyterApp)BoolIntegerListUnicodedefault)catch_config_error)__version__   )NotebookClientzNbClientApp.timeoutzNbClientApp.startup_timeoutzNbClientApp.kernel_name)timeoutstartup_timeoutkernel_namenbclient_aliaseszallow-errorsNbClientAppallow_errorsTzLErrors are ignored and execution is continued until the end of the notebook.nbclient_flagsc                       e Zd ZU dZ ee          ZdZeZ	e
ZdZ eg d                              d          Z edd ed	          
                              d          Zeed<    ed ed                                        d          Zeed<    ed ed                                        d          Zeed<    ed ed                                        d          Zeed<    ed ed                                        d          Zeed<    ed          d             Zed fd	            Zd Z d Z! xZ"S )r   zE
    An application used to execute notebook files (``*.ipynb``)
    zjupyter-executez7An application used to execute notebook files (*.ipynb)zPath of notebooks to convert)helpT)configNz
            The time to wait (in seconds) for output from executions.
            If a cell execution takes longer, a TimeoutError is raised.
            ``-1`` will disable the timeout.
            )
allow_noner   r   <   z
            The time to wait (in seconds) for the kernel to start.
            If kernel startup takes longer, a RuntimeError is
            raised.
            r   FaB  
            When a cell raises an error the default behavior is that
            execution is stopped and a :py:class:`nbclient.exceptions.CellExecutionError`
            is raised.
            If this flag is provided, errors are ignored and execution
            is continued until the end of the notebook.
            r   zskip-executionz^
            Name of the cell tag to use to denote a cell that should be skipped.
            skip_cells_with_tag z
            Name of kernel to use to execute the cells.
            If not set, use the kernel_spec embedded in the notebook.
            r   	log_levelc                     t           j        S N)loggingINFO)selfs    ,lib/python3.11/site-packages/nbclient/cli.py_log_level_defaultzNbClientApp._log_level_defaulta   s
    |    c                      t                                          |                                             _         j        st	          j        d            fd j        D              dS )zInitialize the app.c                 :    g | ]}                     |          S  )run_notebook).0pathr!   s     r"   
<listcomp>z*NbClientApp.initialize.<locals>.<listcomp>r   s'    <<<T		4	 	 <<<r$   N)super
initializeget_notebooks	notebookssysexit)r!   argv	__class__s   ` r"   r.   zNbClientApp.initializee   sp     	4    ++-- ~ 	HRLLL 	=<<<T^<<<<<<r$   c                 2    | j         r| j         }n| j        }|S )zGet the notebooks for the app.)
extra_argsr0   )r!   r0   s     r"   r/   zNbClientApp.get_notebookst   s(     ? 	'II I r$   c                    | j                             d|            |                    dd          }t          j        |          j                                        }| d}t          |          5 }t          j	        |d          }ddd           n# 1 swxY w Y   t          || j        | j        | j        | j        | j        dd|ii	          }|                                 dS )
zRun a notebook by path.z
Executing z.ipynbr      )
as_versionNmetadatar+   )r   r   r   r   r   	resources)loginforeplacepathlibPathparentabsoluteopennbformatreadr   r   r   r   r   r   execute)r!   notebook_pathnamer+   
input_pathfnbclients           r"   r)   zNbClientApp.run_notebook   s3    	2=22333$$Xr22 |M**1::<< ___
 * 	0qQ///B	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0  L 0 $ 8*(!FD>2
 
 
 	s   3BBBr   )#__name__
__module____qualname____doc__r   r   versionrH   r   aliasesr   flagsdescriptionr   tagr0   r   r   r   int__annotations__r   r   r   boolr   strr   r	   r#   r
   r.   r/   r)   __classcell__)r4   s   @r"   r   r   "   s          gk""GDGEKKR<===AAANNI7V
 

 
 
 
cc S 
 
 
 #7
V
 
	 	 	 
cc S 	 	 	 V
 
   
cc $     'wV
 
      
cc     w
V
 
   
cc     W[   = = = = = =
 
 
      r$   )rP   r   r?   r1   textwrapr   rD   jupyter_core.applicationr   	traitletsr   r   r   r   r	   traitlets.configr
   nbclientr   rL   r   r   dictrW   r   r   launch_instancemainr(   r$   r"   <module>rc      sZ        



        / / / / / / ; ; ; ; ; ; ; ; ; ; ; ; ; ; / / / / / /             " " " " " " %4,  $    	

 	W	 	 	 	{ { { { {* { { {| "r$   