a
    ‰©lc}  ã                   @   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                   @   s6   e Zd ZdZeddœdd„Zeeee	 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.
    N)Ú	completerÚreturnc                 C   s
   || _ d S ©N)r
   )Úselfr
   © r   úa/var/www/html/django/DPS/env/lib/python3.9/site-packages/prompt_toolkit/completion/deduplicate.pyÚ__init__   s    zDeduplicateCompleter.__init__)ÚdocumentÚcomplete_eventr   c                 c   sp   t ƒ }| j ||¡D ]V}|jd |j|j … |j |j|jd …  }||jkrPq||v rZq| |¡ |V  qd S r   )Úsetr
   Úget_completionsÚtextZcursor_positionZstart_positionÚadd)r   r   r   Zfound_so_farÚ
completionZ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   Zprompt_toolkit.documentr   Úbaser   r   r   Ú__all__r	   r   r   r   r   Ú<module>   s   