o
    �XAr  ã                   @   s>  d dl mZmZmZmZ d dlZd dlZd dlZd dlZddl	m
Z
mZ ddlmZmZmZmZmZ ddl
mZ ddlmZmZmZmZ dejv Zejad	d
„ ZdZdZej ej!ej"ej#ej$ej%ej&fZ'ej(dd„ ƒZ)ej(dd„ ƒZ*G dd„ de+ƒZ,ddd„Z-dd„ Z.G dd„ de/ƒZ0G dd„ de0ƒZ1e0ƒ Z2de2_3dd„ Z4dS )é    )Úabsolute_importÚdivisionÚprint_functionÚunicode_literalsNé   )Ú
completersÚmy_shlex)ÚUSING_PYTHON2ÚstrÚsys_encodingÚ
ensure_strÚensure_bytes)ÚFilesCompleter)ÚIntrospectiveArgumentParserÚaction_is_satisfiedÚaction_is_openÚaction_is_greedyÚ
_ARC_DEBUGc                  G   s   t rt| dtiŽ d S d S )NÚfile)Ú_DEBUGÚprintÚdebug_stream©Úargs© r   ú6/usr/lib/python3/dist-packages/argcomplete/__init__.pyÚdebug   s   ÿr   éO   éP   c                  c   s2   � t j} ttjdƒt _z	d V  W | t _d S | t _w ©NÚw)ÚsysÚstdoutÚopenÚosÚdevnull)r"   r   r   r   Úmute_stdout   s   €r&   c                  c   sF   � t j} ttjdƒt _zd V  W t j ¡  | t _d S t j ¡  | t _w r   )r!   Ústderrr#   r$   r%   Úclose)r'   r   r   r   Úmute_stderr(   s   €


ÿr)   c                   @   s   e Zd ZdS )ÚArgcompleteExceptionN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r*   2   s    r*   c              	      sö   ˆd u rt | ƒ‰tj| dd�‰ dˆ _tj dd¡ˆ _g ‰‡ ‡‡fdd„}	 z/ˆ  ¡ }|ˆ jkr7dddˆd fW S ˆ j	 
¡ ˆkrNtd|djˆ jd	�ƒ ||ƒW S ˆ |¡ W n% tyy   tdˆ jd
jˆ jd	�ƒ ˆ j	 
¡ ˆkru|ˆ jƒ Y S tdƒ‚w q%)NT)ÚposixÚ_ARGCOMPLETE_COMP_WORDBREAKSÚ c                    s¦   t | ƒˆ ˆ j ¡  }tˆ jttfƒrˆ jˆ jv r|d7 }|t | ƒkr.tdƒ ˆ 	| ¡ d} | d |… | |d … }}d}ˆ jd urKˆ jˆ j
v rKˆ j}|||ˆˆ jfS )Nr   zIn trailing whitespacer0   )ÚlenÚinstreamÚtellÚ
isinstanceÚstater
   ÚbytesÚ
whitespacer   ÚappendÚquotesÚlast_wordbreak_pos)ÚwordÚpoint_in_wordÚprefixÚsuffixÚprequote©ÚlexerÚpointÚwordsr   r   Ú
split_word=   s   
zsplit_line.<locals>.split_wordr;   zsplit, lexer state: '{s}'©Úsz#split (lexer stopped, state: '{s}')zcUnexpected internal state. Please report this bug at https://github.com/kislyuk/argcomplete/issues.)r1   ÚshlexÚwhitespace_splitr$   ÚenvironÚgetÚ
wordbreaksÚ	get_tokenÚeofr2   r3   r   Úformatr5   r8   Ú
ValueErrorÚtokenr*   )ÚlinerB   rD   r;   r   r@   r   Ú
split_line5   s.   

ûõrR   c                 C   s
   |   |¡S ©N©Ú
startswith)Ú
completionr=   r   r   r   Údefault_validatorc   s   
rW   c                   @   s´   e Zd ZdZdddddeƒ dfdd„Zdejdddddeƒ fdd„Zd	d
„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zedd„ ƒZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!d"„ ZdS )#ÚCompletionFindera   
    Inherit from this class if you wish to override any of the stages below. Otherwise, use
    ``argcomplete.autocomplete()`` directly (it's a convenience instance of this class). It has the same signature as
    :meth:`CompletionFinder.__call__()`.
    NTFc                 C   s^   || _ || _|| _|d u rt}|| _|| _d| _i | _|| _|d u r*t	j
 d¡dk}|| _d S )NFÚ_ARGCOMPLETE_SUPPRESS_SPACEÚ1)Ú_parserÚalways_complete_optionsÚexcluderW   Ú	validatorÚprint_suppressedÚ
completingÚ_display_completionsÚdefault_completerr$   rI   rJ   Úappend_space)ÚselfÚargument_parserr\   r]   r^   r_   rb   rc   r   r   r   Ú__init__l   s   
zCompletionFinder.__init__c
              	   C   sœ  | j |||||||	d� dtjvrdS zt dd¡aW n   tjaY |du r<zt dd¡}W n   tdƒ |d	ƒ Y tj d
d¡}
t	|
ƒd	krUtdj
|
d�ƒ |d	ƒ tjd }ttjd ƒ}trot	|d|…  t¡ƒ}nt	| t¡d|…  t¡ƒ}t|ƒ}t||ƒ\}}}}}tjd dkr—| d¡ tdj
|||d�dj
|d�d|ƒ |  ||||¡}td|ƒ | |
 |¡ t¡¡ | ¡  t ¡  |dƒ dS )aì  
        :param argument_parser: The argument parser to autocomplete on
        :type argument_parser: :class:`argparse.ArgumentParser`
        :param always_complete_options:
            Controls the autocompletion of option strings if an option string opening character (normally ``-``) has not
            been entered. If ``True`` (default), both short (``-x``) and long (``--x``) option strings will be
            suggested. If ``False``, no option strings will be suggested. If ``long``, long options and short options
            with no long variant will be suggested. If ``short``, short options and long options with no short variant
            will be suggested.
        :type always_complete_options: boolean or string
        :param exit_method:
            Method used to stop the program after printing completions. Defaults to :meth:`os._exit`. If you want to
            perform a normal exit that calls exit handlers, use :meth:`sys.exit`.
        :type exit_method: callable
        :param exclude: List of strings representing options to be omitted from autocompletion
        :type exclude: iterable
        :param validator:
            Function to filter all completions through before returning (called with two string arguments, completion
            and prefix; return value is evaluated as a boolean)
        :type validator: callable
        :param print_suppressed:
            Whether or not to autocomplete options that have the ``help=argparse.SUPPRESS`` keyword argument set.
        :type print_suppressed: boolean
        :param append_space:
            Whether to append a space to unique matches. The default is ``True``.
        :type append_space: boolean

        .. note::
            If you are not subclassing CompletionFinder to override its behaviors,
            use ``argcomplete.autocomplete()`` directly. It has the same signature as this method.

        Produces tab completions for ``argument_parser``. See module docs for more info.

        Argcomplete only executes actions if their class is known not to have side effects. Custom action classes can be
        added to argcomplete.safe_actions, if their values are wanted in the ``parsed_args`` completer argument, or
        their execution is otherwise desirable.
        )r\   r]   r^   r_   rc   rb   Ú_ARGCOMPLETENé	   r    é   Úwbz)Unable to open fd 8 for writing, quittingr   Ú_ARGCOMPLETE_IFSúz%Invalid value for IFS, quitting [{v}])ÚvÚ	COMP_LINEÚ
COMP_POINTÚ2r   z+
LINE: '{l}'
PREQUOTE: '{pq}'
PREFIX: '{p}')ÚlÚpqÚpz
SUFFIX: '{s}'rE   z
WORDS:z
Returning completions:)rf   r$   rI   Úfdopenr   r!   r'   r   rJ   r1   rN   Úintr	   Údecoder   Úencoder   rR   ÚpopÚ_get_completionsÚwriteÚjoinÚflush)rd   re   r\   Úexit_methodÚoutput_streamr]   r^   r_   rc   rb   ÚifsÚ	comp_lineÚ
comp_pointÚcword_prequoteÚcword_prefixÚcword_suffixÚ
comp_wordsr:   Úcompletionsr   r   r   Ú__call__|   sN   
(þ




þ
zCompletionFinder.__call__c           
   
   C   sô   |   ¡ }t ¡ }d| _trdd„ |D ƒ}z/td|dd … ƒ tƒ � | jj|dd … |d�}W d   ƒ n1 s8w   Y  td|ƒ W n t	y` } ztdt
|ƒt|ƒd	ƒ W Y d }~nd }~ww d
| _|  |||t¡}	|  |	¡}	|  |	||¡}	|	S )NTc                 S   ó   g | ]}t |ƒ‘qS r   )r   )Ú.0r;   r   r   r   Ú
<listcomp>æ   ó    z5CompletionFinder._get_completions.<locals>.<listcomp>zinvoking parser withr   )Ú	namespacezparsed args:z

exceptionzwhile parsing argsF)Ú_patch_argument_parserÚargparseÚ	Namespacer`   r	   r   r)   r[   Úparse_known_argsÚBaseExceptionÚtyper
   Úcollect_completionsÚfilter_completionsÚquote_completions)
rd   r…   rƒ   r‚   r:   Úactive_parsersÚparsed_argsÚaÚer†   r   r   r   ry   Þ   s(   ÿ"€ÿ
z!CompletionFinder._get_completionsc                    sF   g | _ g | _| ‰ ‡ ‡fdd„‰ˆ| jƒ td| j ƒ td| jƒ | j S )a¸  
        Since argparse doesn't support much introspection, we monkey-patch it to replace the parse_known_args method and
        all actions with hooks that tell us which action was last taken or about to be taken, and let us have the parser
        figure out which subparsers need to be activated (then recursively monkey-patch those).
        We save all active ArgumentParsers to extract all their possible option names later.
        c                    s”   ˆ j  | ¡ ˆ j | ¡ t| tƒrd S d}trt|ƒ}t|t| jfi ƒ| _| j	D ]}t
|dƒr0q(G ‡ ‡fdd„d|jƒ}|j|_|j|_||_q(d S )NÚ(MonkeyPatchedIntrospectiveArgumentParserÚ_orig_classc                       s   e Zd Zd‡ ‡fdd„	ZdS )zPCompletionFinder._patch_argument_parser.<locals>.patch.<locals>.IntrospectActionNc                    sÂ   t d| ƒ t d||||ƒ t d| jƒ t d| jƒ ˆ js'| j||||d� d S t| jtjƒrFt dƒ ˆ| j|d  ƒ | j||||d� d S | jtv r_| j	sTˆ j
 | ¡ | j||||d� d S d S )NzAction stub called onz	args:z	orig class:z	orig callable:)Úoption_stringz:orig class is a subparsers action: patching and running itr   )r   r›   Ú_orig_callabler`   Ú
issubclassrŽ   Ú_SubParsersActionÚ_name_parser_mapÚsafe_actionsÚoption_stringsÚvisited_positionalsr8   )rd   ÚparserrŒ   Úvaluesrœ   ©Ú	completerÚpatchr   r   r‡     s   

üzYCompletionFinder._patch_argument_parser.<locals>.patch.<locals>.IntrospectAction.__call__rS   )r+   r,   r-   r‡   r   r¦   r   r   ÚIntrospectAction  s    r©   )r£   r8   r–   r4   r   r	   r6   r’   Ú	__class__Ú_actionsÚhasattrr›   r‡   r�   )r¤   Ú	classnameÚactionr©   r¦   r   r   r¨     s    


åz6CompletionFinder._patch_argument_parser.<locals>.patchzActive parsers:zVisited positionals:)r–   r£   r[   r   ©rd   r   r¦   r   r�   ù   s   
)z'CompletionFinder._patch_argument_parserc                    sR   dd„ }|  ¡ D ]}||j|jˆ ƒ}|r|j| j|< q‡ fdd„|j ¡ D ƒ}|S )Nc                    sB   | s|r|  ˆ ¡r|S dS |  dd¡ ¡ }d ‡ fdd„|D ƒ¡S )Nr0   ú,ú c                 3   s   � | ]
}|  ˆ ¡r|V  qd S rS   rT   ©r‰   Úx©r=   r   r   Ú	<genexpr><  s   € zVCompletionFinder._get_subparser_completions.<locals>.filter_aliases.<locals>.<genexpr>)rU   ÚreplaceÚsplitr{   )ÚmetavarÚdestr=   r˜   r   r´   r   Úfilter_aliases6  s   zCCompletionFinder._get_subparser_completions.<locals>.filter_aliasesc                    s   g | ]	}|  ˆ ¡r|‘qS r   rT   )r‰   Úsubcmd©rƒ   r   r   rŠ   C  ó    z?CompletionFinder._get_subparser_completions.<locals>.<listcomp>)Ú_get_subactionsr¸   r¹   Úhelpra   ÚchoicesÚkeys)rd   r¤   rƒ   rº   r®   Úsubcmd_with_aliasesr†   r   r¼   r   Ú_get_subparser_completions5  s   €z+CompletionFinder._get_subparser_completionsc                    sz   t ˆ ƒdks| jdu r‡ fdd„|jD ƒS dd„ |jD ƒ}dd„ |jD ƒ}| jdkr0|r.|S |S | jdkr;|r9|S |S g S )	Nr   Tc                    s"   g | ]}t |ƒ ˆ ¡rt |ƒ‘qS r   ©r   rU   ©r‰   Úoptr¼   r   r   rŠ   H  ó   " z5CompletionFinder._include_options.<locals>.<listcomp>c                 S   s    g | ]}t |ƒd krt|ƒ‘qS ©é   ©r1   r   rÅ   r   r   r   rŠ   I  ó     c                 S   s    g | ]}t |ƒd krt|ƒ‘qS rÈ   rÊ   rÅ   r   r   r   rŠ   J  rË   ÚlongÚshort)r1   r\   r¢   )rd   r®   rƒ   Ú	long_optsÚ
short_optsr   r¼   r   Ú_include_optionsF  s   

z!CompletionFinder._include_optionsc                    sn   | j  ‡ fdd„|jD ƒ¡ g }|jD ]!}|jtjkr| jsq|  ||¡s&qt|tj	ƒs4||  
|ˆ ¡7 }q|S )Nc                    s2   g | ]}|j rd  ‡ fdd„|j D ƒ¡|jg‘qS )r±   c                 3   s&   � | ]}t |ƒ ˆ ¡rt |ƒV  qd S rS   rÄ   r²   r¼   r   r   rµ   S  s   €$ zFCompletionFinder._get_option_completions.<locals>.<listcomp>.<genexpr>)r¢   r{   r¿   )r‰   r®   r¼   r   r   rŠ   S  s    &þz<CompletionFinder._get_option_completions.<locals>.<listcomp>)ra   Úupdater«   r¿   rŽ   ÚSUPPRESSr_   Ú_action_allowedr4   rŸ   rÐ   )rd   r¤   rƒ   Úoption_completionsr®   r   r¼   r   Ú_get_option_completionsQ  s   
ÿÿ
€z(CompletionFinder._get_option_completionsc                 C   s(   |j  | g ¡D ]
}||jv r dS qdS ©NFT)Ú_action_conflictsrJ   Ú_seen_non_default_actions)r®   r¤   Úconflict_actionr   r   r   rÓ   a  s
   
ÿz CompletionFinder._action_allowedc                    sò  t djt|jƒ|jd�ƒ ˆoˆd |jv ‰‡fdd„|jD ƒ}|r:t|ƒdks,J dƒ‚t d|d d	ƒ i ˆ_g }nˆr>|S d
}|pD|jD ]±‰ ˆ js`tˆ ƒrPd}|s`tˆ ƒr`tˆ ƒs`t dˆ ƒ qEt dˆ ˆ j	ƒ t
ˆ dd ƒ}|d u rŒˆ jd urƒtˆ tjƒsƒt ˆ j¡}n	tˆ tjƒsŒˆj}|röt|ƒrÇ‡‡fdd„|ˆˆ |d�D ƒ}	|	rÆ||	7 }t|tjƒr»ˆj ‡ fdd„|	D ƒ¡ n6ˆj dd„ |	D ƒ¡ n*t dƒ tdƒD ]!}
| ˆ|
¡}|d u rÝ nˆ |ˆ¡rðˆj |di¡ | |¡ qÏt d|ƒ qE|S )NzActive actions (L={l}): {a})rq   r˜   r   c                    s   g | ]	}t |ˆ ƒr|‘qS r   )r   r²   )Ú
isoptionalr   r   rŠ   n  r½   z<CompletionFinder._complete_active_option.<locals>.<listcomp>r   zexpect at most 1 greedy actionzResetting completions becausezmust consume the next argumentFTÚSkippingzActivating completion forr§   c                    s   g | ]
}ˆ  |ˆ ¡r|‘qS r   )r^   ©r‰   Úc)rƒ   rd   r   r   rŠ   –  s    

þ)r=   r®   r—   c                    s   g | ]}|ˆ j g‘qS r   )r¿   r²   )Úactive_actionr   r   rŠ   ž  s    c                 S   s   g | ]}|d g‘qS )r0   r   r²   r   r   r   rŠ   ¡  r‹   zICompleter is not callable, trying the readline completer protocol insteadi'  r0   zCompletions:)r   rN   r1   Úactive_actionsÚprefix_charsra   r¢   r   r   r›   ÚgetattrrÀ   r4   rŽ   rŸ   r   ÚChoicesCompleterrb   ÚcallablerÑ   ÚrangeÚcompleter^   r8   )rd   r¤   Únext_positionalrƒ   r—   r†   Úgreedy_actionsÚcomplete_remaining_positionalsr§   Úcompletions_from_callableÚiÚnext_completionr   )rÞ   rƒ   rÚ   rd   r   Ú_complete_active_optionj  sj   

ÿÿÿ€
€
€z(CompletionFinder._complete_active_optionc                 C   s´   g }|d|ƒ |d }|d|ƒ | j s t|ƒdkr(|d |jv r(||  ||¡7 }|d|ƒ |  ¡ }|d|ƒ t|tjƒrD||  ||¡7 }|  	|||||¡}|d|ƒ |d| j
ƒ |S )	a0  
        Visits the active parsers and their actions, executes their completers or introspects them to collect their
        option strings. Returns the resulting completions as a list of strings.

        This method is exposed for overriding in subclasses; there is no need to use it directly.
        zall active parsers:éÿÿÿÿzactive_parser:r   zoptional options:znext_positional:zactive options:zdisplay completions:)r\   r1   rà   rÕ   Ú_get_next_positionalr4   rŽ   rŸ   rÃ   rì   ra   )rd   r–   r—   rƒ   r   r†   Úactive_parserræ   r   r   r   r“   ®  s"   

 

ÿ
z$CompletionFinder.collect_completionsc                 C   sz   | j d }| jd }| ¡ }|sdS ||kr|d S d}tt|ƒƒD ]
}|| |kr, nq"|d t|ƒk r;||d  S dS )z>
        Get the next positional action if it exists.
        rí   Nr   r   )r–   r£   Ú_get_positional_actionsrä   r1   )rd   rï   Úlast_positionalÚall_positionalsrê   r   r   r   rî   Ë  s   

ÿz%CompletionFinder._get_next_positionalc                    s<   dd„ |D ƒ}| j du rtƒ | _ t| j ƒ‰ ‡ fdd„|D ƒS )a  
        Ensures collected completions are Unicode text, de-duplicates them, and excludes those specified by ``exclude``.
        Returns the filtered completions as an iterable.

        This method is exposed for overriding in subclasses; there is no need to use it directly.
        c                 S   rˆ   r   )r   rÜ   r   r   r   rŠ   í  r‹   z7CompletionFinder.filter_completions.<locals>.<listcomp>Nc                    s"   g | ]}|ˆ vrˆ   |¡s|‘qS r   )ÚaddrÜ   ©Úseenr   r   rŠ   ó  rÇ   )r]   Úset)rd   r†   r   rô   r   r”   ã  s
   


z#CompletionFinder.filter_completionsc                    sÊ   d}|dkrˆr‡fdd„|D ƒ}|d7 }n|dkr|d7 }t j d¡d	kr)d}n|d
kr6d}dd„ |D ƒ}|D ]‰ ‡ fdd„|D ƒ}q8| jrcd}t|ƒdkrc|d d |vrc|dkrc|d  d7  < |S )aÄ  
        If the word under the cursor started with a quote (as indicated by a nonempty ``cword_prequote``), escapes
        occurrences of that quote character in the completions, and adds the quote to the beginning of each completion.
        Otherwise, escapes all characters that bash splits words on (``COMP_WORDBREAKS``), and removes portions of
        completions before the first colon if (``COMP_WORDBREAKS``) contains a colon.

        If there is only one completion, and it doesn't end with a **continuation character** (``/``, ``:``, or ``=``),
        adds a space after the completion.

        This method is exposed for overriding in subclasses; there is no need to use it directly.
        ú\r0   c                    s   g | ]
}|ˆ d  d… ‘qS )r   Nr   rÜ   )r:   r   r   rŠ   	  ó    z6CompletionFinder.quote_completions.<locals>.<listcomp>z();<>|&!`$* 	
"'ú"z"`$!Ú_ARGCOMPLETE_SHELLÚtcshú'c                 S   s   g | ]}|  d d¡‘qS )rü   z'\''©r¶   rÜ   r   r   r   rŠ     s    c                    s   g | ]
}|  ˆ d ˆ  ¡‘qS )r÷   rý   rÜ   )Úcharr   r   rŠ     rø   z=/:r   r   rí   r±   )r$   rI   rJ   rc   r1   )rd   r†   r‚   r:   Úspecial_charsÚcontinuation_charsr   )rþ   r:   r   r•   õ  s(   
z"CompletionFinder.quote_completionsc                    sn   |dkr)t ˆƒ\}‰ }}}| dtjd ¡ |  |ˆ ||¡}‡ ‡fdd„|D ƒ| _|t| jƒk r5| j| S dS )aã  
        Alternate entry point for using the argcomplete completer in a readline-based REPL. See also
        `rlcompleter <https://docs.python.org/2/library/rlcompleter.html#completer-objects>`_.
        Usage:

        .. code-block:: python

            import argcomplete, argparse, readline
            parser = argparse.ArgumentParser()
            ...
            completer = argcomplete.CompletionFinder(parser)
            readline.set_completer_delims("")
            readline.set_completer(completer.rl_complete)
            readline.parse_and_bind("tab: complete")
            result = input("prompt> ")

        (Use ``raw_input`` instead of ``input`` on Python 2, or use `eight <https://github.com/kislyuk/eight>`_).
        r   c                    s    g | ]}ˆ|t ˆ ƒd …  ‘qS rS   )r1   )r‰   Úmatch©rƒ   Útextr   r   rŠ   <  rË   z0CompletionFinder.rl_complete.<locals>.<listcomp>N)rR   Úinsertr!   Úargvry   Ú_rl_matchesr1   )rd   r  r5   r‚   r„   r…   Úfirst_colon_posÚmatchesr   r  r   Úrl_complete%  s   
zCompletionFinder.rl_completec                 C   s   | j S )a·  
        This function returns a mapping of option names to their help strings for displaying to the user

        Usage:

        .. code-block:: python

            def display_completions(substitution, matches, longest_match_length):
                _display_completions = argcomplete.autocomplete.get_display_completions()
                print("")
                if _display_completions:
                    help_len = [len(x) for x in _display_completions.values() if x]

                    if help_len:
                        maxlen = max([len(x) for x in _display_completions])
                        print("\n".join("{0:{2}} -- {1}".format(k, v, maxlen)
                                        for k, v in sorted(_display_completions.items())))
                    else:
                        print("    ".join(k for k in sorted(_display_completions)))
                else:
                    print(" ".join(x for x in sorted(matches)))

                import readline
                print("cli /> {0}".format(readline.get_line_buffer()), end="")
                readline.redisplay()

            ...
            readline.set_completion_display_matches_hook(display_completions)

        )ra   r¯   r   r   r   Úget_display_completionsC  s   z(CompletionFinder.get_display_completions)r+   r,   r-   Ú__doc__r   rf   r$   Ú_exitr‡   ry   r�   rÃ   rÐ   rÕ   ÚstaticmethodrÓ   rì   r“   rî   r”   r•   r	  r
  r   r   r   r   rX   f   s.    
ÿ
þb<
D0rX   c                   @   s   e Zd Zedd„ ƒZdS )ÚExclusiveCompletionFinderc                 C   s<   t  | |¡sdS tjtjf}| j|v rdS | |jvrdS dS rÖ   )rX   rÓ   rŽ   Ú_AppendActionÚ_AppendConstActionr›   rØ   )r®   r¤   Úappend_classesr   r   r   rÓ   e  s   

z)ExclusiveCompletionFinder._action_allowedN)r+   r,   r-   r  rÓ   r   r   r   r   r  d  s    r  zV Use this to access argcomplete. See :meth:`argcomplete.CompletionFinder.__call__()`. c                  G   s   t dg| ¢R dtiŽ dS )zØ
    Prints **args** to standard error when running completions. This will interrupt the user's command line interaction;
    use it to indicate an error condition that is preventing your completer from working.
    Ú
r   N)r   r   r   r   r   r   Úwarnv  s   r  rS   )5Ú
__future__r   r   r   r   r$   r!   rŽ   Ú
contextlibr0   r   r   rG   Úcompatr	   r
   r   r   r   r   Úmy_argparser   r   r   r   rI   r   r'   r   r   ÚBASH_FILE_COMPLETION_FALLBACKÚBASH_DIR_COMPLETION_FALLBACKÚ_StoreActionÚ_StoreConstActionÚ_StoreTrueActionÚ_StoreFalseActionr  r  Ú_CountActionr¡   Úcontextmanagerr&   r)   Ú	Exceptionr*   rR   rW   ÚobjectrX   r  Úautocompleter  r  r   r   r   r   Ú<module>   sF    
ú

	
.    