
    Mhk                    |    d dl mZ d dlmZmZmZmZmZ d dlm	Z	m
Z
mZ d dlmZ d dlmZ dgZ G d de
          ZdS )	    )annotations)CallableIterableMappingPatternSequence)CompleteEvent	Completer
Completion)Document)AnyFormattedTextWordCompleterc                  2    e Zd ZdZ	 	 	 	 	 	 	 dddZddZdS )r   a  
    Simple autocompletion on a list of words.

    :param words: List of words or callable that returns a list of words.
    :param ignore_case: If True, case-insensitive completion.
    :param meta_dict: Optional dict mapping words to their meta-text. (This
        should map strings to strings or formatted text.)
    :param WORD: When True, use WORD characters.
    :param sentence: When True, don't complete by comparing the word before the
        cursor, but by comparing all the text before the cursor. In this case,
        the list of words is just a list of strings, where each string can
        contain spaces. (Can not be used together with the WORD option.)
    :param match_middle: When True, match not only the start, but also in the
                         middle of the word.
    :param pattern: Optional compiled regex for finding the word before
        the cursor to complete. When given, use this regex pattern instead of
        default one (see document._FIND_WORD_RE)
    FNwords+Sequence[str] | Callable[[], Sequence[str]]ignore_casebooldisplay_dict%Mapping[str, AnyFormattedText] | None	meta_dictWORDsentencematch_middlepatternPattern[str] | NonereturnNonec	                    |r|rJ || _         || _        |pi | _        |pi | _        || _        || _        || _        || _        d S )N)r   r   r   r   r   r   r   r   )	selfr   r   r   r   r   r   r   r   s	            h/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/prompt_toolkit/completion/word_completer.py__init__zWordCompleter.__init__"   s]     &X&&&
&(.B"b	 (    documentr   complete_eventr	   Iterable[Completion]c              #     K    j         }t          |          r
 |            } j        r|j        n!|                     j         j                   j        r                                d	 fd}|D ]f} ||          rY j	        
                    ||          } j        
                    |d          }t          |t                     ||          V  gd S )
N)r   r   wordstrr   r   c                z    j         r|                                 } j        r| v S |                               S )z-True when the word before the cursor matches.)r   lowerr   
startswith)r'   r   word_before_cursors    r    word_matchesz3WordCompleter.get_completions.<locals>.word_matchesK   sD     $zz||  ;)T11'9:::r"    )textstart_positiondisplaydisplay_meta)r'   r(   r   r   )r   callabler   text_before_cursorget_word_before_cursorr   r   r   r*   r   getr   r   len)	r   r#   r$   r   r-   ar1   r2   r,   s	   `       @r    get_completionszWordCompleter.get_completions8   s=      
E?? 	EGGE = 	!)!<!)!@!@Y "A " "  	<!3!9!9!;!;	; 	; 	; 	; 	; 	; 	;  		 		A|A +//155#~11!R88 $'(:$;$;#;#!-	     			 		r"   )FNNFFFN)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r#   r   r$   r	   r   r%   )__name__
__module____qualname____doc__r!   r9    r"   r    r   r      sb         , ">B;?"'+    ,& & & & & &r"   N)
__future__r   typingr   r   r   r   r   prompt_toolkit.completionr	   r
   r   prompt_toolkit.documentr   prompt_toolkit.formatted_textr   __all__r   r>   r"   r    <module>rE      s    " " " " " " A A A A A A A A A A A A A A J J J J J J J J J J , , , , , , : : : : : : 
P P P P PI P P P P Pr"   