
    @Ne                    `    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dS )	    )annotations)Iterable)Document   )CompleteEvent	Completer
CompletionDeduplicateCompleterc                  "    e Zd ZdZddZ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                    || _         d S N)r   )selfr   s     /home/feoh/.cache/pypoetry/virtualenvs/veilid-python-play-bIboZq2W-py3.11/lib/python3.11/site-packages/prompt_toolkit/completion/deduplicate.py__init__zDeduplicateCompleter.__init__   s    "    documentr   complete_eventr   Iterable[Completion]c              #  (  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   N)r   r   r   r   )r   r   r   r   r   r   )__name__
__module____qualname____doc__r   r    r   r   r
   r
      sF         # # # #     r   N)
__future__r   typingr   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   