
    Mh}                    
   U d Z ddlmZ ddlZddlZddlZddlm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dZded<   dddiidfdddiidfdZded<    G d de          Zej        ZdS )znbclient cli.    )annotationsN)Path)dedent)
JupyterApp)BoolIntegerListUnicodedefault)catch_config_error)__version__   )NotebookClientzNbClientApp.timeoutzNbClientApp.startup_timeoutzNbClientApp.kernel_namezNbClientApp.output_base)timeoutstartup_timeoutkernel_nameoutputzdict[str, str]nbclient_aliasesNbClientAppallow_errorsTzLErrors are ignored and execution is continued until the end of the notebook.inplacez/Overwrite input notebook with executed results.)zallow-errorsr   zdict[str, typing.Any]nbclient_flagsc                  8    e Zd ZdZ ee          ZdZeZ	e
ZdZ e e            d                              d          Z edd ed	          
                              d          Z ed ed                                        d          Z ed ed                                        d          Z ed ed                                        d          Z ed ed                                        d          Z ed ed                                        d          Z edd ed          
                              d          Z ed          d"d            Zed#d$ fd            Zd%dZd&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   <   z
            The time to wait (in seconds) for the kernel to start.
            If kernel startup takes longer, a RuntimeError is
            raised.
            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.
            zskip-executionz^
            Name of the cell tag to use to denote a cell that should be skipped.
             z
            Name of kernel to use to execute the cells.
            If not set, use the kernel_spec embedded in the notebook.
            z
            Default is execute notebook without writing the newly executed notebook.
            If this flag is provided, the newly generated notebook will
            overwrite the input notebook.
            a8  
            Write executed notebook to this file base name.
            Supports pattern replacements ``'{notebook_name}'``,
            the name of the input notebook file without extension.
            Note that output is always relative to the parent directory of the
            input notebook.
            	log_levelreturnintc                    t           j        S N)loggingINFO)selfs    L/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/nbclient/cli.py_log_level_defaultzNbClientApp._log_level_default   s
    |    argvlist[str] | NoneNonec                b   t                                          |           |                                 | _        | j        st	          j        d           t          | j                  dk    r!| j        d| j        vrd}t          |          | j        D ]}| 	                    |           dS )zInitialize the app.r   Nz{notebook_name}zgIf passing multiple notebooks with `--output=output` option, output string must contain {notebook_name})
super
initializeget_notebooks	notebookssysexitlenoutput_base
ValueErrorrun_notebook)r&   r*   msgpath	__class__s       r'   r0   zNbClientApp.initialize   s     	4    ++-- ~ 	HRLLL t~""t'7'C (888A  !oo% N 	$ 	$Dd####	$ 	$r)   	list[str]c                2    | j         r| j         }n| j        }|S )zGet the notebooks for the app.)
extra_argsr2   )r&   r2   s     r'   r1   zNbClientApp.get_notebooks   s(     ? 	'II I r)   notebook_pathstrc                   | j                             d|            t          |                              d          }|j                                        }| j        r|}nh| j        r_|j                            | j        	                    |                    d          j
                                                d          }nd}|r3|j                                        sd|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          }|                                 |r4| j                             d|            t          j        ||           dS dS )zRun a notebook by path.z
Executing z.ipynbr   )notebook_nameNzCannot write to directory=z that does not exist   )
as_versionmetadatar:   )r   r   skip_cells_with_tagr   r   	resourceszSave executed results to )loginfor   with_suffixparentabsoluter   r6   joinpathformatnameis_dirr7   opennbformatreadr   r   r   rF   r   r   executewrite)	r&   r?   
input_pathr:   output_pathr9   fnbclients	            r'   r8   zNbClientApp.run_notebook   s    	2=22333-((44X>>
  ))++ < 	$KK 	$+44 ''j6L6LR6P6P6U'VV k(## K K 	"{188:: 	"W{/AWWWCS//! __ 	0!qQ///B	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0  L 0 $ 8*(!FD>2
 
 
 	  	,HMMCkCCDDDN2{+++++	, 	,s   D77D;>D;)r    r!   r#   )r*   r+   r    r,   )r    r<   )r?   r@   r    r,   )!__name__
__module____qualname____doc__r
   r   versionrO   r   aliasesr   flagsdescriptionr	   tagr2   r   r   r   r   r   r   rF   r   r   r6   r   r(   r   r0   r1   r8   __classcell__)r;   s   @r'   r   r   0   s         gk""GDGEKKWWYY%CDDDHHPTHUUIgV
 

 
 
 
cc  g
V
 
	 	 	 
cc  4V
 
   
cc  "'V
 
   
cc  '
V
 
   
cc  dV
 
	 	 	 
cc  'V
 
   
cc  W[    $ $ $ $ $ $ $0
 
 
 
-, -, -, -, -, -, -, -,r)   )r^   
__future__r   r$   r3   typingpathlibr   textwrapr   rR   jupyter_core.applicationr   	traitletsr   r   r	   r
   r   traitlets.configr   nbclientr   rZ   r   r   __annotations__r   r   launch_instancemain r)   r'   <module>rq      s      " " " " " "  



               / / / / / / ; ; ; ; ; ; ; ; ; ; ; ; ; ; / / / / / /             " " " " " "
 %4,'	$ $      	

 	W 4	

 	:) )    (l, l, l, l, l,* l, l, l,^ "r)   