o
    �õ±j¥  ã                   @  sR   d dl mZ d dl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 )	é    )Úannotations)ÚIterable)ÚDocumenté   )ÚCompleteEventÚ	CompleterÚ
CompletionÚDeduplicateCompleterc                   @  s$   e Zd ZdZddd„Zd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.
    Ú	completerr   ÚreturnÚNonec                 C  s
   || _ d S ©N)r
   )Úselfr
   © r   ú˜/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/prompt_toolkit/completion/deduplicate.pyÚ__init__   s   
zDeduplicateCompleter.__init__Údocumentr   Úcomplete_eventr   úIterable[Completion]c                 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_completionsN)r
   r   r   r   )r   r   r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r	      s    
N)Ú
__future__r   Úcollections.abcr   Úprompt_toolkit.documentr   Úbaser   r   r   Ú__all__r	   r   r   r   r   Ú<module>   s    