
    f                    X    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e      Zy)	    )annotations)Iterable)Document   )CompleteEvent	Completer
CompletionDeduplicateCompleterc                  ,    e Zd ZdZddZ	 	 	 	 	 	 ddZy)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.
    c                    || _         y N)	completer)selfr   s     `/var/www/cvtools/html/venv/lib/python3.12/site-packages/prompt_toolkit/completion/deduplicate.py__init__zDeduplicateCompleter.__init__   s	    "    c              #  P  K   t               }| j                  j                  ||      D ]y  }|j                  d |j                  |j
                  z    |j                  z   |j                  |j                  d  z   }||j                  k(  r`||v re|j                  |       | { y wr   )setr   get_completionstextcursor_positionstart_positionadd)r   documentcomplete_eventfound_so_far
completiontext_if_applieds         r   r   z$DeduplicateCompleter.get_completions   s      "%..88>R 	JT 8 8:;T;T TU//"-- 8 8 :;<  (--/,._-	s   B$B&N)r   r   returnNone)r   r   r   r   r   zIterable[Completion])__name__
__module____qualname____doc__r   r    r   r   r
   r
      s)    # 2?	r   N)
__future__r   typingr   prompt_toolkit.documentr   baser   r   r	   __all__r
   r%   r   r   <module>r+      s(    "  , 6 6!
"!9 !r   