HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/autocompletion.cpython-39.pyc
a

?�f��@s�dZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
ddlmZddl
mZerxddlmZmZmZmZd	d
�Zdd�Zd
d�ZdS)zBLogic that powers autocompletion installed by ``pip completion``.
�N)�chain)�create_main_parser)�
commands_dict�create_command)�get_installed_distributions)�MYPY_CHECK_RUNNING)�Any�Iterable�List�Optionalcs�dtjvrdStjd��dd�}ttjd�}z||d�WntyXd�Yn0t�}tt�}g}d}|D]}||vrt|}q�qt|du�r&|dkr�t�	d�|dvo���
d	�}|�r*g}���}	td
d�D].}
|
j
�
|	�r�|
j
|dd�vr�|�|
j
�q�|�r*|D]}
t|
��qt�	d�t|�}|jjD]8}|jtjk�r:|j|jD]}
|�|
|jf��qX�q:dd
�|d|d�D���fdd
�|D�}�fdd
�|D�}t|||jj�}|�r�t�|�}dd
�|D�}|D]>}|d}|d�r|ddd�dk�r|d7}t|��q�n�dd
�|jD�}|�|j�t�|�}��
d	��r�|D]$}|jtjk�r\||j|j7}�q\n t|||�}|�r�tt�|��}td��fdd
�|D���t�	d�dS)z?Entry Point for completion of main and subcommand options.
    ZPIP_AUTO_COMPLETENZ
COMP_WORDS�Z
COMP_CWORD��help)ZshowZ	uninstall�-T)Z
local_onlycSsg|]}|�d�d�qS)�=r)�split��.0�x�r�D/usr/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py�
<listcomp>H�z autocomplete.<locals>.<listcomp>cs g|]\}}|�vr||f�qSrr)rr�v)�	prev_optsrrrIrcs"g|]\}}|���r||f�qSr��
startswith)r�kr��currentrrrKrcSsg|]}|df�qS)rr)r�pathrrrrTrr�z--rcSsg|]
}|j�qSr)�option_list)r�irrrr^r� csg|]}|���r|�qSrrrrrrrmr) �os�environr�int�
IndexErrorr�listr�sys�exitr�lowerr�key�append�printr�parserZoption_list_allr�optparse�
SUPPRESS_HELPZ
_long_optsZ_short_opts�nargs�get_path_completion_type�auto_complete_pathsZ
option_groupsr"r�
from_iterable�join)�cwords�cwordr0Zsubcommands�optionsZsubcommand_nameZwordZshould_list_installedZ	installedZlcZdistZ
subcommand�optZopt_str�completion_type�pathsZoptionZ	opt_label�optsZflattened_optsr)rrr�autocompletes�




�

�
 
��r?cCs�|dks||d�d�sdS|D]n}|jtjkr4q"t|��d�D]L}||d�d�d|krB|jr�tdd�|j�d�D��rB|jSqBq"dS)	aLGet the type of path completion (``file``, ``dir``, ``path`` or None)

    :param cwords: same as the environmental variable ``COMP_WORDS``
    :param cword: same as the environmental variable ``COMP_CWORD``
    :param opts: The available options to check
    :return: path completion type (``file``, ``dir``, ``path`` or None)
    r!rN�/rrcss|]}|dvVqdS))r �file�dirNrrrrr�	<genexpr>�s�z+get_path_completion_type.<locals>.<genexpr>)rrr1r2�strr�metavar�any)r8r9r>r;�orrrr4qs	
�r4c#s�tj�|�\}�tj�|�}t�|tj�s.dStj�����fdd�t�|�D�}|D]`}tj�||�}tj�tj�||��}|dkr�tj�	|�r�|VqVtj�
|�rVtj�|d�VqVdS)aoIf ``completion_type`` is ``file`` or ``path``, list all regular files
    and directories starting with ``current``; otherwise only list directories
    starting with ``current``.

    :param current: The word to be completed
    :param completion_type: path completion type(`file`, `path` or `dir`)i
    :return: A generator of regular files and/or directories
    Nc3s$|]}tj�|����r|VqdS)N)r%r �normcaserr��filenamerrrC�s�z&auto_complete_paths.<locals>.<genexpr>rBr
)r%r r�abspath�access�R_OKrH�listdirr7�isfile�isdir)rr<Z	directoryZcurrent_pathZ	file_list�fr;Z	comp_filerrIrr5�s
r5)�__doc__r1r%r*�	itertoolsrZpip._internal.cli.main_parserrZpip._internal.commandsrrZpip._internal.utils.miscrZpip._internal.utils.typingr�typingrr	r
rr?r4r5rrrr�<module>s_