o
    ˷e}                     @   sJ   d dl mZmZ d dlmZ ddlmZmZmZ dgZ	G dd deZ
dS )    )IterableSet)Document   )CompleteEvent	Completer
CompletionDeduplicateCompleterc                   @   s<   e Zd ZdZdeddfddZdededee	 fd	d
Z
dS )r	   z
    Wrapper around a completer that removes duplicates. Only the first unique
    completions are kept.

    Completions are considered to be a duplicate if they result in the same
    document text when they would be applied.
    	completerreturnNc                 C   s
   || _ d S N)r
   )selfr
    r   \/var/www/ideatree/venv/lib/python3.10/site-packages/prompt_toolkit/completion/deduplicate.py__init__   s   
zDeduplicateCompleter.__init__documentcomplete_eventc                 c   sr    t  }| j||D ]+}|jd |j|j  |j |j|jd   }||jkr)q||v r.q|| |V  qd S r   )setr
   get_completionstextcursor_positionstart_positionadd)r   r   r   found_so_far
completiontext_if_appliedr   r   r   r      s    

z$DeduplicateCompleter.get_completions)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r   r   r   r	   
   s    N)typingr   r   prompt_toolkit.documentr   baser   r   r   __all__r	   r   r   r   r   <module>   s
    