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/utils/__pycache__/misc.cpython-39.pyc
a

?�f�n�@sddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZddlmZddlmZddlmZddlmZmZdd	lmZmZmZmZmZdd
l m!Z"ddl#m$Z%ddl&m'Z'dd
l(m)Z)ddl*m+Z+m,Z,m-Z-m.Z.ddl/m0Z0m1Z1m2Z2m3Z3ddl4m5Z5m6Z6ddl7m8Z8m9Z9e�r`ddlm:Z;nddlm;Z;e5�r�ddl<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHddlImJZJeFeKeKeKfZLeGd�ZMgd�ZNe�OeP�ZQdd�ZRdd�ZSdd�ZTdd�ZUed d!d"�d�d$d%��ZVd&d'�ZWd(d)�ZXd*d+�ZYd�d-d.�ZZd/d0�Z[d1d2�Z\d3d4�Z]d5d6�Z^d7d8�Z_d9d:�Z`d;d<�Zad=d>�Zbejcfd?d@�Zdd�dBdC�ZedDdE�ZfdFdG�ZgdHdI�ZhdJdK�ZidLdM�ZjdNdO�ZkdPdQ�ZldRdS�ZmdAe2dAd#d#dfdTdU�ZndVdW�ZodXdY�ZpdZd[�Zqd\d]�Zrd^d_�ZsGd`da�daet�ZuGdbdc�dce;�Zvejwddde��Zxdfdg�Zydhdi�Zzd�djdk�Z{dldm�Z|dndo�Z}dpdq�Z~d�dsdt�Zdudv�Z�dwdx�Z�dydz�Z�d{d|�Z�d}d~�Z�dd��Z�d�d��Z�d�d��Z�d�d��Z�Gd�d��d�et�Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d�d��Z�d�d��Z�d�d��Z�d�d��Z�dS)��)�absolute_importN��deque)�tee)�
pkg_resources)�canonicalize_name)�retry)�PY2�	text_type)�filter�filterfalse�input�map�zip_longest)�parse)�unquote)�__version__)�CommandError)�distutils_scheme�get_major_minor_version�
site_packages�	user_site)�WINDOWS�
expanduser�stdlib_pkgs�str_to_display)�MYPY_CHECK_RUNNING�cast)�running_under_virtualenv�virtualenv_no_global)�BytesIO)�StringIO)�Any�AnyStr�Callable�	Container�Iterable�Iterator�List�Optional�Text�Tuple�TypeVar�Union)�Distribution�T)�rmtree�display_path�
backup_dir�ask�splitext�format_size�is_installable_dir�normalize_path�renames�get_prog�captured_stdout�
ensure_dir�get_installed_version�remove_auth_from_urlcCs4tj�tj�t�dd�}tj�|�}d�t|t��S)Nz..zpip {} from {} (python {}))	�os�path�join�dirname�__file__�abspath�formatrr)Zpip_pkg_dir�rE�</usr/lib/python3.9/site-packages/pip/_internal/utils/misc.py�get_pip_versionOs��rGcCsDt|�dkr"|dt|�d7}nt|�dkr:|dd�}td|�S)ax
    Convert a tuple of ints representing a Python version to one of length
    three.

    :param py_version_info: a tuple of ints representing a Python version,
        or None to specify no version. The tuple can have any length.

    :return: a tuple of length three if `py_version_info` is non-None.
        Otherwise, return `py_version_info` unchanged (i.e. None).
    �)rN�VersionInfo)�lenr)Zpy_version_inforErErF�normalize_version_info[s
rKc
CsRzt�|�Wn>tyL}z&|jtjkr8|jtjkr8�WYd}~n
d}~00dS)z os.path.makedirs without EEXIST.N)r>�makedirs�OSError�errnoZEEXISTZ	ENOTEMPTY)r?�erErErFr;os
r;c
CsPz2tj�tjd�}|dvr*d�tj�WS|WSWnttt	fyJYn0dS)Nr)z__main__.pyz-cz	{} -m pip�pip)
r>r?�basename�sys�argvrD�
executable�AttributeError�	TypeError�
IndexError)�progrErErFr9zs
r9i�i�)Zstop_max_delayZ
wait_fixedFcCstj||td�dS)N)�
ignore_errors�onerror)�shutilr0�rmtree_errorhandler)�dirrYrErErFr0�s�r0c	CsVzt�|�jtj@}Wnttfy0YdS0|rPt�|tj�||�dS�dS)z�On Windows, the files in .svn are read-only, so when rmtree() tries to
    remove them, an exception is thrown.  We catch that here, remove the
    read-only attribute, and hopefully continue without problems.N)r>�stat�st_mode�S_IWRITE�IOErrorrM�chmod)�funcr?�exc_infoZhas_attr_readonlyrErErFr\�sr\cCsb|durdSt|t�r|Sz|�t��d�}Wn.ty\trPtd�|��}nt	|�}Yn0|S)z�
    Convert a bytes (or text) path to text (unicode in Python 2) for display
    and logging purposes.

    This function should never error out. Also, this function is mainly needed
    for Python 2 since in Python 3 str paths are already text.
    N�strictzb{!r})
�
isinstancer
�decoderR�getfilesystemencoding�UnicodeDecodeErrorr	rrD�ascii)r?r1rErErF�path_to_display�s	
rkcCsttj�tj�|��}tjddkrB|�t��d�}|�t�	�d�}|�
t��tjj�rpd|t
t���d�}|S)zTGives the display value for a given path, making it relative to cwd
    if possible.r��replace�.N)r>r?�normcaserCrR�version_inforgrh�encode�getdefaultencoding�
startswith�getcwd�seprJ�r?rErErFr1�sr1�.bakcCs6d}|}tj�||�r.|d7}|t|�}q||S)z\Figure out the name of a directory to back up the given dir to
    (adding .bak, .bak2, etc)�)r>r?�exists�str)r]�ext�n�	extensionrErErFr2�sr2cCs2tj�dd���D]}||vr|Sqt||�S)NZPIP_EXISTS_ACTION�)r>�environ�get�splitr3)�message�options�actionrErErF�ask_path_exists�s
r�cCstj�d�rtd�|���dS)z&Raise an error if no input is allowed.ZPIP_NO_INPUTz7No input was expected ($PIP_NO_INPUT set); question: {}N)r>rr��	ExceptionrD�r�rErErF�_check_no_input�s��r�cCsFt|�t|�}|����}||vr<td�|d�|���q|SqdS)z@Ask the message interactively, with the given possible responsesz>Your response ({!r}) was not one of the expected responses: {}z, N)r�r
�strip�lower�printrDr@)r�r�ZresponserErErFr3�s
��r3cCst|�t|�S)zAsk for input interactively.)r�r
r�rErErF�	ask_inputsr�cCst|�t�|�S)z!Ask for a password interactively.)r��getpassr�rErErF�ask_passwordsr�cCs\|dkrd�|dd�S|dkr4d�t|d��S|dkrJd�|d�Sd�t|��SdS)	Ni@Bz	{:.1f} MBg@�@i�i'z{} kBz	{:.1f} kBz{} bytes)rD�int)�bytesrErErFr5sr5cs@dd�|D�}dd�t|ddi�D���fdd�|D�}|�fS)z�Return a list of formatted rows and a list of column sizes.

    For example::

    >>> tabulate([['foobar', 2000], [0xdeadbeef]])
    (['foobar     2000', '3735928559'], [10, 4])
    cSsg|]}ttt|���qSrE)�tuplerrz��.0�rowrErErF�
<listcomp>#�ztabulate.<locals>.<listcomp>cSsg|]}ttt|���qSrE)�maxrrJ)r��colrErErFr�$r��	fillvaluer~cs$g|]}d�ttj|������qS)� )r@rrz�ljust�rstripr��ZsizesrErFr�%r�)r)Zrows�tablerEr�rF�tabulates	r�cCsPtj�|�sdStj�|d�}tj�|�r.dStj�|d�}tj�|�rLdSdS)zBIs path is a directory containing setup.py or pyproject.toml?
    Fzsetup.pyTzpyproject.toml)r>r?�isdirr@�isfile)r?Zsetup_pyZpyproject_tomlrErErFr6)sr6ccs|�|�}|sq|VqdS)z7Yield pieces of data from a file-like object until EOF.N)�read)�file�size�chunkrErErF�read_chunks8s
r�TcCs2t|�}|rtj�|�}ntj�|�}tj�|�S)zN
    Convert a path to its canonical, case-normalized, absolute version.

    )rr>r?�realpathrCro)r?Zresolve_symlinksrErErFr7As
r7cCs@t�|�\}}|���d�r8|dd�|}|dd�}||fS)z,Like os.path.splitext, but take off .tar tooz.tar���N)�	posixpathr4r��endswith)r?�baser{rErErFr4Os
r4cCsxtj�|�\}}|r.|r.tj�|�s.t�|�t�||�tj�|�\}}|rt|rtzt�|�WntyrYn0dS)z7Like os.renames(), but handles renaming across devices.N)	r>r?r�ryrLr[Zmove�
removedirsrM)�old�new�head�tailrErErFr8Ys
r8cCst�s
dS|�ttj��S)z�
    Return True if path is within sys.prefix, if we're running in a virtualenv.

    If we're not in a virtualenv, all paths are considered "local."

    Caution: this function assumes the head of path has been normalized
    with normalize_path.
    T)rrsr7rR�prefixrvrErErF�is_localks
r�cCstt|��S)z�
    Return True if given Distribution object is installed locally
    (i.e. within current virtualenv).

    Always True if we're not in a virtualenv.

    )r��
dist_location��distrErErF�
dist_is_localzs	r�cCst|��tt��S)zF
    Return True if given Distribution is installed in user site.
    )r�rsr7rr�rErErF�dist_in_usersite�sr�cCst|��tt��S)z[
    Return True if given Distribution is installed in
    sysconfig.get_python_lib().
    )r�rsr7rr�rErErF�dist_in_site_packages�sr�cCs,tt|��}|�ttd�d�d�d��S)zf
    Return True if given Distribution is installed in
    path matching distutils_scheme layout.
    r~ZpurelibZpythonr)r7r�rsrr�)r�Z	norm_pathrErErF�dist_in_install_path�s�r�cCs6tjD]*}tj�||jd�}tj�|�rdSqdS)zC
    Return True if given Distribution is an editable install.
    �	.egg-linkTF)rRr?r>r@�project_namer�)r�Z	path_item�egg_linkrErErF�dist_is_editable�s

r�cs�|rt�|�}ntj}|r t�ndd��|r6dd��ndd��|rLdd��ndd��|r^t�nd	d
�������fdd�|D�S)
a^
    Return a list of installed Distribution objects.

    If ``local_only`` is True (default), only return installations
    local to the current virtualenv, if in a virtualenv.

    ``skip`` argument is an iterable of lower-case project names to
    ignore; defaults to stdlib_pkgs

    If ``include_editables`` is False, don't report editables.

    If ``editables_only`` is True , only report editables.

    If ``user_only`` is True , only report installations in the user
    site directory.

    If ``paths`` is set, only report the distributions present at the
    specified list of locations.
    cSsdS�NTrE��drErErF�
local_test�sz/get_installed_distributions.<locals>.local_testcSsdSr�rEr�rErErF�
editable_test�sz2get_installed_distributions.<locals>.editable_testcSs
t|�S�N�r�r�rErErFr��scSst|�Sr�r�r�rErErF�editables_only_test�sz8get_installed_distributions.<locals>.editables_only_testcSsdSr�rEr�rErErFr��scSsdSr�rEr�rErErF�	user_test�sz.get_installed_distributions.<locals>.user_testcs:g|]2}�|�r|j�vr�|�r�|�r�|�r|�qSrE)�key)r�r��r�r�r��skipr�rErFr��s
�z/get_installed_distributions.<locals>.<listcomp>)r�
WorkingSet�working_setr�r�)�
local_onlyr��include_editables�editables_only�	user_only�pathsr�rEr�rF�get_installed_distributions�s 

r�cCs4t|�}tddddddd�}dd�|D�}|�|�S)z�Find a distribution matching the ``req_name`` in the environment.

    This searches from *all* distributions available in the environment, to
    match the behavior of ``pkg_resources.get_distribution()``.
    FrETN)r�r�r�r�r�r�cSsi|]}t|j�|�qSrE)rr�)r��prErErF�
<dictcomp>r�z(_search_distribution.<locals>.<dictcomp>)rr�r�)�req_nameZpackagesZpkg_dictrErErF�_search_distribution�s
�r�cCs<t|�}|s4ztj�|�Wntjy2YdS0t|�S)z�Given a requirement name, return the installed Distribution object.

    This searches from *all* distributions available in the environment, to
    match the behavior of ``pkg_resources.get_distribution()``.
    N)r�rr�ZrequireZDistributionNotFound)r�r�rErErF�get_distributions	r�cCsxg}t�r*|�t�t�sBtrB|�t�ntr8|�t�|�t�|D],}tj�||j�d}tj�	|�rF|SqFdS)a
    Return the path for the .egg-link file if it exists, otherwise, None.

    There's 3 scenarios:
    1) not in a virtualenv
       try to find in site.USER_SITE, then site_packages
    2) in a no-global virtualenv
       try to find in site_packages
    3) in a yes-global virtualenv
       try to find in site_packages, then site.USER_SITE
       (don't look in global location)

    For #1 and #3, there could be odd cases, where there's an egg-link in 2
    locations.

    This method will just return the first one found.
    r�N)
r�appendrrrr>r?r@r�r�)r�ZsitesZsiteZegglinkrErErF�
egg_link_path$s




r�cCst|�}|rt|�St|j�S)aO
    Get the site-packages location of this distribution. Generally
    this is dist.location, except in the case of develop-installed
    packages, where dist.location is the source code location, and we
    want to know where the egg-link file is.

    The returned location is normalized (in particular, with symlinks removed).
    )r�r7�location)r�r�rErErFr�Hs
r�cGstj|g|�R�dSr�)�logger�info)�msg�argsrErErF�write_outputXsr�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�FakeFilezQWrap a list of lines in an object with readline() to make
    ConfigParser happy.cCst|�|_dSr�)�iter�_gen)�self�linesrErErF�__init__`szFakeFile.__init__cCs&zt|j�WSty YdS0dS)Nr~)�nextr��
StopIteration�r�rErErF�readlinecszFakeFile.readlinecCs|jSr�)r�r�rErErF�__iter__iszFakeFile.__iter__N)�__name__�
__module__�__qualname__�__doc__r�r�r�rErErErFr�]sr�c@s$eZdZedd��Zedd��ZdS)�
StreamWrappercCs||_|�Sr�)�orig_stream)�clsr�rErErF�from_streamoszStreamWrapper.from_streamcCs|jjSr�)r��encodingr�rErErFr�uszStreamWrapper.encodingN)r�r�r��classmethodr��propertyr�rErErErFr�ms
r�c
csLtt|�}tt|t�|��ztt|�VWtt||�ntt||�0dS)z�Return a context manager used by captured_stdout/stdin/stderr
    that temporarily replaces the sys stream *stream_name* with a StringIO.

    Taken from Lib/support/__init__.py in the CPython repo.
    N)�getattrrR�setattrr�r�)Zstream_nameZorig_stdoutrErErF�captured_outputzs

r�cCstd�S)z�Capture the output of sys.stdout:

       with captured_stdout() as stdout:
           print('hello')
       self.assertEqual(stdout.getvalue(), 'hello
')

    Taken from Lib/support/__init__.py in the CPython repo.
    �stdout�r�rErErErFr:�s	r:cCstd�S)z 
    See captured_stdout().
    �stderrr�rErErErF�captured_stderr�sr�cCs4tj�|�}|durt��}|�|�}|r0|jSdS)zCGet the installed version of dist_name avoiding pkg_resources cacheN)rZRequirementrr��find�version)Z	dist_namer�Zreqr�rErErFr<�s

r<cCst|dd�dS)zConsume an iterable at C speed.r)�maxlenNr)�iteratorrErErF�consume�srcOsDtt|tt|���fi|��}dd�|��D�}||d<tdd|�S)NcSsi|]\}}||�qSrErE)r�r��valuerErErFr��r�zenum.<locals>.<dictcomp>Zreverse_mapping�EnumrE)�dict�zip�rangerJ�items�type)Z
sequentialZnamedZenums�reverserErErF�enum�sr	cCs*|dur|Sd|vrd�|�}d�||�S)z.
    Build a netloc from a host-port pair
    N�:�[{}]z{}:{})rD)�host�portrErErF�build_netloc�s

r�httpscCs4|�d�dkr(d|vr(d|vr(d�|�}d�||�S)z)
    Build a full URL from a netloc.
    r
rl�@�[rz{}://{})�countrD)�netloc�schemerErErF�build_url_from_netloc�s
rcCst|�}t�|�}|j|jfS)z2
    Return the host-port pair from a netloc.
    )r�urllib_parse�urlparse�hostnamer
)r�url�parsedrErErF�parse_netloc�s
rcCsXd|vr|dfS|�dd�\}}d|vr6|�dd�}n|df}tdd�|D��}||fS)zp
    Parse out and remove the auth information from a netloc.

    Returns: (netloc, (username, password)).
    r)NNrxr
Ncss"|]}|durdnt|�VqdSr�)�urllib_unquote)r��xrErErF�	<genexpr>�sz)split_auth_from_netloc.<locals>.<genexpr>)�rsplitr�r�)r�authZ	user_passrErErF�split_auth_from_netloc�s�r!cCsLt|�\}\}}|dur|S|dur.d}d}nt�|�}d}dj|||d�S)z�
    Replace the sensitive data in a netloc with "****", if it exists.

    For example:
        - "user:pass@example.com" returns "user:****@example.com"
        - "accesstoken@example.com" returns "****@example.com"
    N�****r~z:****z{user}{password}@{netloc})�user�passwordr)r!r�quoterD)rr#r$rErErF�
redact_netloc�s	
�r&cCs@t�|�}||j�}|j|d|j|j|jf}t�|�}||fS)aRTransform and replace netloc in a url.

    transform_netloc is a function taking the netloc and returning a
    tuple. The first element of this tuple is the new netloc. The
    entire tuple is returned.

    Returns a tuple containing the transformed url as item 0 and the
    original tuple returned by transform_netloc as item 1.
    r)r�urlsplitrrr?�query�fragment�
urlunsplit)rZtransform_netlocZpurlZnetloc_tupleZ
url_piecesZsurlrErErF�_transform_urls


�
r+cCst|�Sr�)r!�rrErErF�_get_netloc$sr-cCs
t|�fSr�)r&r,rErErF�_redact_netloc(sr.cCst|t�\}\}}|||fS)z�
    Parse a url into separate netloc, auth, and url with no auth.

    Returns: (url_without_auth, netloc, (username, password))
    �r+r-)rZurl_without_authrr rErErF�split_auth_netloc_from_url,sr0cCst|t�dS)z7Return a copy of url with 'username:password@' removed.rr/�rrErErFr=7sr=cCst|t�dS)z.Replace the password in a given url with ****.r)r+r.r1rErErF�redact_auth_from_url?sr2c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�
HiddenTextcCs||_||_dSr�)�secret�redacted)r�r4r5rErErFr�FszHiddenText.__init__cCsd�t|��S)Nz<HiddenText {!r}>)rDrzr�rErErF�__repr__OszHiddenText.__repr__cCs|jSr��r5r�rErErF�__str__SszHiddenText.__str__cCs t|�t|�krdS|j|jkS)NF)rr4�r��otherrErErF�__eq__XszHiddenText.__eq__cCs
||kSr�rEr9rErErF�__ne__cszHiddenText.__ne__N)r�r�r�r�r6r8r;r<rErErErFr3Es
	r3cCst|dd�S)Nr"r7)r3)rrErErF�
hide_valuehsr=cCst|�}t||d�S)Nr7)r2r3)rr5rErErF�hide_urlmsr>cCszdd�tjd�djtjdd��g}|oBtoBtj�tjd�|v}|rvtjddgtjd	d�}t	d
�d�
|����dS)z�Protection of pip.exe from modification on Windows

    On Windows, any operation modifying pip should be run as:
        python -m pip ...
    zpip.exez	pip{}.exerzpip{}.{}.exeNrlz-mrPrxz3To modify pip, please run the following command:
{}r�)rDrRrprr>r?rQrSrTrr@)Z
modifying_pipZ	pip_namesZshould_show_use_python_msgZnew_commandrErErF�(protect_pip_from_modification_on_windowsss&�������r?cCstjduotj��S)z!Is this console interactive?
    N)rR�stdin�isattyrErErErF�is_console_interactive�srB�cCsft��}d}t|d��8}t||d�D]}|t|�7}|�|�q$Wd�n1sT0Y||fS)z:Return (hash, length) for path using hashlib.sha256()
    r�rb)r�N)�hashlibZsha256�openr�rJ�update)r?Z	blocksize�hZlength�f�blockrErErF�	hash_file�s*rKcCs&zddl}Wnty YdS0dS)z8
    Return whether the wheel package is installed.
    rNFT)�wheel�ImportError)rLrErErF�is_wheel_installed�s
rNcCst|�}t||�S)zb
    Return paired elements.

    For example:
        s -> (s0, s1), (s2, s3), (s4, s5), ...
    )r�r)�iterablerErErF�pairwise�srPcCs t|�\}}t||�t||�fS)z�
    Use a predicate to partition entries into false entries and true entries,
    like

        partition(is_odd, range(10)) --> 0 2 4 6 8   and  1 3 5 7 9
    )rrr)ZpredrO�t1�t2rErErF�	partition�srS)F)rw)T)N)r)rC)�Z
__future__r�
contextlibrNr�rE�ioZloggingr>r�r[r^rR�collectionsr�	itertoolsrZpip._vendorrZpip._vendor.packaging.utilsrZpip._vendor.retryingrZpip._vendor.sixr	r
Zpip._vendor.six.movesrrr
rrZpip._vendor.six.moves.urllibrrZ"pip._vendor.six.moves.urllib.parserrrPrZpip._internal.exceptionsrZpip._internal.locationsrrrrZpip._internal.utils.compatrrrrZpip._internal.utils.typingrrZpip._internal.utils.virtualenvrrr r!�typingr"r#r$r%r&r'r(r)r*r+r,r-Zpip._vendor.pkg_resourcesr.r�rIr/�__all__Z	getLoggerr�r�rGrKr;r9r0r\rkr1r2r�r�r3r�r�r5r�r6�DEFAULT_BUFFER_SIZEr�r7r4r8r�r�r�r�r�r�r�r�r�r�r�r��objectr�r��contextmanagerr�r:r�r<rr	rrrr!r&r+r-r.r0r=r2r3r=r>r?rBrKrNrPrSrErErErF�<module>s�8	

"

	

	

�
D$




#