B
    5dw                 @   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__ f/work/yifan.wang/ringdown/master-ringdown-env/lib/python3.7/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)timeoutZparent_headermsg_idcontentr   ok)r   Zcursor_startZ
cursor_endmetadatastatus)r   Zcompleter   Zshell_channelZ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   Ztraitlets.configr   Z	traitletsr   Zjupyter_console.utilsr   r   r   r   r   r   <module>   s   