
    "dw                     J    d Z ddlmZ ddlmZ ddlmZ  G d de          ZdS )z7Adapt readline completer interface to make ZMQ request.    )Configurable)Float)run_syncc                   F     e Zd ZdZ eddd          Zd	 fd	Zd Z xZS )
ZMQCompleterzClient-side completion machinery.

    How it works: self.complete will be called multiple times, with
    state=0,1,2,... When state=0 it should compute ALL the completion matches,
    and then return them for each value of state.g      @Tztimeout before completion abort)confighelpNc                     t          t          |                               |           || _        || _        g | _        d S )N)r   )superr   __init__shellclientmatches)selfr   r   r   	__class__s       9lib/python3.11/site-packages/jupyter_console/completer.pyr   zZMQCompleter.__init__   s=    l4  )))888
    c                     | j                             ||          } t          | j         j        j                  | j                  }|d         d         |k    r|d         S g ddi ddS )	N)code
cursor_pos)timeoutparent_headermsg_idcontentr   ok)r   cursor_start
cursor_endmetadatastatus)r   completer   shell_channelget_msgr   )r   r   r   r   msgs        r   complete_requestzZMQCompleter.complete_request   s     %%! & 
 

 :ht{0899$,OOO)V33y>!q$0 0 	0r   )N)	__name__
__module____qualname____doc__r   r   r   r$   __classcell__)r   s   @r   r   r      so        5 5 eC+LMMMG     0 0 0 0 0 0 0r   r   N)r(   traitlets.configr   	traitletsr   jupyter_console.utilsr   r    r   r   <module>r.      sw    = =
 * ) ) ) ) )       * * * * * *0 0 0 0 0< 0 0 0 0 0r   