HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/pip/_internal/cli/__pycache__/parser.cpython-310.pyc
o

��h�*�@s�dZddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZddlmZddlmZmZdd	lmZmZe�e�ZGd
d�dej�ZGdd
�d
e�ZGdd�dej�ZGdd�de�ZdS)zBase option parser setup�)�annotationsN)�	Generator)�suppress)�Any�NoReturn)�
UNKNOWN_ERROR)�
Configuration�ConfigurationError)�redact_auth_from_url�	strtoboolcsleZdZdZd%�fdd�Zd&dd
�Z	d'd(dd�Zd)dd�Zd*dd�Zd+dd�Z	d,dd �Z
d-d#d$�Z�ZS).�PrettyHelpFormatterz4A prettier/less verbose help formatter for optparse.�argsr�kwargs�return�Nonecs:d|d<d|d<t��dd|d<t�j|i|��dS)N��max_help_position��indent_incrementr��width)�shutil�get_terminal_size�super�__init__)�selfr
r��	__class__��C/usr/local/lib/python3.10/dist-packages/pip/_internal/cli/parser.pyrszPrettyHelpFormatter.__init__�option�optparse.Option�strcCs
|�|�S�N)�_format_option_strings)rr rrr�format_option_stringss
z)PrettyHelpFormatter.format_option_strings� <{}>�, �mvarfmt�optsepcCs�g}|jr
|�|jd�|jr|�|jd�t|�dkr$|�d|�|��rA|jdus/J�|jp6|j��}|�|�	|����d�
|�S)z�
        Return a comma-separated list of option strings and metavars.

        :param option:  tuple of (short opt, long opt), e.g: ('-f', '--format')
        :param mvarfmt: metavar format string
        :param optsep:  separator
        rrN�)�_short_opts�append�
_long_opts�len�insert�takes_value�dest�metavar�lower�format�join)rr r(r)�optsr2rrrr$"s

z*PrettyHelpFormatter._format_option_strings�headingcCs|dkrdS|dS)N�Optionsr*�:
r)rr7rrr�format_heading<sz"PrettyHelpFormatter.format_heading�usagecCsd�|�t�|�d��}|S)zz
        Ensure there is only one newline between usage and the first heading
        if there is no description.
        z
Usage: {}
�  )r4�indent_lines�textwrap�dedent)rr;�msgrrr�format_usageAsz PrettyHelpFormatter.format_usage�description�
str | NonecCsV|r)t|jd�rd}nd}|�d�}|��}|�t�|�d�}|�d|�d�}|SdS)N�main�Commands�Description�
r<r9r*)�hasattr�parser�lstrip�rstripr=r>r?)rrB�labelrrr�format_descriptionIs
z&PrettyHelpFormatter.format_description�epilogcCs|r|SdS)Nr*r)rrNrrr�
format_epilog[sz!PrettyHelpFormatter.format_epilog�text�indentcs"�fdd�|�d�D�}d�|�S)Ncsg|]}�|�qSrr)�.0�line�rQrr�
<listcomp>csz4PrettyHelpFormatter.indent_lines.<locals>.<listcomp>rG)�splitr5)rrPrQ�	new_linesrrTrr=bs
z PrettyHelpFormatter.indent_lines)r
rrrrr�r r!rr")r&r')r r!r(r"r)r"rr")r7r"rr")r;r"rr")rBrCrr")rNrCrr")rPr"rQr"rr")
�__name__�
__module__�__qualname__�__doc__rr%r$r:rArMrOr=�
__classcell__rrrrrs
�



rcs"eZdZdZd�fdd�Z�ZS)	�UpdatingDefaultsHelpFormatterz�Custom help formatter for use in ConfigOptionParser.

    This is updates the defaults before expanding them, allowing
    them to show up correctly in the help listing.

    Also redact auth from url type options
    r r!rr"cs�d}|jdur&t|jt�sJ�|j�|jj�|jdusJ�|jj�|j�}t��|�}|rO|j	dkrOt|t
�r;|g}t|t�sBg}|D]
}|�|t
|��}qD|S)N�URL)rI�
isinstance�ConfigOptionParser�_update_defaults�defaultsr1�getr�expand_defaultr2r"�list�replacer
)rr �default_values�	help_text�valrrrreps


z,UpdatingDefaultsHelpFormatter.expand_defaultrX)rYrZr[r\rer]rrrrr^gsr^c@s$eZdZddd	�Zeddd��Zd
S)�CustomOptionParser�idx�intr
rrr�optparse.OptionGroupcOs,|j|i|��}|j��|j�||�|S)z*Insert an OptionGroup at a given position.)�add_option_group�
option_groups�popr/)rrlr
r�grouprrr�insert_option_group�s
z&CustomOptionParser.insert_option_group�list[optparse.Option]cCs*|jdd�}|jD]}|�|j�q
|S)z<Get a list of all options, including those in option groups.N)�option_listrp�extend)r�res�irrr�option_list_all�s
z"CustomOptionParser.option_list_allN)rlrmr
rrrrrn)rrt)rYrZr[rs�propertyryrrrrrk�s
rkcsZeZdZdZdd�d#�fd
d�Zd$dd�Zd%dd�Zd&dd�Zd'dd�Zd(d!d"�Z	�Z
S))razsCustom option parser which updates its defaults by checking the
    configuration files and environmental variablesF)�isolatedr
r�namer"r{�boolrrrcs0||_t|�|_|js
J�t�j|i|��dSr#)r|r�configrr)rr|r{r
rrrrr�s

zConfigOptionParser.__init__r r!�keyrjc
CsPz|�||�WStjy'}ztd|���t�d�WYd}~dSd}~ww)Nz(An error occurred during configuration: �)�check_value�optparse�OptionValueError�print�sys�exit)rr rrj�excrrr�
check_default�s��z ConfigOptionParser.check_default�&Generator[tuple[str, Any], None, None]c	cs��d|jdg}dd�|D�}|j��D]7\}}|��D]"\}}|s(t�d|�q|�dd�\}}||vr=||�||f�q|D]	}||EdHq@qdS)N�globalz:env:cSsi|]}|g�qSrr)rRr|rrr�
<dictcomp>�s�zGConfigOptionParser._get_ordered_configuration_items.<locals>.<dictcomp>z6Ignoring configuration key '%s' as its value is empty.�.r)r|r~�items�logger�debugrVr,)	r�override_order�
section_items�_�value�section_keyrj�sectionrrrr� _get_ordered_configuration_items�s*������z3ConfigOptionParser._get_ordered_configuration_itemsrc�dict[str, Any]c
s�t��j��_t�}���D]�\�}��d����durq�jdus%J��jdvrEzt	|�}Wn�t
yD��|�d��d��Yn�w�jdkr�tt
��t	|�}Wd�n1s]wYtt
��t
|�}Wd�n1suwYt|t
�r�|dkr���|�d��d��nR�jd	kr�|��}���fd
d�|D�}n=�jdkrڈjdus�J�|��j����}��||�}�jp�d
}�jp�i}�j�||�g|�Ri|��n����|�}||�j<q|D]
�t�j��|�<q�d�_|S)z�Updates the given defaults with values from the config files and
        the environ. Does a little special handling for certain types of
        options (lists).z--N)�
store_true�store_falsez is not a valid value for zO option, please specify a boolean value like yes/no, true/false or 1/0 instead.�countrz� option, please instead specify either a non-negative integer or a boolean value like yes/no or false/true which is equivalent to 1/0.r,csg|]	}����|��qSr)r�)rR�v�rr rrrrU�sz7ConfigOptionParser._update_defaults.<locals>.<listcomp>�callbackr)r��Valuesrc�values�setr��
get_optionr1�actionr�
ValueError�errorrrmr`rVr��add�get_opt_string�
convert_value�
callback_args�callback_kwargsr��getattr)rrc�	late_evalrj�opt_strr
rrr�rrb�sX
��


�

���



 z#ConfigOptionParser._update_defaults�optparse.Valuesc
Cs�|js	t�|j�Sz|j��Wnty*}z|�tt	|��WYd}~nd}~ww|�
|j���}|��D]!}|j
dus@J�|�|j
�}t|t	�rX|��}|�||�||j
<q7t�|�S)z�Overriding to make updating the defaults after instantiation of
        the option parser possible, _update_defaults() does the dirty work.N)�process_default_valuesr�r�rcr~�loadr	r�rr"rb�copy�_get_all_optionsr1rdr`r�r�)r�errrcr �defaultr�rrr�get_default_valuess"��
�
z%ConfigOptionParser.get_default_valuesr@rcCs"|�tj�|�t|�d��dS)NrG)�print_usager��stderrr�r)rr@rrrr�(szConfigOptionParser.error)
r
rr|r"r{r}rrrr)r r!rr"rjrrr)rr�)rcr�rr�)rr�)r@r"rr)rYrZr[r\rr�r�rbr�r�r]rrrrra�s�



@ra) r\�
__future__r�loggingr�rr�r>�collections.abcr�
contextlibr�typingrr�pip._internal.cli.status_codesr�pip._internal.configurationrr	�pip._internal.utils.miscr
r�	getLoggerrYr��IndentedHelpFormatterrr^�OptionParserrkrarrrr�<module>s$
R