
    Chq                    <   S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
rSSKJr  SSKJrJr  SSKJr  SSKJr  SSKrSSKJrJrJrJr  SS	KJr  SS
KJrJrJr  SSK J!r!  SSK"J#r#J$r$J%r%  SSK&J'r'  SSK(J)r)  SSK*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3  SSK4J5r5  SSK6J7r7  SSK8J9r9  SSK:J;r;J<r<  SSK=J>r>  SSK?J@r@  SSKAJBrB  SSKCJDrD  SSKEJFrFJGrG  SSKHJIrI  \J" \5      rK\KR                  SSSSSS S!S"S#.5        \J" \5      rM\MR                  S$S%S&00S'4S$S(S&00S)4S$S*S+00S,4S-S.S/00S04S1.5        \KR                  \5        \MR                  \5        \KR                  \$5        \MR                  \%5        S2rN " S3 S$\\\!5      rO\OR                  rQS4 rR\SS5:X  a  \R" 5         gg)6z%An Application for launching a kernel    )annotationsN)partial)FileIOTextIOWrapper)StreamHandler)Path)BaseIPythonApplicationbase_aliases
base_flagscatch_config_error)
ProfileDir)InteractiveShellAppshell_aliasesshell_flags)ConnectionFileMixin)Sessionsession_aliasessession_flagsjupyter_runtime_dir)ioloop)	AnyBoolDictDottedObjectNameInstanceIntegerTypeUnicodedefault)filefind)import_item)	ZMQStream   )get_connection_infowrite_connection_file)ControlThread)	Heartbeat)IOPubThread)IPythonKernel)ParentPollerUnixParentPollerWindows)ZMQInteractiveShellzIPKernelApp.ipzIPKernelApp.hb_portzIPKernelApp.shell_portzIPKernelApp.iopub_portzIPKernelApp.stdin_portzIPKernelApp.control_portzIPKernelApp.connection_filezIPKernelApp.transport)iphbshelliopubstdincontrolf	transportIPKernelApp	no_stdoutT"redirect stdout to the null device	no_stderr"redirect stderr to the null devicepylabautoz^Pre-load matplotlib and numpy for interactive use with
        the default matplotlib backend.InteractiveShell	trio_loopFzEnable Trio as main event loop.)z	no-stdoutz	no-stderrr;   z	trio-loopa#  NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049

c                  >  ^  \ rS rSr% SrSr\" \5      r\" \	5      r
\\\\/r\" SSSS9R#                  SS	9r\" 5       r\" 5       r\" \SS
9r\" 5       rS\S'   \" 5       r\" 5       r\" 5       r\" 5       r\" 5       r\" 5       r \" 5       r!\" 5       r"\" 5       r#SS0r$\%" 5       r&\'" S5      S 5       r(\)S 5       r*\+" SSS9R#                  SS	9r,\+" SSS9R#                  SS	9r-\+" SSS9R#                  SS	9r.\+" SSS9R#                  SS	9r/\0" SSSS9R#                  SS	9r1\0" SSS9R#                  SS	9r2\+" SSS9R#                  SS	9r3\4" \5" \6Rn                  Rq                  S5      =(       d    S5      S S9R#                  SS	9r9\4" \5" \6Rn                  Rq                  S!5      =(       d    S5      S"S9R#                  SS	9r:S# r;S$ r<S% r=S& r>S' r?S( r@S) rAS* rBS+ rCS, rDS- rES. rFS/ rGS0 rHS1 rIS2 rJS3 rKS4 rLS5 rMS6 rNS7 rOS8 rPS9 rQS: rRS; rS\TS?U 4S< jj5       rUS= rVS>rWU =rX$ )@r6   t   z The IPYKernel application class.zipython-kernelz ipykernel.ipkernel.IPythonKernelzipykernel.kernelbase.KernelzThe Kernel subclass to be used.

    This should allow easy reuse of the IPKernelApp entry point
    to configure and launch kernels other than IPython's own.
    )klasshelpT)config)
allow_nonezzmq.Context[t.Any] | Nonecontextinstall)z0ipykernel.kernelspec.InstallIPythonKernelSpecAppzInstall the IPython kernelconnection_dirc                    [        5       $ Nr   selfs    fC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\ipykernel/kernelapp.py_default_connection_dir#IPKernelApp._default_connection_dir   s    "$$    c                    [        U R                  5      R                  U R                  :X  aE  U R                  (       a4  [	        [        [	        U R                  5      5      U R                  -  5      $ U R                  $ rI   )r   connection_filenamerG   strrJ   s    rL   abs_connection_fileIPKernelApp.abs_connection_file   s[    $$%**d.B.BBtGZGZtC 3 3458L8LLMM###rO   Fr8   )rB   r:   zSet main event loop.z(Only send stdout/stderr to output streamzipykernel.iostream.OutStreamz*The importstring for the OutStream factory)rB   rD   z$ipykernel.displayhook.ZMQDisplayHookz,The importstring for the DisplayHook factoryz[Attempt to capture and forward low-level output, e.g. produced by Extension libraries.
    JPY_PARENT_PIDr   zkill this process if its parent dies.  On Windows, the argument
        specifies the HANDLE of the parent process, otherwise it is simply boolean.
        JPY_INTERRUPT_EVENTzYONLY USED ON WINDOWS
        Interrupt this process when the parent is signaled.
        c                .    U R                   [        l         g)zInitialize the crash handler.N)
excepthooksysrJ   s    rL   init_crash_handlerIPKernelApp.init_crash_handler   s    rO   c                L    [         R                  " XU[        R                  S9  g)zHandle an exception.fileN)	tracebackprint_exceptionrZ   
__stderr__)rK   etypeevaluetbs       rL   rY   IPKernelApp.excepthook   s     	!!%#..IrO   c                "   [         R                  S:X  aI  U R                  (       d  U R                  (       a&  [	        U R                  U R                  5      U l        ggU R                  (       a!  U R                  S:w  a  [        5       U l        ggg)zInitialize the poller.win32r$   N)rZ   platform	interruptparent_handler,   pollerr+   rJ   s    rL   init_pollerIPKernelApp.init_poller   sd    <<7"~~!3!31$..$BTBTU "4D$6$6!$; +,DK	 %<rO   c                   U R                    SU R                   3nU R                   S:X  a<  US::  a  UR                  U5      nU$ UR                  SU R                  U4-  5         U$ U R                   S:X  a  US::  ah  SnSU R                  U4-  n[	        U5      R                  5       (       a6  US-   nSU R                  U4-  n[	        U5      R                  5       (       a  M6  OSU R                  U4-  nUR                  SU-  5        U$ )	Nz://tcpr   ztcp://%s:%iipcr$   z%s-%izipc://%s)r5   r.   bind_to_random_portbindr   exists)rK   sportifacepaths        rL   _try_bind_socketIPKernelApp._try_bind_socket   s   >>"#dggY/>>U"qy,,U3  }67  ^^u$qy$''404j''))!8D"dggt_4D 4j'')) $''40FF:$%rO   c                \    [         R                  nU(       a  SOSn[        U5       H  n U R	                  X5      s  $    g ! [         a    S n N>f = f! [
        R                   aC  nUR                   [         R                  :w  a  UR                   U:w  a  e XTS-
  :X  a  e  S nAM~  S nAff = f)Nr$   d   )errnoWSAEADDRINUSEAttributeErrorrangery   zmqZMQError
EADDRINUSE)rK   ru   rv   
win_in_usemax_attemptsattemptzes          rL   _bind_socketIPKernelApp._bind_socket   s    	,,J !qc\*G,,Q55 +   	J	 << 88u///BHH
4JQ.. /	s(   A AAAB+(8B&&B+c                   U R                   n[        U R                  U R                  R                  U R
                  U R                  U R                  U R                  U R                  U R                  S9n[        U5      R                  5       (       aO  [        USS9n[        U[        5      (       d   e[        U40 UD6nX#:X  a  U R                  R!                  SU5        gU R                  R!                  SU5        [#        U40 UD6  g)z"write connection info to JSON file)r.   keyr5   
shell_port
stdin_porthb_port
iopub_portcontrol_portT)unpackz:Connection file %s with current information already existsNzWriting connection file: %s)rT   dictr.   sessionr   r5   r   r   r   r   r   r   rt   r%   
isinstancelogdebugr&   )rK   cfconnection_infoexisting_connection_infos       rL   r&   !IPKernelApp.write_connection_file  s    %%ww  nnLL**	
 8?? (;2d'K$6===="#;OOO:[]_`4b9b4O4rO   c                    U R                   nU R                  R                  SU5         [        U5      R	                  5         U R                  5         g! [
         a     Nf = f)zClean up our connection file.zCleaning up connection file: %sN)rT   r   r   r   unlinkOSErrorcleanup_ipc_files)rK   r   s     rL   cleanup_connection_file#IPKernelApp.cleanup_connection_file"  sU    %%8"=	HOO 	   		s   A 
A! A!c                f   U R                   (       d  S[        R                  " 5       -  U l          [        U R                   SU R                  /5      U l          U R                  5         g! [
         aw    U R                  R                  SU R                   5        [        U R                  5      R                  R                  SSSS9  [        R                  " U R                  5         gf = f! [          a9    U R                  R#                  SU R                   SS	9  U R%                  S
5         gf = f)zInitialize our connection file.zkernel-%s.json.zConnection file not found: %si  T)modeexist_okparentsNz"Failed to load connection file: %rexc_infor$   )rQ   osgetpidr!   rG   r   r   r   r   rT   parentmkdiratexitregisterr   load_connection_file	ExceptionerrorexitrJ   s    rL   init_connection_file IPKernelApp.init_connection_file-  s    ###3biik#AD 	#+D,@,@3H[H[B\#]D 	%%'  	HHNN:D<P<PQ))*1177UT[_7`OOD889	  	HHNN4d6J6JUY   IIaL		s%   'A) C- )A>C*)C*-A D0/D0c                   U R                   R                  S[        R                  " 5       5        U R                  b   S5       e[
        R                  " 5       =U l        n[        R                  " U R                  5        UR                  [
        R                  5      U l        SU R                  l        U R                  U R                  U R                  5      U l        U R                   R!                  SU R                  -  5        UR                  [
        R                  5      U l        SU R"                  l        U R                  U R"                  U R$                  5      U l        U R                   R!                  SU R$                  -  5        ['        [
        S5      (       a"  S=U R                  l        U R"                  l        U R+                  U5        U R-                  U5        g)	z4Create a context, a session, and the kernel sockets.zStarting the kernel at pid: %iNz$init_sockets cannot be called twice!  z shell ROUTER Channel on port: %iz stdin ROUTER Channel on port: %iROUTER_HANDOVERr$   )r   infor   r   rE   r   Contextr   r   closesocketROUTERshell_socketlingerr   r   r   stdin_socketr   hasattrrouter_handoverinit_control
init_iopubrK   rE   s     rL   init_socketsIPKernelApp.init_socketsB  sQ   6		D||#K%KK#!$.w

##NN3::6#' ++D,=,=tO9DOOKL#NN3::6#' ++D,=,=tO9DOOKL3)** UVUD-0A0A0Q'" rO   c                0   UR                  [        R                  5      U l        SU R                  l        U R                  U R                  U R                  5      U l        U R                  R                  SU R                  -  5        UR                  [        R                  5      U l
        SU R                  l        UR                  [        R                  5      U l        SU R                  l        U R                  R                  [        R                  5      (       aB  U R                  R!                  U R                  R                  [        R                  5      5        [#        [        S5      (       a  SU R                  l        ['        SS9U l        g)zInitialize the control channel.r   z"control ROUTER Channel on port: %ir   r$   T)daemonN)r   r   r   control_socketr   r   r   r   r   STREAMdebugpy_socketDEALERdebug_shell_socketr   
getsockoptLAST_ENDPOINTconnectr   r   r'   control_threadr   s     rL   r   IPKernelApp.init_control\  s   %nnSZZ8%)" --d.A.A4CTCTU;d>O>OOP%nnSZZ8%)"").."<)-&''(9(9::##++D,=,=,H,HIZIZ,[\3)** 34D/+48rO   c                   UR                  [        R                  5      U l        SU R                  l        U R                  U R                  U R                  5      U l        U R                  R                  SU R                  -  5        U R                  5         [        U R                  SS9U l        U R                  R                  5         U R                  R                  U l        g)zInitialize the iopub channel.r   ziopub PUB Channel on port: %iT)pipeN)r   r   PUBiopub_socketr   r   r   r   r   configure_tornado_loggerr)   iopub_threadstartbackground_socketr   s     rL   r   IPKernelApp.init_iopubs  s    #NN3773#' ++D,=,=tO6HI%%''(9(9E! --??rO   c                J   [         R                  " 5       n[        XR                  U R                  U R
                  45      U l        U R                  R                  U l        U R                  R                  SU R
                  -  5        U R                  R                  5         g)zstart the heart beatingz!Heartbeat REP Channel on port: %iN)r   r   r(   r5   r.   r   	heartbeatrv   r   r   r   )rK   hb_ctxs     rL   init_heartbeatIPKernelApp.init_heartbeat  si     "6NNDGGT\\+RS~~**:T\\IJrO   c                R   U R                  5         U R                  R                  S5        U R                  (       a?  U R                  R	                  S5        U R                  R
                  R                  5         U R                  (       aO  U R                  R	                  S5        U R                  R                  5         U R                  R                  5         U R                  (       an  U R                  R                  5       (       aO  U R                  R	                  S5        U R                  R                  5         U R                  R                  5         U R                  (       a5  U R                  R                  (       d  U R                  R                  5         U R                  (       a5  U R                  R                  (       d  U R                  R                  5         S HZ  nU R                  R	                  SU5        [!        XS-   S5      nU(       d  M7  UR                  (       a  MJ  UR                  5         M\     U R                  R	                  S	5        U R
                  (       a  U R
                  R                  5         U R                  R	                  S
5        g)z'Close zmq sockets in an orderly fashionzCleaning up socketszClosing heartbeat channelzClosing iopub channelzClosing control thread)r0   r3   r2   zClosing %s channel_socketNzTerminating zmq contextzTerminated zmq context)reset_ior   r   r   r   rE   termr   stopr   r   is_alivejoinr   closedr   getattr)rK   channelr   s      rL   r   IPKernelApp.close  s    	+,>>HHNN67NN""'')HHNN23""$##%4#6#6#?#?#A#AHHNN34$$&$$&t':':'A'A%%'""4+B+B+I+I##))+4GHHNN/9TY#6=Fvfmmm	 5
 	01<<LL/0rO   c                   [        U R                  5      R                  nXR                  :X  d6  [        [        U R                  5      R                  5      U R
                  :X  a  UnOU R                  nSSU-  /nU H  nU R                  R                  U5        M      U R                  (       dd  [        U R                  5      [        R                  :  a=  [        [        [        R                   S9  U H  n[        U[        R                   S9  M     [#        U R$                  U R&                  U R(                  U R*                  U R,                  S9U l        g)z(display connection info, and store portsz.To connect another client to this kernel, use:z    --existing %sr^   )r0   r1   r2   r/   r3   N)r   rQ   rR   rS   r   rG   r   r   rk   int	log_levelloggingCRITICALprint_ctrl_c_messagerZ   
__stdout__r   r   r   r   r   r   _ports)rK   basenametaillineslines        rL   log_connection_infoIPKernelApp.log_connection_info  s   ,,-22,,,4,,-4459L9LL D''D<$&
 DHHMM$  !!c$..&9G<L<L&L/7d0  //////||%%
rO   c                   U R                   (       d  U R                  (       aj  [        [        R                  S5      nU R                   (       a  U=[
        l        [
        l        U R                  (       a  U=[
        l        [
        l	        ggg)z/redirects stdout/stderr to devnull if necessarywN)
r7   r9   openr   devnullrZ   stdoutr   stderrrb   )rK   	blackholes     rL   init_blackholeIPKernelApp.init_blackhole  sS    >>T^^RZZ-I~~.77
S^~~.77
S^ 	 ,rO   c                   U R                   (       Ga  [        [        U R                   5      5      n[        R                  b  [        R                  R                  5         U R                  (       a  SO[        R                  nU R                  (       a  SO[        R                  nU R                  (       d
  [        USS9nU" U R                  U R                  SUS9[        l        [        R                  b  [        R                  R                  5         U" U R                  U R                  SUS9[        l        [        [        R                  S5      (       a  U R                  R                    H  n[#        U[$        5      (       d  M  UR&                  R(                  R+                  5       S:X  d  MD  U R                  R-                  S	5        [/        [1        [        R                  R2                  S
5      5      Ul        M     U R4                  (       aU  [        [        U R4                  5      5      nU" U R                  U R6                  5      U l        U R8                  [        l        U R;                  5         g)z.Redirect input streams and set a display hook.NF)watchfdr   )echor   _original_stdstream_copy   z9Seeing logger to stderr, rerouting to raw filedescriptor.r   )outstream_classr"   rS   rZ   r   flushquietr   rb   capture_fd_outputr   r   r   r   r   r   handlersr   r   streambufferfilenor   r   r   r  displayhook_classr   displayhookpatch_io)rK   outstream_factorye_stdoute_stderrhandlerdisplayhook_factorys         rL   init_ioIPKernelApp.init_io  s    +C0D0D,E Fzz%

  "#zzts~~H#zzts~~H))$+,=u$M!*4<<9J9JH[cdCJzz%

  "*4<<9J9JH[cdCJszz#=>>#xx00G!'=99w~~?T?T?[?[?]ab?b'bc)6" #

 C C #*	  1 !!"-c$2H2H.I"J24<<ARARSD"..COrO   c                    [         R                  [         l        [         R                  [         l        [         R
                  [         l        g)z2restore original io

restores state after init_io
N)rZ   r   r   rb   r   __displayhook__r  rJ   s    rL   r   IPKernelApp.reset_io  s'    
 ^^
^^
--rO   c                   ^^  SSK nUR                  m[        R                  S4U4S jjnX!l        [	        US5      (       a,  UR
                  m[        R                  SS4U4S jjnX1l        gg! [         a     gf = f)zAPatch important libraries that can't handle sys.stdout forwardingr   NTc                   > T" SXS.UD6$ )N)r_   all_threads r   )r_   r  kwargsfaulthandler_enables      rL   enable$IPKernelApp.patch_io.<locals>.enable  s    *XXQWXXrO   r   Fc                   > T" U 4XUS.UD6$ )N)r_   r  chainr   )signumr_   r  r&  r!  faulthandler_registers        rL   r   &IPKernelApp.patch_io.<locals>.register  s%    0%)%SY rO   )faulthandlerr#  rZ   rb   r   r   ImportError)rK   r*  r#  r   r"  r(  s       @@rL   r  IPKernelApp.patch_io  s{    	1 #/"5"5NN Y #)|Z00(4(=(=%*-..dRW 
 )1% 1  		s   A0 0
A=<A=c                j    [         R                   " [         R                  [         R                  5        g)zInitialize the signal handler.N)signalSIGINTSIG_IGNrJ   s    rL   init_signalIPKernelApp.init_signal  s    fmmV^^4rO   c                  ^ [        U R                  5      n[        U R                  U R                  R                  5      n[        U R
                  U R                  R                  5      nU R                  R                  5         U R                  R                  nU" U U R                  UUU R                  UU R                  U R                  U R                  U R                  U R                  U R                  U R                   S9mTR#                  U R$                  R'                  5        VVs0 s H  u  pVUS-   U_M     snn5        TU l        U4S jU R*                  l        gs  snnf )zCreate the Kernel object itself)r   r   control_streamdebugpy_streamr   shell_streamr   r   r   r   r   profile_diruser_ns_portc                    > T R                   $ rI   )execution_count)kernels   rL   <lambda>)IPKernelApp.init_kernel.<locals>.<lambda>>  s    v7M7MrO   N)r#   r   r   r   io_loopr   r   kernel_classinstancer   r   r   r   r   r   r7  r8  record_portsr   itemsr<  r  get_execution_count)rK   r6  r4  r5  kernel_factoryrR   rv   r<  s          @rL   init_kernelIPKernelApp.init_kernel#  s*    !2!23"4#6#68K8K8S8ST"4#6#68K8K8S8ST!!#**33LL))#66%..******((LL
 	DKKDUDUDWXDWjdTG^T1DWXY 0N,	 Ys   /E&
c                  ^ [         R                  R                  S5      (       d  S[         R                  S'   U R                  mTc   eTR                  n U4S jnUTl        [
        R                  " U 5        UTl        g! UTl        f = f)z=Enable GUI event loop integration, taking pylab into account.
MPLBACKENDz)module://matplotlib_inline.backend_inlineNc                   > [        S[        R                  S9  Tc   e[        TR                  R	                  U5      [        R                  S9  g )Nz-GUI event loop or pylab initialization failedr^   )r   rZ   r   InteractiveTBstb2text)rc   rd   stbr0   s      rL   print_tb,IPKernelApp.init_gui_pylab.<locals>.print_tbU  s=    ECJJW(((e))2237cjjIrO   )r   environgetr0   _showtracebackr   init_gui_pylab)rK   rR  rN  r0   s      @rL   rS  IPKernelApp.init_gui_pylab@  s|     zz~~l++'RBJJ|$ 

   --
	2J
 $,E ..t4#1E >E s   #B 	Bc                    [        U R                  SS5      U l        U R                  (       a&  U R                  R                  R	                  U 5        gg)zInitialize the shell channel.r0   N)r   r<  r0   configurablesappendrJ   s    rL   
init_shellIPKernelApp.init_shell_  s:    T[['48
::JJ$$++D1 rO   c                    [         R                  " S5      n[         R                  " 5       n[         R                  " [         R                  5      nUR                  U5        UR                  U5        g)a  Configure the tornado logging.Logger.

Must set up the tornado logger or else tornado will call
basicConfig for the root logger which makes the root logger
go to the real sys.stderr instead of the capture streams.
This function mimics the setup of logging.basicConfig.
tornadoN)r   	getLoggerr   	FormatterBASIC_FORMATsetFormatter
addHandler)rK   loggerr  	formatters       rL   r   $IPKernelApp.configure_tornado_loggere  sT     ""9-'')%%g&:&:;	Y''"rO   c                   [         R                  R                  S5      (       aV  [         R                  S:  aA  SSKn SSKJnJn  [        UR                  5       5      UL a  UR                  U" 5       5        gggg! [         a     gf = f)a#  set default asyncio policy to be compatible with tornado

Tornado 6 (at least) is not compatible with the default
asyncio implementation on Windows

Pick the older SelectorEventLoopPolicy on Windows
if the known-incompatible default policy is in use.

Support for Proactor via a background thread is available in tornado 6.1,
but it is still preferable to run the Selector in the main thread
instead of the background.

do this as early as possible to make it a low priority and overridable

ref: https://github.com/tornadoweb/tornado/issues/2608

FIXME: if/when tornado supports the defaults in asyncio without threads,
       remove and bump tornado requirement for py38.
       Most likely, this will mean a new Python version
       where asyncio.ProactorEventLoop supports add_reader and friends.

win)      r   N)WindowsProactorEventLoopPolicyWindowsSelectorEventLoopPolicy)rZ   ri   
startswithversion_infoasynciorh  ri  typeget_event_loop_policyset_event_loop_policyr+  )rK   rl  rh  ri  s       rL   _init_asyncio_patchIPKernelApp._init_asyncio_patchs  s    . <<""5))c.>.>&.H	Tb
 5578<ZZ 112P2RS [ /I)
  s   A< <
B	B	c                    SSK nSSKJn  [        US5      (       a4  UR                  Ul        UR
                  Ul        UR                  Ul        gg)zReplace pdb with IPython's version that is interruptible.

With the non-interruptible version, stopping pdb() locks up the kernel in a
non-recoverable state.
r   N)debuggerInterruptiblePdb)pdbIPython.corers  r   rt  Pdb	set_trace)rK   ru  rs  s      rL   init_pdbIPKernelApp.init_pdb  sB     	)8/00#44HLllCG$..CM	 1rO   c                  > U R                  5         [        TU ]	  U5        U R                  b  gU R	                  5         U R                  5         U R                  5         U R                  5         U R                  5         U R                  5         U R                  5         U R                  5         U R                  5          U R                  5         U R+                  5         U R-                  5         U R/                  5         U R0                  (       a0  U R3                  5         U R5                  5         U R7                  5         [8        R:                  R=                  5         [8        R>                  R=                  5         g! [         aD    [        U R                   5      ["        R$                  :  a  U R&                  R)                  SSS9   Nf = f)zInitialize the application.NzUnable to initialize signal:Tr   ) rp  super
initializesubappry  r  r   rm   r   r   r&   r   r  r1  r   r   r   r   r   r   r   rF  	init_pathrX  r0   rS  init_extensions	init_coderZ   r   r	  r   )rK   argv	__class__s     rL   r}  IPKernelApp.initialize  sT    	  "4 ;;"!!#""$ 	  "	N 	::!  "NN 	



!  	N 4>>"W%5%55=M		Ns    E> >AGGc                <   U R                   b  U R                   R                  5       $ U R                  b  U R                  R                  5         U R                  R                  5         [        R
                  R                  5       U l        U R                  (       aE  SSK	J
n  U" 5       nUR                  U R                  U R                  5         UR                  5         g U R                  R                  5         g! [         a     gf = f! [         a     gf = f)zStart the application.Nr   )
TrioRunner)r~  r   rl   r<  r   IOLoopcurrentr?  r>   ipykernel.trio_runnerr  r}  runKeyboardInterrupt)rK   r  trs      rL   r   IPKernelApp.start  s    ;;";;$$&&;;"KK}},,.>>8BMM$++t||4""$	 % 
 % s$   C> #D >
D
D
DD)r   rQ   rE   r   r   r   r   r   r  r   r   r?  r   r   r   r<  rl   r0   r   r   r   r   rI   )Y__name__
__module____qualname____firstlineno____doc__rR   r   kernel_aliasesaliaseskernel_flagsflagsr*   r-   r   r   classesr   tagr@  r   r<  rl   r   r(   r   rE   __annotations__r   r   r   r   r   r   r   r   r   subcommandsr   rG   r    rM   propertyrT   r   r7   r9   r>   r
  r   r  r  r  r   r   r   rP  rQ  rk   rj   r[   rY   rm   ry   r   r&   r   r   r   r   r   r   r   r   r  r  r   r  r1  rF  rS  rX  r   rp  ry  r   r}  r   __static_attributes____classcell__)r  s   @rL   r6   r6   t   s   *D>"GE1:wGG*+ 
cc  UFUFt4I),G&.5LUNUN5L5L5LUNVF 	 
K YN% % $ $ U!EFJJRVJWIU!EFJJRVJWIU!78<<D<IIFGKKSWKXE&&9 
cc	 
 ).5c	cc   
cc	  BJJNN+,12
 
cc  BJJNN016Q7
 
cc )J
	-&(58	!*!49.
@1@"
H8!F.1:5N:2>2##TJ/  % %N rO   c                 l    [         R                  5       n U R                  5         U R                  5         g)z!Run an IPKernel as an applicationN)r6   rA  r}  r   )apps    rL   mainr    s#    



 CNNIIKrO   __main__)Tr  
__future__r   r   r}   r   r   r.  rZ   r`   typingt	functoolsr   ior   r   r   pathlibr   r   IPython.core.applicationr	   r
   r   r   IPython.core.profiledirr   IPython.core.shellappr   r   r   jupyter_client.connectr   jupyter_client.sessionr   r   r   jupyter_core.pathsr   r[  r   traitlets.traitletsr   r   r   r   r   r   r   r   r    traitlets.utilsr!   traitlets.utils.importstringr"   zmq.eventloop.zmqstreamr#   r   r%   r&   r3   r'   r   r(   iostreamr)   ipkernelr*   parentpollerr+   r,   zmqshellr-   r   r  updater  r   r6   launch_instancelaunch_new_instancer  r  r   rO   rL   <module>r     s   + #    	  
    $ !  
  / Q Q 6 J J 2 
 
 
 % 4 - ? #   ! # ? ) l#   #)))-*,	 J   ${D&9:<`a${D&9:<`aWf-.+
  +u!56-
"   m $   K     o &   M "q	(*=?R q	h "11  zF rO   