
    Eh                        % S r SSKJr  SSKJr  SSKJr   " S S\5      r " S S\	\5      r
 " S	 S
\5      r " S S\5      r " S S\5      rSrS\S'   SrS\S'   SrS\S'   g)zExceptions for nbclient.    )annotations)Any)NotebookNodec                      \ rS rSrSrSrg)CellControlSignal	   z
A custom exception used to indicate that the exception is used for cell
control actions (not the best model, but it's needed to cover existing
behavior without major refactors).
 N__name__
__module____qualname____firstlineno____doc____static_attributes__r	       fC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\nbclient/exceptions.pyr   r   	   s     	r   r   c                  <    \ rS rSrSr\        SS j5       rSrg)CellTimeoutError   zK
A custom exception to capture when a cell has timed out during execution.
c                   U(       ac  UR                   (       aR  UR                   R                  5       R                  S5      n[        U5      S:  a  UR                   OUSS  SUSS  3nOSnU " [        R                  X!US95      $ )	z)Create an error from a timeout on a cell.
   N   z
...
zCell contents not found.)timeoutmsgcell_contents)sourcestripsplitlentimeout_err_msgformat)clsr   r   cellsrc_by_linessrcs         r   error_from_timeout_and_cell,CellTimeoutError.error_from_timeout_and_cell   s    
 DKK;;,,.44T:L |$r) $Ra()bc1B0CD  -C?))'RU)VWWr   r	   N)r   strr   intr%   r   returnr   )r   r   r   r   r   classmethodr(   r   r	   r   r   r   r      sA     XX #X+7X	X Xr   r   c                      \ rS rSrSrSrg)DeadKernelError)   zA dead kernel error.r	   Nr
   r	   r   r   r/   r/   )   s    r   r/   c                      \ rS rSrSrSrg)CellExecutionComplete/   z
Used as a control signal for cell execution across execute_cell and
process_message function calls. Raised when all execution requests
are completed and no further messages are expected from the kernel
over zeromq channels.
r	   Nr
   r	   r   r   r2   r2   /   s     	r   r2   c                  X   ^  \ rS rSrSrSU 4S jjrS	S jrS
S jr\SS j5       r	Sr
U =r$ )CellExecutionError:   z
Custom exception to propagate exceptions that are raised during
notebook execution to the caller. This is mostly useful when
using nbconvert as a library, since it allows to deal with
failures gracefully.
c                H   > [         TU ]  U5        Xl        X l        X0l        g)zInitialize the error.N)super__init__	tracebackenameevalue)selfr:   r;   r<   	__class__s       r   r9   CellExecutionError.__init__B   s    #"
r   c                ^    [        U 5      U R                  U R                  U R                  44$ )zReduce implementation.)typer:   r;   r<   r=   s    r   
__reduce__CellExecutionError.__reduce__I   s$    DzDNNDJJDDDr   c                r    U R                   (       a  U R                   $ U R                   SU R                   3$ )z	Str repr.z: )r:   r;   r<   rB   s    r   __str__CellExecutionError.__str__M   s,    >>>>!jj\DKK=11r   c                   / nUR                    HE  nUS   S:X  d  M  UR                  [        R                  US   US   R	                  5       S95        MG     U(       a#  UR                  SS5        UR                  S5        S	R                  U5      nS	R                  UR                  S
/ 5      =(       d    / 5      nU " [        R                  UUUS9UR                  SS5      UR                  SS5      S9$ )zfInstantiate from a code cell object and a message contents
(message is either execute_reply or error)
output_typestreamnametext)rK   rL   r    z------------------r   r:   )r%   stream_outputr:   r;   z<Error>r<   )r;   r<   )	outputsappendstream_output_msgr#   rstripinsertjoingetexec_err_msg)r$   r%   r   stream_outputsoutputrN   tbs          r   from_cell_and_msg$CellExecutionError.from_cell_and_msgT   s     %'llFm$0%%%,,&.vf~G\G\G^,_ #
  !!!R(!!"67!YY~6YYsww{B/526+   
 '''9-778R(
 	
r   )r;   r<   r:   )r:   r*   r;   r*   r<   r*   r,   None)r,   z
tuple[Any])r,   r*   )r%   r   r   zdict[str, Any]r,   r5   )r   r   r   r   r   r9   rC   rF   r-   rZ   r   __classcell__)r>   s   @r   r5   r5   :   s,    E2 
 
r   r5   z----- {name} -----
{text}r*   rQ   zAn error occurred while executing the following cell:
------------------
{cell.source}
------------------
{stream_output}

{traceback}
rV   zA cell timed out while it was being executed, after {timeout} seconds.
The message was: {msg}.
Here is a preview of the cell contents:
-------------------
{cell_contents}
-------------------
r"   N)r   
__future__r   typingr   nbformatr   	Exceptionr   TimeoutErrorr   RuntimeErrorr/   r2   r5   rQ   __annotations__rV   r"   r	   r   r   <module>re      s     "  !		 	X|%6 X,	l 		- 	7
* 7
t
 3 
c  r   