
    ^h                    T    S r SSKJr  SSKJr  SSKrSSKJr  SSKJ	r	   " S S5      r
g)	zBPair of ZMQ inproc sockets used for communication between threads.    )annotations)AnyN)IOLoop)	ZMQStreamc                  d    \ rS rSr% SrS\S'   S\S'   SrS\S'   SS	 jrS
 rSSS jjr	SS jr
Srg)
SocketPair   zPair of ZMQ inproc sockets for one-direction communication between 2 threads.

One of the threads is always the shell_channel_thread, the other may be the control
thread, main thread or a subshell thread.

.. versionadded:: 7
zzmq.Socket[Any]from_socket	to_socketNzZMQStream | None	to_streamc                "   UR                  [        R                  5      U l        UR                  [        R                  5      U l        U R                  U5      nU R                  R                  U5        U R                  R                  U5        g)z"Initialize the inproc socker pair.N)socketzmqPAIRr
   r   _addressbindconnect)selfcontextnameaddresss       O/home/james-whalen/.local/lib/python3.13/site-packages/ipykernel/socket_pair.py__init__SocketPair.__init__   s_    ">>#((3 1--%g&w'    c                    U R                   R                  5         U R                  b  U R                  R                  5         U R                  R                  5         g)zClose the inproc socker pair.N)r
   closer   r   )r   s    r   r   SocketPair.close!   s>     >>%NN  "r   c                    U R                   c  [        U R                  U5      U l         U R                   R                  X#S9  g)zBSet the callback used when a message is received on the to stream.N)copy)r   r   r   on_recv)r   io_loopon_recv_callbackr    s       r   r!   SocketPair.on_recv)   s6     >>!&t~~w?DN/;r   c                    SU 3$ )z4Return the address used for this inproc socket pair.zinproc://subshell )r   r   s     r   r   SocketPair._address0   s    "4&))r   )r
   r   r   )r   zzmq.Context[Any]r   str)F)r"   r   r    bool)returnr(   )__name__
__module____qualname____firstlineno____doc____annotations__r   r   r   r!   r   __static_attributes__r&   r   r   r   r      s4     ! "&I&(<*r   r   )r/   
__future__r   typingr   r   tornado.ioloopr   zmq.eventloop.zmqstreamr   r   r&   r   r   <module>r6      s!    H "  
 ! -&* &*r   