
    Yd                         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j4                  Zy)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      j                  d      Z edd ed	      
      j                  d      Zeed<    ed ed            j                  d      Zeed<    ed ed            j                  d      Zeed<    ed ed            j                  d      Zeed<    ed ed            j                  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    ./usr/lib/python3/dist-packages/nbclient/cli.py_log_level_defaultzNbClientApp._log_level_defaulta   s    ||    c                     t         |   |       | j                         | _        | j                  st	        j
                  d       | j                  D cg c]  }| j                  |       c} yc c}w )zInitialize the app.N)super
initializeget_notebooks	notebookssysexitrun_notebook)r!   argvpath	__class__s      r"   r(   zNbClientApp.initializee   sZ     	4  ++- ~~HHRL .2^^<T		4	 <<s   A1c                 R    | j                   r| j                   }|S | j                  }|S )zGet the notebooks for the app.)
extra_argsr*   )r!   r*   s     r"   r)   zNbClientApp.get_notebookst   s/     ??I  I r$   c                    | j                   j                  d|        |j                  dd      }t        j                  |      j
                  j                         }| d}t        |      5 }t        j                  |d      }ddd       t        | j                  | j                  | j                  | j                  | j                  dd|ii	      }|j!                          y# 1 sw Y   bxY w)
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   s     	
=/23$$Xr2 ||M*11::< vV_
 * 	0qQ/B	0  LL 00 $ 8 8**((!FD>2
 		0 	0s   .C''C0r   )#__name__
__module____qualname____doc__r   r   versionrD   r   aliasesr   flagsdescriptionr   tagr*   r   r   r   int__annotations__r   r   r   boolr   strr   r	   r#   r
   r(   r)   r-   __classcell__)r0   s   @r"   r   r   "   s    k"GDGEKKR<=AAANI

 
cc S 
 #

	 
cc S 	 
 
cc $   '
  
cc   

 
cc   [  = =
r$   )rL   r   r;   r+   textwrapr   r@   jupyter_core.applicationr   	traitletsr   r   r   r   r	   traitlets.configr
   nbclientr   rH   r   r   dictrS   r   r   launch_instancemain r$   r"   <module>r`      s       
   / ; ; /   " %4, $  	

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