
                         F    S SK Jr  S SKJr  S SKJrJr  Sr " S S\5      rg)    )unicode_literals)string_types)	Completer
Completion)WordCompleterc                   ,    \ rS rSrSr  SS jrS rSrg)r      a  
Simple autocompletion on a list of words.

:param words: List of words.
:param ignore_case: If True, case-insensitive completion.
:param meta_dict: Optional dict mapping words to their meta-information.
: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.
Nc                     U(       a	  U(       a   e[        U5      U l        X l        U=(       d    0 U l        X@l        XPl        X`l        [        S U R                   5       5      (       d   eg )Nc              3   B   #    U  H  n[        U[        5      v   M     g 7f)N)
isinstancer   ).0ws     9lib/third_party/prompt_toolkit/contrib/completers/base.py	<genexpr>)WordCompleter.__init__.<locals>.<genexpr>$   s     C
1:a..
s   )listwordsignore_case	meta_dictWORDsentencematch_middleall)selfr   r   r   r   r   r   s          r   __init__WordCompleter.__init__   sT    X&&%[
&"b	 (C

CCCCC    c              #   x  ^ ^#    T R                   (       a  UR                  mOUR                  T R                  S9mT R                  (       a  TR                  5       mU U4S jnT R                   HE  nU" U5      (       d  M  T R                  R                  US5      n[        U[        T5      * US9v   MG     g 7f)N)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_matches0   s;    zz|  )T11'9::r    )display_meta)r   text_before_cursorget_word_before_cursorr   r   r    r   r   getr   len)r   documentcomplete_eventr$   ar'   r#   s   `     @r   get_completionsWordCompleter.get_completions&   s     ==!)!<!<!)!@!@dii!@!P!3!9!9!;	; AA#~~11!R8 S);%<$<<XX s   A:B:8B:)r   r   r   r   r   r   )FNFFF)__name__
__module____qualname____firstlineno____doc__r   r/   __static_attributes__ r   r   r   r      s     GL.3
DYr   r   N)	
__future__r   sixr   prompt_toolkit.completionr   r   __all__r   r7   r   r   <module>r<      s#    '  ;
2YI 2Yr   