o
    œh�q  ã                   @  s~  d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
ZddlmZ ddlmZmZ ddlmZ ddlmZ ddlZddlmZmZmZmZ dd	lmZ dd
lmZmZmZ ddl m!Z! ddl"m#Z#m$Z$m%Z% ddl&m'Z' ddl(m)Z) ddl*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3 ddl4m5Z5 ddl6m7Z7 ddl8m9Z9 ddl:m;Z;m<Z< ddl=m>Z> ddl?m@Z@ ddlAmBZB ddlCmDZD ddlEmFZFmGZG ddlHmIZI eJeƒZKeK Ldddddd d!d"d#œ¡ eJeƒZMeM Ld$d%d&iid'fd$d(d&iid)fd$d*d+iid,fd-d.d/iid0fd1œ¡ eK Le¡ eM Le¡ eK Le$¡ eM Le%¡ d2ZNG d3d$„ d$eee!ƒZOeOjPZQd4d5„ ZReSd6k�r=eRƒ  dS dS )7z%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.Z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                      sŠ  e Zd ZU dZdZeeƒZeeƒZ	e
eeegZedddd�jdd�Zeƒ Zeƒ Zeedd	�Zeƒ Zd
ed< eƒ Zeƒ Zeƒ Zeƒ Zeƒ Zeƒ Zeƒ Z eƒ Z!eƒ Z"ddiZ#e$ƒ Z%e&dƒdd„ ƒZ'e(dd„ ƒZ)e*ddd�jdd�Z+e*ddd�jdd�Z,e*ddd�jdd�Z-e*ddd�jdd�Z.e/dddd�jdd�Z0e/ddd�jdd�Z1e*ddd�jdd�Z2e3e4e5j6 7d¡pµd ƒd!d�jdd�Z8e3e4e5j6 7d"¡pÇd ƒd#d�jdd�Z9d$d%„ Z:d&d'„ Z;d(d)„ Z<d*d+„ Z=d,d-„ Z>d.d/„ Z?d0d1„ Z@d2d3„ ZAd4d5„ ZBd6d7„ ZCd8d9„ ZDd:d;„ ZEd<d=„ ZFd>d?„ ZGd@dA„ ZHdBdC„ ZIdDdE„ ZJdFdG„ ZKdHdI„ ZLdJdK„ ZMdLdM„ ZNdNdO„ ZOdPdQ„ ZPdRdS„ ZQdTdU„ ZReSd[‡ fdWdX„	ƒZTdYdZ„ ZU‡  ZVS )\r5   z The IPYKernel application class.zipython-kernelz ipykernel.ipkernel.IPythonKernelzipykernel.kernelbase.Kernelz£The 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                 C  s   t ƒ S ©Nr   ©Úself© rG   úIc:\Users\shubh\Videos\agent\nova\Lib\site-packages\ipykernel/kernelapp.pyÚ_default_connection_dirŸ   s   z#IPKernelApp._default_connection_dirc                 C  s6   t | jƒj| jkr| jrtt t| jƒƒ| j ƒS | jS rD   )r   Úconnection_fileÚnamerC   ÚstrrE   rG   rG   rH   Úabs_connection_file£   s   zIPKernelApp.abs_connection_fileFr7   )r>   r9   zSet main event loop.z(Only send stdout/stderr to output streamzipykernel.iostream.OutStreamz*The importstring for the OutStream factory)r>   r@   z$ipykernel.displayhook.ZMQDisplayHookz,The importstring for the DisplayHook factoryz[Attempt to capture and forward low-level output, e.g. produced by Extension libraries.
    ZJPY_PARENT_PIDr   zœkill this process if its parent dies.  On Windows, the argument
        specifies the HANDLE of the parent process, otherwise it is simply boolean.
        ZJPY_INTERRUPT_EVENTzYONLY USED ON WINDOWS
        Interrupt this process when the parent is signaled.
        c                 C  s   | j t_ dS )zInitialize the crash handler.N)Ú
excepthookÚsysrE   rG   rG   rH   Úinit_crash_handlerË   s   zIPKernelApp.init_crash_handlerc                 C  s   t j|||tjd� dS )zHandle an exception.©ÚfileN)Ú	tracebackÚprint_exceptionrO   Ú
__stderr__)rF   ÚetypeÚevalueÚtbrG   rG   rH   rN   Ï   s   zIPKernelApp.excepthookc                 C  sR   t jdkr| js| jrt| j| jƒ| _dS dS | jr%| jdkr'tƒ | _dS dS dS )zInitialize the poller.Úwin32r#   N)rO   ÚplatformÚ	interruptÚparent_handler+   Úpollerr*   rE   rG   rG   rH   Úinit_pollerÔ   s   
ÿüzIPKernelApp.init_pollerc                 C  s¾   | j › d| j› �}| j dkr%|dkr| |¡}|S | d| j|f ¡ |S | j dkr]|dkrOd}d| j|f }t|ƒ ¡ rN|d }d| j|f }t|ƒ ¡ s=nd| j|f }| d| ¡ |S )	Nz://Ztcpr   ztcp://%s:%iZipcr#   z%s-%izipc://%s)r4   r-   Zbind_to_random_portÚbindr   Úexists)rF   ÚsÚportZifaceÚpathrG   rG   rH   Ú_try_bind_socketß   s&   

õ
öþ€zIPKernelApp._try_bind_socketc                 C  sž   zt j}W n ty   d }Y nw |rdnd}t|ƒD ]1}z	|  ||¡W   S  tjyL } z|j t jkr;|j |kr;‚ ||d krB‚ W Y d }~qd }~ww d S )Nr#   éd   )ÚerrnoZWSAEADDRINUSEÚAttributeErrorÚrangerd   ÚzmqZZMQErrorZ
EADDRINUSE)rF   ra   rb   Z
win_in_useZmax_attemptsÚattemptZzerG   rG   rH   Ú_bind_socketò   s$   
ÿÿ€üzIPKernelApp._bind_socketc              
   C  s¢   | j }t| j| jj| j| j| j| j| j	| j
d�}t|ƒ ¡ r@t|dd�}t|tƒs+J ‚t|fi |¤Ž}||kr@| j d|¡ dS | j d|¡ t|fi |¤Ž dS )z"write connection info to JSON file)r-   Úkeyr4   Ú
shell_portÚ
stdin_portÚhb_portÚ
iopub_portÚcontrol_portT)Úunpackz:Connection file %s with current information already existsNzWriting connection file: %s)rM   Údictr-   Úsessionrl   r4   rm   rn   ro   rp   rq   r   r`   r$   Ú
isinstanceÚlogÚdebugr%   )rF   ÚcfZconnection_infoZexisting_connection_inforG   rG   rH   r%     s(   ø
z!IPKernelApp.write_connection_filec                 C  sD   | j }| j d|¡ zt|ƒ ¡  W n	 ty   Y nw |  ¡  dS )zClean up our connection file.zCleaning up connection file: %sN)rM   rv   rw   r   ÚunlinkÚOSErrorZcleanup_ipc_files)rF   rx   rG   rG   rH   Úcleanup_connection_file"  s   ÿz#IPKernelApp.cleanup_connection_filec                 C  s¸   | j s
dt ¡  | _ zt| j d| jgƒ| _ W n$ ty:   | j d| j ¡ t| j	ƒj
jdddd� t | j¡ Y dS w z|  ¡  W dS  ty[   | jjd| j dd	� |  d
¡ Y dS w )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#   )rJ   ÚosÚgetpidr    rC   rz   rv   rw   r   rM   ÚparentÚmkdirÚatexitÚregisterr{   Zload_connection_fileÚ	ExceptionÚerrorÚexitrE   rG   rG   rH   Úinit_connection_file-  s$   úÿüz IPKernelApp.init_connection_filec                 C  sä   | j  dt ¡ ¡ | jdu sJ dƒ‚t ¡  | _}t | j	¡ | 
tj¡| _d| j_|  | j| j¡| _| j  d| j ¡ | 
tj¡| _d| j_|  | j| j¡| _| j  d| j ¡ ttdƒrfd | j_| j_|  |¡ |  |¡ dS )	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#   )rv   Úinfor‚   rƒ   rA   ri   ÚContextr†   r‡   ÚcloseÚsocketÚROUTERÚshell_socketÚlingerrk   rm   rw   Ústdin_socketrn   ÚhasattrÚrouter_handoverÚinit_controlÚ
init_iopub©rF   rA   rG   rG   rH   Úinit_socketsB  s    

zIPKernelApp.init_socketsc                 C  s¬   |  tj¡| _d| j_|  | j| j¡| _| j d| j ¡ |  tj	¡| _
d| j
_|  tj¡| _d| j_| j tj¡rE| j | j tj¡¡ ttdƒrNd| j_tdd�| _dS )zInitialize the control channel.rŒ   z"control ROUTER Channel on port: %ir�   r#   T)ÚdaemonN)r‘   ri   r’   Úcontrol_socketr”   rk   rq   rv   rw   ZSTREAMÚdebugpy_socketZDEALERÚdebug_shell_socketr“   Ú
getsockoptZLAST_ENDPOINTÚconnectr–   r—   r&   Úcontrol_threadrš   rG   rG   rH   r˜   \  s   
zIPKernelApp.init_controlc                 C  sj   |  tj¡| _d| j_|  | j| j¡| _| j d| j ¡ |  	¡  t
| jdd�| _| j ¡  | jj| _dS )zInitialize the iopub channel.rŒ   ziopub PUB Channel on port: %iT)ÚpipeN)r‘   ri   ZPUBÚiopub_socketr”   rk   rp   rv   rw   Úconfigure_tornado_loggerr(   Úiopub_threadÚstartZbackground_socketrš   rG   rG   rH   r™   s  s   
zIPKernelApp.init_iopubc                 C  sJ   t  ¡ }t|| j| j| jfƒ| _| jj| _| j 	d| j ¡ | j 
¡  dS )zstart the heart beatingz!Heartbeat REP Channel on port: %iN)ri   r�   r'   r4   r-   ro   Ú	heartbeatrb   rv   rw   r§   )rF   Zhb_ctxrG   rG   rH   Úinit_heartbeat  s
   
zIPKernelApp.init_heartbeatc                 C  s  |   ¡  | j d¡ | jr| j d¡ | jj ¡  | jr,| j d¡ | j ¡  | j 	¡  | j
rD| j
 ¡ rD| j d¡ | j
 ¡  | j
 ¡  | jrP| jjsP| j 	¡  | jr\| jjs\| j 	¡  dD ]}| j d|¡ t| |d dƒ}|rx|jsx| 	¡  q^| j d	¡ | jr‡| j ¡  | j d
¡ dS )z'Close zmq sockets in an orderly fashionzCleaning up socketszClosing heartbeat channelzClosing iopub channelzClosing control thread)r/   r2   r1   zClosing %s channelÚ_socketNzTerminating zmq contextzTerminated zmq context)Úreset_iorv   rŽ   r¨   rw   rA   Útermr¦   Ústopr�   r¢   Úis_aliveÚjoinrž   ÚclosedrŸ   Úgetattr)rF   Zchannelr‘   rG   rG   rH   r�   ‰  s6   






€
zIPKernelApp.closec                 C  s¸   t | jƒj}|| jkstt | jƒjƒ| jkr|}n| j}dd| g}|D ]}| j |¡ q$| jsKt	| j
ƒtjk rKtttjd� |D ]	}t|tjd� qAt| j| j| j| j| jd�| _dS )z(display connection info, and store portsz.To connect another client to this kernel, use:z    --existing %srQ   )r/   r0   r1   r.   r2   N)r   rJ   rK   rL   r„   rC   rv   rŽ   r\   ÚintÚ	log_levelÚloggingÚCRITICALÚprintÚ_ctrl_c_messagerO   Ú
__stdout__rs   rm   rp   rn   ro   rq   Ú_ports)rF   ÚbasenameÚtailÚlinesÚlinerG   rG   rH   Úlog_connection_info©  s*   
þûzIPKernelApp.log_connection_infoc                 C  sH   | j s| jr ttjdƒ}| j r| t_t_| jr"| t_t_	dS dS dS )z/redirects stdout/stderr to devnull if necessaryÚwN)
r6   r8   Úopenr‚   ÚdevnullrO   Ústdoutr¸   ÚstderrrU   )rF   Z	blackholerG   rG   rH   Úinit_blackholeÍ  s   ûzIPKernelApp.init_blackholec                 C  s&  | j rwtt| j ƒƒ}tjdurtj ¡  | jrdntj}| jr!dntj}| j	s-t
|dd�}|| j| jd|d�t_tjdurBtj ¡  || j| jd|d�t_ttjdƒrw| jjD ]}t|tƒrv|jj ¡ dkrv| j d	¡ tttjjd
ƒƒ|_qW| jr�tt| jƒƒ}|| j| jƒ| _| jt_|  ¡  dS )z.Redirect input streams and set a display hook.NF)ZwatchfdrÂ   )ZechorÃ   Ú_original_stdstream_copyé   z9Seeing logger to stderr, rerouting to raw filedescriptor.r¿   )Úoutstream_classr!   rL   rO   rÂ   ÚflushÚquietr¸   rU   Úcapture_fd_outputr   rt   r¦   rÃ   r–   rv   Úhandlersru   r   ÚstreamÚbufferÚfilenorw   r   r   rÅ   Údisplayhook_classr¤   ÚdisplayhookÚpatch_io)rF   Zoutstream_factoryZe_stdoutZe_stderrÚhandlerZdisplayhook_factoryrG   rG   rH   Úinit_ioÖ  s8   



þÿ€zIPKernelApp.init_ioc                 C  s   t jt _t jt _t jt _dS )zBrestore original io

        restores state after init_io
        N)rO   r¸   rÂ   rU   rÃ   Ú__displayhook__rÐ   rE   rG   rG   rH   r«   ù  s   zIPKernelApp.reset_ioc                   sv   zddl }W n
 ty   Y dS w |j‰ tjdf‡ fdd„	}||_t|dƒr9|j‰tjddf‡fdd	„	}||_dS dS )
zAPatch important libraries that can't handle sys.stdout forwardingr   NTc                   s   ˆ d| |dœ|¤ŽS )N)rR   Úall_threadsrG   rG   )rR   rÕ   Úkwargs)Úfaulthandler_enablerG   rH   Úenable  s   z$IPKernelApp.patch_io.<locals>.enabler‡   Fc                   s   ˆ | f|||dœ|¤ŽS )N)rR   rÕ   ÚchainrG   )ZsignumrR   rÕ   rÙ   rÖ   )Úfaulthandler_registerrG   rH   r‡     s   ÿÿÿz&IPKernelApp.patch_io.<locals>.register)ÚfaulthandlerÚImportErrorrØ   rO   rU   r–   r‡   )rF   rÛ   rØ   r‡   rG   )r×   rÚ   rH   rÑ     s   ÿ

øzIPKernelApp.patch_ioc                 C  s   t   t jt j¡ dS )zInitialize the signal handler.N)ÚsignalÚSIGINTÚSIG_IGNrE   rG   rG   rH   Úinit_signal  s   zIPKernelApp.init_signalc                   s¤   t | jƒ}t | j| jjƒ}t | j| jjƒ}| j ¡  | jj}|| | j	||| j
|| j| j| j| j| j| j| jd�‰ ˆ  dd„ | j ¡ D ƒ¡ ˆ | _‡ fdd„| j_dS )zCreate the Kernel object itself)r„   rt   Úcontrol_streamÚdebugpy_streamrŸ   Úshell_streamr¢   r¦   r¤   r•   rv   Úprofile_dirÚuser_nsc                 S  s   i | ]	\}}|d  |“qS )Z_portrG   )Ú.0rK   rb   rG   rG   rH   Ú
<dictcomp>:  s    z+IPKernelApp.init_kernel.<locals>.<dictcomp>c                     s   ˆ j S rD   )Zexecution_countrG   ©ÚkernelrG   rH   Ú<lambda>>  s    z)IPKernelApp.init_kernel.<locals>.<lambda>N)r"   r“   r�   r¢   Úio_looprž   r§   Úkernel_classÚinstancert   rŸ   r¦   r¤   r•   rv   rä   rå   Zrecord_portsr¹   Úitemsré   rÐ   Zget_execution_count)rF   rã   rá   râ   Zkernel_factoryrG   rè   rH   Úinit_kernel#  s.   

ózIPKernelApp.init_kernelc                   s`   t j d¡sdt jd< | j‰ ˆ dusJ ‚ˆ j}z‡ fdd„}|ˆ _t | ¡ W |ˆ _dS |ˆ _w )z=Enable GUI event loop integration, taking pylab into account.Z
MPLBACKENDz)module://matplotlib_inline.backend_inlineNc                   s4   t dtjd� ˆ d usJ ‚t ˆ j |¡tjd� d S )Nz-GUI event loop or pylab initialization failedrQ   )r¶   rO   rÃ   ZInteractiveTBZstb2text)rV   rW   Zstb©r/   rG   rH   Úprint_tbU  s   z,IPKernelApp.init_gui_pylab.<locals>.print_tb)r‚   ÚenvironÚgetr/   Ú_showtracebackr   Úinit_gui_pylab)rF   rô   rñ   rG   rð   rH   rõ   @  s   
zIPKernelApp.init_gui_pylabc                 C  s,   t | jddƒ| _| jr| jj | ¡ dS dS )zInitialize the shell channel.r/   N)r±   ré   r/   ZconfigurablesÚappendrE   rG   rG   rH   Ú
init_shell_  s   ÿzIPKernelApp.init_shellc                 C  s6   t  d¡}t  ¡ }t  t j¡}| |¡ | |¡ dS )a5  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)rF   ÚloggerrÒ   Ú	formatterrG   rG   rH   r¥   e  s
   

z$IPKernelApp.configure_tornado_loggerc                 C  st   t j d¡r4t jdkr6ddl}z
ddlm}m} W n
 ty#   Y dS w t| 	¡ ƒ|u r8| 
|ƒ ¡ dS dS dS dS )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)rO   rZ   Ú
startswithÚversion_infoÚasyncior  r  rÜ   ÚtypeÚget_event_loop_policyÚset_event_loop_policy)rF   r  r  r  rG   rG   rH   Ú_init_asyncio_patchs  s   ÿô	zIPKernelApp._init_asyncio_patchc                 C  s>   ddl }ddlm} t|dƒr|j|_|j|_|j|_dS dS )z¶Replace 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)ÚpdbZIPython.corer  r–   r  ZPdbÚ	set_trace)rF   r  r  rG   rG   rH   Úinit_pdb˜  s   
üzIPKernelApp.init_pdbNc                   sø   |   ¡  tƒ  |¡ | jdurdS |  ¡  |  ¡  |  ¡  |  ¡  |  ¡  |  	¡  |  
¡  |  ¡  |  ¡  z|  ¡  W n tyT   t| jƒtjk rR| jjddd� Y nw |  ¡  |  ¡  |  ¡  | jrp|  ¡  |  ¡  |  ¡  tj ¡  tj ¡  dS )zInitialize the application.NzUnable to initialize signal:Tr€   ) r  ÚsuperÚ
initializeÚsubappr  rÄ   r‹   r^   r›   r©   r%   r¾   rÓ   rà   rˆ   r²   r³   r´   rµ   rv   r‰   rï   Z	init_pathr÷   r/   rõ   Zinit_extensionsZ	init_coderO   rÂ   rÈ   rÃ   )rF   Úargv©Ú	__class__rG   rH   r  ¨  s:   
€ü
zIPKernelApp.initializec                 C  s°   | j dur
| j  ¡ S | jdur| j ¡  | j ¡  tj ¡ | _| jrEddl	m
} |ƒ }| | j| j¡ z| ¡  W dS  tyD   Y dS w z| j ¡  W dS  tyW   Y dS w )zStart the application.Nr   )Ú
TrioRunner)r  r§   r]   ré   r   ZIOLoopÚcurrentrë   r<   Zipykernel.trio_runnerr  r  ÚrunÚKeyboardInterrupt)rF   r  ÚtrrG   rG   rH   r§   Ð  s(   




ÿÿzIPKernelApp.startrD   )WÚ__name__Ú
__module__Ú__qualname__Ú__doc__rK   r   Úkernel_aliasesÚaliasesÚkernel_flagsÚflagsr)   r,   r   r   Úclassesr   Útagrì   r   ré   r]   r   r'   r¨   rA   Ú__annotations__r“   r�   rž   rŸ   r•   r¤   r¦   r¢   r¹   Úsubcommandsr   rC   r   rI   ÚpropertyrM   r   r6   r8   r<   rÉ   r   rÇ   rÏ   rÊ   r   r²   r‚   rò   ró   r\   r[   rP   rN   r^   rd   rk   r%   r{   r‹   r›   r˜   r™   r©   r�   r¾   rÄ   rÓ   r«   rÑ   rà   rï   rõ   r÷   r¥   r  r  r   r  r§   Ú__classcell__rG   rG   r  rH   r5   t   s¾   
 ýø	ÿ

ýüÿþþüþûþû
 $	#	%'c                  C  s   t  ¡ } |  ¡  |  ¡  dS )z!Run an IPKernel as an applicationN)r5   rí   r  r§   )ZapprG   rG   rH   Úmainë  s   r*  Ú__main__)Tr  Ú
__future__r   r†   rf   r´   r‚   rÝ   rO   rS   ÚtypingÚtÚ	functoolsr   Úior   r   r   Úpathlibr   ri   ZIPython.core.applicationr   r	   r
   r   ZIPython.core.profiledirr   ZIPython.core.shellappr   r   r   Zjupyter_client.connectr   Zjupyter_client.sessionr   r   r   Zjupyter_core.pathsr   rø   r   Ztraitlets.traitletsr   r   r   r   r   r   r   r   r   Ztraitlets.utilsr    Ztraitlets.utils.importstringr!   Zzmq.eventloop.zmqstreamr"   r¡   r$   r%   r2   r&   r¨   r'   Ziostreamr(   Zipkernelr)   Zparentpollerr*   r+   Zzmqshellr,   rs   r   Úupdater"  r·   r5   Zlaunch_instanceZlaunch_new_instancer*  r  rG   rG   rG   rH   Ú<module>   s�    ,øÿ
þ
þøÿ



    x

ÿ