o
    ^iw                     @   s<   d Z ddlmZ ddlmZ ddlmZ G dd deZdS )z7Adapt readline completer interface to make ZMQ request.    )Configurable)Float)run_syncc                       s8   e Zd ZdZeddddZd fdd	Zd	d
 Z  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                    s(   t t| j|d || _|| _g | _d S )N)r   )superr   __init__shellclientmatches)selfr
   r   r   	__class__ T/home/ubuntu/hpml_nyu/venv/lib/python3.10/site-packages/jupyter_console/completer.pyr	      s   
zZMQCompleter.__init__c                 C   sN   | j j||d}t| j jj| jd}|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   msgr   r   r   complete_request   s   zZMQCompleter.complete_request)N)	__name__
__module____qualname____doc__r   r   r	   r!   __classcell__r   r   r   r   r      s
    r   N)r%   traitlets.configr   	traitletsr   jupyter_console.utilsr   r   r   r   r   r   <module>   s
   