§
    öyIfÓ  ã                   óJ  — U d Z ddlZddlmZ ddlZddlZddlmZ ddlmZ ddlmZ  G d„ d¦  «        Z	ej
                             d	¦  «        rE	 ddlZn# e$ r  ej        d
¦  «         Y nw xY w e	¦   «         Zee	         ed<   dej        ddfd„ZdS dej        ddfd„ZdZdS )a»  Allow bash-completion for argparse with argcomplete if installed.

Needs argcomplete>=0.5.6 for python 3.2/3.3 (older versions fail
to find the magic string, so _ARGCOMPLETE env. var is never set, and
this does not need special code).

Function try_argcomplete(parser) should be called directly before
the call to ArgumentParser.parse_args().

The filescompleter is what you normally would use on the positional
arguments specification, in order to get "dirname/" after "dirn<TAB>"
instead of the default "dirname ":

   optparser.add_argument(Config._file_or_dir, nargs='*').completer=filescompleter

Other, application specific, completers should go in the file
doing the add_argument calls as they need to be specified as .completer
attributes as well. (If argcomplete is not installed, the function the
attribute points to will not be used).

SPEEDUP
=======

The generic argcomplete script for bash-completion
(/etc/bash_completion.d/python-argcomplete.sh)
uses a python program to determine startup script generated by pip.
You can speed up completion somewhat by changing this script to include
  # PYTHON_ARGCOMPLETE_OK
so the python-argcomplete-check-easy-install-script does not
need to be called to find the entry point of the code and see if that is
marked  with PYTHON_ARGCOMPLETE_OK.

INSTALL/DEBUGGING
=================

To include this support in another application that has setup.py generated
scripts:

- Add the line:
    # PYTHON_ARGCOMPLETE_OK
  near the top of the main python entry point.

- Include in the file calling parse_args():
    from _argcomplete import try_argcomplete, filescompleter
  Call try_argcomplete just before parse_args(), and optionally add
  filescompleter to the positional arguments' add_argument().

If things do not work right away:

- Switch on argcomplete debugging with (also helpful when doing custom
  completers):
    export _ARC_DEBUG=1

- Run:
    python-argcomplete-check-easy-install-script $(which appname)
    echo $?
  will echo 0 if the magic line has been found, 1 if not.

- Sometimes it helps to find early on errors using:
    _ARGCOMPLETE=1 _ARC_DEBUG=1 appname
  which should throw a KeyError: 'COMPLINE' (which is properly set by the
  global argcomplete script).
é    N)Úglob)ÚAny)ÚList)ÚOptionalc                   óD   — e Zd ZdZd
deddfd„Zdededee         fd	„Z	dS )ÚFastFilesCompleterzFast file completer class.TÚdirectoriesÚreturnNc                 ó   — || _         d S ©N)r	   )Úselfr	   s     úH/var/www/piapp/venv/lib/python3.11/site-packages/_pytest/_argcomplete.pyÚ__init__zFastFilesCompleter.__init__M   s   € Ø&ˆÔÐÐó    ÚprefixÚkwargsc                 ó0  — t           j        |dd …         v r:t          t           j                             |¦  «        t           j        z   ¦  «        }nd}g }g }d|vrFd|vrB|r|d         t           j        k    r%|                     t          |dz   ¦  «        ¦  «         |dz  }|                     t          |¦  «        ¦  «         t          |¦  «        D ]C}t           j                             |¦  «        r|dz  }| 	                    ||d …         ¦  «         ŒD|S )Né   r   Ú*ú?éÿÿÿÿz.*ú/)
ÚosÚsepÚlenÚpathÚdirnameÚextendr   ÚsortedÚisdirÚappend)r   r   r   Ú
prefix_dirÚ
completionÚglobbedÚxs          r   Ú__call__zFastFilesCompleter.__call__P   s  € åŒ6�V˜A˜B˜B”ZÐÐÝ�RœWŸ_š_¨VÑ4Ô4µr´vÑ=Ñ>Ô>ˆJˆJàˆJØˆ
ØˆØ�fÐÐ ¨FÐ!2Ð!2àð 4˜V BœZ­2¬6Ò1Ð1Ø—’�t F¨T¡MÑ2Ô2Ñ3Ô3Ð3Ø�c‰MˆFØ�Š•t˜F‘|”|Ñ$Ô$Ð$Ý˜‘”ð 	.ð 	.ˆAÝŒw�}Š}˜QÑÔð Ø�S‘�à×Ò˜a 
  œnÑ-Ô-Ð-Ð-ØÐr   )T)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úboolr   Ústrr   r   r&   © r   r   r   r   J   sn   € € € € € Ø$Ð$ð'ð ' Dð '°Dð 'ð 'ð 'ð 'ð˜sð ¨cð °d¸3´ið ð ð ð ð ð r   r   Ú_ARGCOMPLETEr   ÚfilescompleterÚparserr
   c                 ó2   — t          j        | d¬¦  «         d S )NF)Úalways_complete_options)ÚargcompleteÚautocomplete©r0   s    r   Útry_argcompleter6   m   s   € ÝÔ  ÀÐGÑGÔGÐGÐGÐGr   c                 ó   — d S r   r-   r5   s    r   r6   r6   r   s   € Øˆr   )r*   Úargparser   r   ÚsysÚtypingr   r   r   r   ÚenvironÚgetÚargcomplete.completersr3   ÚImportErrorÚexitr/   Ú__annotations__ÚArgumentParserr6   r-   r   r   ú<module>rB      s‚  ðð>ð >ð >ð@ €€€Ø Ð Ð Ð Ð Ð Ø 	€	€	€	Ø 
€
€
€
Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ðð ð ð ð ñ ô ð ð8 „:‡>‚>�.Ñ!Ô!ð ðØ%Ð%Ð%Ð%Ð%øØð ð ð ØˆŒ�‰Œˆˆˆðøøøà3EÐ3EÑ3GÔ3G€N�HÐ/Ô0ÐGÐGÑGðH Ô 7ð H¸Dð Hð Hð Hð Hð Hð Hð
 Ô 7ð ¸Dð ð ð ð ð €N€N€Ns   ÁA ÁA-Á,A-