
    %Qc}                     X    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e          Z
dS )    )IterableSet)Document   )CompleteEvent	Completer
CompletionDeduplicateCompleterc                   B    e Zd ZdZdeddfdZdededee	         f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                     || _         d S N)r   )selfr   s     Elib/python3.11/site-packages/prompt_toolkit/completion/deduplicate.py__init__zDeduplicateCompleter.__init__   s    "    documentcomplete_eventc              #   (  K   t                      }| j                            ||          D ]e}|j        d |j        |j        z            |j        z   |j        |j        d          z   }||j        k    rG||v rL|                    |           |V  fd S r   )setr   get_completionstextcursor_positionstart_positionadd)r   r   r   found_so_far
completiontext_if_applieds         r   r   z$DeduplicateCompleter.get_completions   s       "%.88>RR 	 	JT 8:;T TTU/"- 8 : :;<  (-/ ,. _---	 	r   )__name__
__module____qualname____doc__r   r   r   r   r   r	   r    r   r   r
   r
   
   sq         #) # # # # # 2?	*	     r   N)typingr   r   prompt_toolkit.documentr   baser   r   r	   __all__r
   r$   r   r   <module>r)      s                    , , , , , , 6 6 6 6 6 6 6 6 6 6!
"! ! ! ! !9 ! ! ! ! !r   