
    ^hk                    t    S SK Jr  S SKJrJrJrJrJr  S SKJ	r	J
r
Jr  S SKJr  S SKJr  S/r " S S\
5      rg)	    )annotations)CallableIterableMappingPatternSequence)CompleteEvent	Completer
Completion)Document)AnyFormattedTextWordCompleterc                  l    \ rS rSrSr       S                 SS jjr      S	S jrSrg)
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)
Nc	                    U(       a	  U(       a   eXl         X l        U=(       d    0 U l        U=(       d    0 U l        XPl        X`l        Xpl        Xl        g )N)wordsignore_casedisplay_dict	meta_dictWORDsentencematch_middlepattern)	selfr   r   r   r   r   r   r   r   s	            b/home/james-whalen/.local/lib/python3.13/site-packages/prompt_toolkit/completion/word_completer.py__init__WordCompleter.__init__"   sG     X&&
&(.B"b	 (    c              #    ^ ^#    T R                   n[        U5      (       a  U" 5       nT R                  (       a  UR                  mO$UR	                  T R
                  T R                  S9mT R                  (       a  TR                  5       mSU U4S jjnU Ha  nU" U5      (       d  M  T R                  R                  XU5      nT R                  R                  US5      n[        U[        T5      * UUS9v   Mc     g 7f)N)r   r   c                   > TR                   (       a  U R                  5       n TR                  (       a  TU ;   $ U R                  T5      $ )z-True when the word before the cursor matches.)r   lowerr   
startswith)wordr   word_before_cursors    r   word_matches3WordCompleter.get_completions.<locals>.word_matchesK   s;    zz|  )T11'9::r    )textstart_positiondisplaydisplay_meta)r#   strreturnbool)r   callabler   text_before_cursorget_word_before_cursorr   r   r   r!   r   getr   r   len)	r   documentcomplete_eventr   r%   ar*   r+   r$   s	   `       @r   get_completionsWordCompleter.get_completions8   s      

E??GE ==!)!<!<!)!@!@YY "A " !3!9!9!;	; 	; AA++//5#~~11!R8 $'(:$;#;#!-	 	 s   B C<(AC<)r   r   r   r   r   r   r   r   )FNNFFFN)r   z+Sequence[str] | Callable[[], Sequence[str]]r   r.   r   %Mapping[str, AnyFormattedText] | Noner   r9   r   r.   r   r.   r   r.   r   zPattern[str] | Noner-   None)r4   r   r5   r	   r-   zIterable[Completion])__name__
__module____qualname____firstlineno____doc__r   r7   __static_attributes__ r   r   r   r      s    , ">B;?"'+:  <	
 9    % 
,& &2?&	&r   N)
__future__r   typingr   r   r   r   r   prompt_toolkit.completionr	   r
   r   prompt_toolkit.documentr   prompt_toolkit.formatted_textr   __all__r   rA   r   r   <module>rH      s4    " A A J J , : 
PI Pr   