Viewing File: /opt/hc_python/lib/python3.12/site-packages/pip/_internal/__pycache__/exceptions.cpython-312.pyc

�

\0i�s����dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZmZddlmZmZddlmZddlmZdd	lmZmZmZdd
lmZddlmZer ddlm Z dd
l!m"Z"m#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)ejTe+�Z,ded�Z-										dfd�Z.Gd�de/�Z0Gd�de0�Z1Gd�de0�Z2Gd�de0�Z3Gd�de3�Z4Gd�de1�Z5Gd�d e1�Z6Gd!�d"e0�Z7Gd#�d$e3�Z8Gd%�d&e3�Z9Gd'�d(e3�Z:Gd)�d*e3�Z;Gd+�d,e0�Z<Gd-�d.e0�Z=Gd/�d0e0�Z>Gd1�d2e0�Z?Gd3�d4e0�Z@Gd5�d6e3�ZAGd7�d8e3�ZBGd9�d:e3�ZCGd;�d<e3�ZDGd=�d>e3�ZEGd?�d@e1e3�ZFGdA�dBe1e3�ZGGdC�dDe3�ZHGdE�dFe3�ZIGdG�dHeI�ZJGdI�dJeI�ZKGdK�dLeI�ZLGdM�dNeI�ZMGdO�dPeI�ZNGdQ�dRe3�ZOGdS�dTe2�ZPdUe	j��dV�ZRGdW�dXe1�ZSGdY�dZe1�ZTGd[�d\e1�ZUGd]�d^e1�ZVGd_�d`e1�ZWGda�dbe1�ZXGdc�dde1�ZYy)gz�Exceptions used throughout package.

This module MUST NOT try to import from anything within `pip._internal` to
operate. This is expected to be importable from any/all files within the
subpackage and, thus, should not depend on them.
�)�annotationsN)�Iterator)�chain�groupby�repeat)�
TYPE_CHECKING�Literal)�InvalidRequirement)�InvalidVersion)�Console�ConsoleOptions�RenderResult)�escape)�Text)�_Hash)�Request�Response)�BaseDistribution)�
_FileDownload)�InstallRequirementc�2�tjd|�duS)Nz^[a-z]+(-[a-z]+)*$)�re�match)�ss �G/opt/hc_python/lib/python3.12/site-packages/pip/_internal/exceptions.py�_is_kebab_caser*s��
�8�8�)�1�-�T�9�9�c���t|t�r|}n|j|�}|j|d��|jd|��d��j|j	d���zS)N�ignore)�overflow�
T)�allow_blank)�
isinstancer�
render_str�join�split)r�console�prefix�indent�texts     r�_prefix_with_indentr+.ss���!�T�����!�!�!�$�����f�x��8�7�;M�;M�
�V�H�
��<N�<�
�d�4�:�:�$�:�'�(�)�)rc��eZdZdZy)�PipErrorzThe base pip error.N��__name__�
__module__�__qualname__�__doc__�rrr-r-?s��rr-c�v��eZdZUdZded<ddddd�															d
�fd�Zdd�Z						dd	�Z�xZS)
�DiagnosticPipErrora�An error, that presents diagnostic information to the user.

    This contains a bunch of logic, to enable pretty presentation of our error
    messages. Each error gets a unique reference. Each error can also include
    additional context, a hint and/or a note -- which are presented with the
    main error message in a consistent style.

    This is adapted from the error output styling in `sphinx-theme-builder`.
    �str�	reference�errorN)�kindr7�	note_stmt�linkc�6��|�t|d�sJd��|j}t|�sJd��||_||_||_||_||_||_||_t�|�)d|jj�d|j�d��y)Nr7zerror reference not provided!z#error reference must be kebab-case!�<z: �>)
�hasattrr7rr9�message�contextr:�	hint_stmtr;�super�__init__�	__class__r/)	�selfr9r7r@rArBr:r;rEs	        �rrDzDiagnosticPipError.__init__Ps�������4��-�N�/N�N�-����I��i�(�O�*O�O�(���	�"���������"���"�����	�
���1�T�^�^�4�4�5�R����7G�q�I�Jrc
��d|jj�d|j�d|j�d|j�d|j
�d|j�d�
S)Nr=z(reference=z
, message=z
, context=z, note_stmt=z, hint_stmt=z)>)rEr/r7r@rAr:rB�rFs r�__repr__zDiagnosticPipError.__repr__nsl������'�'�(�)����*�+��|�|�&�'��|�|�&�'����*�+����*��

�	
rc#��K�|jdk(rdnd}d|�d|j�d|j�d���d��|jso|j�Gt	|j
|d|�d	�d|�d
�����t	|j|d|�d�d|�d
�����nHt	|j
|dd����n,|j
��|j�d��|j��|j�|j�d��|j�t	|j|dd����|j�t	|j|dd����|j�d��d|j����yy�w)Nr8�red�yellow�[z bold]z[/]: [bold]z[/]�u]×[/] u]│[/] )r(r)u]╰─>[/] z]   [/] u[red]×[/] z  z[magenta bold]note[/]: z      z[cyan bold]hint[/]: zLink: )	r9r7�
ascii_onlyrAr+r@r:rBr;)rFr'�options�colours    r�__rich_console__z#DiagnosticPipError.__rich_console__ys�����
�)�)�w�.��H���&����	�	�{�+�d�n�n�5E�S�I�I����!�!��|�|�'�)��L�L���v�h�g�.��v�h�h�/�	��*��L�L���v�h�l�3��v�h�h�/�	��*��L�L��(��	���,�,���|�|�'����l�l�"��>�>�%����)C��H��>�>�%�%�����0��	�
��>�>�%�%�����-��	�
��9�9� ��H��4�9�9�+�&�&�!�s�E.E0)r9zLiteral['error', 'warning']r7�
str | Noner@z
str | TextrA�str | Text | NonerBrTr:rTr;rS�return�None�rUr6)r'rrPr
rUr)	r/r0r1r2�__annotations__rDrIrR�
__classcell__�rEs@rr5r5Cs������N�
-4� $�(,��K�*�K��	K�
�K�#�
K�%�K�%�K��K�
�K�<	
�:'��:'� �:'�
�	:'rr5c��eZdZdZy)�ConfigurationErrorz"General exception in configurationNr.r3rrr\r\�s��,rr\c��eZdZdZy)�InstallationErrorz%General exception during installationNr.r3rrr^r^�s��/rr^c�4��eZdZdZ								d�fd�Z�xZS)�FailedToPrepareCandidatea
Raised when we fail to prepare a candidate (i.e. fetch and generate metadata).

    This is intentionally not a diagnostic error, since the output will be presented
    above this error, when this occurs. This should instead present information to the
    user.
    c�v��t�|�d|�d|j����||_||_||_y)NzFailed to build 'z' when )rCrD�lower�package_name�requirement_chain�failed_step)rFrcrdrerEs    �rrDz!FailedToPrepareCandidate.__init__�sB���	���,�\�N�'�+�BS�BS�BU�AV�W�X�(���!2���&��r)rcr6rdr6rer6rUrV)r/r0r1r2rDrYrZs@rr`r`�s2����'�"�'�7:�'�IL�'�	
�'�'rr`c�(��eZdZdZdZd�fd�Z�xZS)�MissingPyProjectBuildRequireszNRaised when pyproject.toml has `build-system`, but no `build-system.requires`.z'missing-pyproject-build-system-requiresc�h��t�|�dt|���td�dtd���y)N�Can not process zrThis package has an invalid pyproject.toml file.
The [build-system] table is missing the mandatory `requires` key.�;This is an issue with the package mentioned above, not pip.�+See PEP 518 for the detailed specification.�r@rAr:rB�rCrDrr)rF�packagerEs  �rrDz&MissingPyProjectBuildRequires.__init__�sA���
���&�v�g��&7�8��T��T��H�I�	�	
r)rnr6rUrV�r/r0r1r2r7rDrYrZs@rrgrg�s���X�9�I�	
�	
rrgc�(��eZdZdZdZd�fd�Z�xZS)�InvalidPyProjectBuildRequiresz>Raised when pyproject.toml an invalid `build-system.requires`.z'invalid-pyproject-build-system-requiresc�n��t�|�dt|���td|���dtd���y)NrizKThis package has an invalid `build-system.requires` key in pyproject.toml.
rjrkrlrm)rFrn�reasonrEs   �rrDz&InvalidPyProjectBuildRequires.__init__�sJ���
���&�v�g��&7�8��$�$*�8�-��T��H�I�	�	
r)rnr6rsr6rUrVrorZs@rrqrq�s���H�9�I�	
�	
rrqc�,�eZdZdZ						dd�Zdd�Zy)�NoneMetadataErrora4Raised when accessing a Distribution's "METADATA" or "PKG-INFO".

    This signifies an inconsistency, when the Distribution claims to have
    the metadata file (if not, raise ``FileNotFoundError`` instead), but is
    not actually able to produce its content. This may be due to permission
    errors.
    c� �||_||_y)z�
        :param dist: A Distribution object.
        :param metadata_name: The name of the metadata being accessed
            (can be "METADATA" or "PKG-INFO").
        N)�dist�
metadata_name)rFrwrxs   rrDzNoneMetadataError.__init__�s����	�*��rc�:�d|j�d|j��S)NzNone z" metadata found for distribution: )rxrwrHs r�__str__zNoneMetadataError.__str__
s#���t�)�)�*�*L�T�Y�Y�K�X�XrN)rwrrxr6rUrVrW�r/r0r1r2rDrzr3rrruru�s.���+��+��+�
�	+�Yrruc��eZdZdZdd�Zy)�UserInstallationInvalidzBA --user install is requested on an environment without user site.c��y)Nz$User base directory is not specifiedr3rHs rrzzUserInstallationInvalid.__str__s��5rNrW)r/r0r1r2rzr3rrr}r}s
��L�6rr}c��eZdZdd�Zy)�InvalidSchemeCombinationc�x�djd�|jddD��}d|�d|jd�d�S)N�, c3�2K�|]}t|����y�w�N)r6)�.0�as  r�	<genexpr>z3InvalidSchemeCombination.__str__.<locals>.<genexpr>s����:�>�a�3�q�6�>�s����zCannot set z and z	 together)r%�args)rF�befores  rrzz InvalidSchemeCombination.__str__s=�����:�4�9�9�S�b�>�:�:���V�H�E�$�)�)�B�-��	�B�BrNrW)r/r0r1rzr3rrr�r�s��Crr�c��eZdZdZy)�DistributionNotFoundzCRaised when a distribution cannot be found to satisfy a requirementNr.r3rrr�r�s��Mrr�c��eZdZdZy)�RequirementsFileParseErrorzDRaised when a general error occurs parsing a requirements file line.Nr.r3rrr�r�!s��Nrr�c��eZdZdZy)�BestVersionAlreadyInstalledzNRaised when the most up-to-date version of a package is already
    installed.Nr.r3rrr�r�%s��rr�c��eZdZdZy)�
BadCommandz0Raised when virtualenv or a command is not foundNr.r3rrr�r�*s��:rr�c��eZdZdZy)�CommandErrorz7Raised when there is an error in command-line argumentsNr.r3rrr�r�.s��Arr�c��eZdZdZy)�PreviousBuildDirErrorz:Raised when there's a previous conflicting build directoryNr.r3rrr�r�2s��Drr�c�@��eZdZdZ		d							d�fd�
Zdd�Z�xZS)�NetworkConnectionErrorzHTTP connection errorc����||_||_||_|j�3|js't|d�r|jj|_t�|�|||�y)zc
        Initialize NetworkConnectionError with  `request` and `response`
        objects.
        N�request)�responser��	error_msgr?rCrD)rFr�r�r�rEs    �rrDzNetworkConnectionError.__init__9sW���!��
����"����M�M�%��L�L���)�,��=�=�0�0�D�L�
����H�g�6rc�,�t|j�Sr�)r6r�rHs rrzzNetworkConnectionError.__str__Ns���4�>�>�"�"r)NN)r�r6r�zResponse | Noner�zRequest | NonerUrVrW�r/r0r1r2rDrzrYrZs@rr�r�6s>����
%)�"&�	7��7�"�7� �	7�

�7�*#rr�c��eZdZdZy)�InvalidWheelFilenamezInvalid wheel filename.Nr.r3rrr�r�Rs��!rr�c��eZdZdZy)�UnsupportedWheelzUnsupported wheel.Nr.r3rrr�r�Vs��rr�c� �eZdZdZdd�Zdd�Zy)�InvalidWheelzInvalid (e.g. corrupt) wheel.c� �||_||_yr�)�location�name)rFr�r�s   rrDzInvalidWheel.__init__]s�� ��
���	rc�<�d|j�d|j�d�S)NzWheel 'z
' located at z is invalid.)r�r�rHs rrzzInvalidWheel.__str__as�������=�����|�L�LrN)r�r6r�r6rWr{r3rrr�r�Zs��'��Mrr�c�4�eZdZdZ										dd�Zdd�Zy)�MetadataInconsistentaBuilt metadata contains inconsistent information.

    This is raised when the metadata contains values (e.g. name and version)
    that do not match the information previously obtained from sdist filename,
    user-supplied ``#egg=`` value, or an install requirement name.
    c�<�||_||_||_||_yr���ireq�field�f_val�m_val)rFr�r�r�r�s     rrDzMetadataInconsistent.__init__ms ����	���
���
���
rc�n�d|j�d|j�d|j�d|j��S)N�
Requested z has inconsistent z: expected z, but metadata has r�rHs rrzzMetadataInconsistent.__str__us=�������#5�d�j�j�\�B��
�
�~�%8�����
H�	
rN)
r�rr�r6r�r6r�r6rUrVrWr{r3rrr�r�es9����&��/2��;>��GJ��	
��
rr�c� �eZdZdZdd�Zdd�Zy)�MetadataInvalidzMetadata is invalid.c� �||_||_yr��r�r8)rFr�r8s   rrDzMetadataInvalid.__init__s����	���
rc�:�d|j�d|j��S)Nr�z has invalid metadata: r�rHs rrzzMetadataInvalid.__str__�s���D�I�I�;�&=�d�j�j�\�J�JrN)r�rr8r6rUrVrWr{r3rrr�r�|s����Krr�c�@��eZdZdZdZ								d�fd�Zdd�Z�xZS)�InstallationSubprocessErrorzA subprocess call failed.zsubprocess-exited-with-errorc�(��|�td�}nStjdt|��d��tdj|��ztjd�z}t�|�dt
|��d|��|dd�	�||_||_y)
NzNo available output.z[red][z lines of output][/]
rNz[red]\[end of output][/]z[green]z)[/] did not run successfully.
exit code: zNThis error originates from a subprocess, and is likely not a problem with pip.�r@rArBr:)	r�from_markup�lenr%rCrDr�command_description�	exit_code)rFr�r��output_lines�
output_promptrEs     �rrDz$InstallationSubprocessError.__init__�s������ �!7�8�M�� � �6�#�l�*;�)<�<R�!S�T��r�w�w�|�,�-�.��"�"�#>�?�@�
�	����&�!4�5�6�7�'�[�*�"��$�	�	
�$7�� �"��rc�8�|j�d|j��S)Nz
 exited with )r�r�rHs rrzz#InstallationSubprocessError.__str__�s���*�*�+�=����8H�I�Ir)r�r6r��intr�zlist[str] | NonerUrVrW)r/r0r1r2r7rDrzrYrZs@rr�r��s?���#�.�I�#�!�#��	#�
'�#�
�
#�@Jrr�c�4��eZdZdZ				d�fd�Zdd�Z�xZS)�MetadataGenerationFailedzmetadata-generation-failedc�>��t�|�dt|�dd��y)Nz4Encountered error while generating package metadata.zSee above for details.rjr�)rCrDr)rF�package_detailsrEs  �rrDz!MetadataGenerationFailed.__init__�s(���
	���J��?�+�.�S�		�	
rc��y)Nzmetadata generation failedr3rHs rrzz MetadataGenerationFailed.__str__�s��+r)r�r6rUrVrW)r/r0r1r7rDrzrYrZs@rr�r��s&���,�I�

��

�
�	

�,rr�c�0�eZdZdZdd�Zdd�Zd	d�Zd
d�Zy)�
HashErrorsz:Multiple HashError instances rolled into one for reportingc��g|_yr�)�errorsrHs rrDzHashErrors.__init__�s	��')��rc�:�|jj|�yr�)r��append)rFr8s  rr�zHashErrors.append�s�������5�!rc��g}|jjd���t|jd��D]8\}}|j|j�|jd�|D���:|rdj
|�Sy)Nc��|jSr�)�order��es r�<lambda>z$HashErrors.__str__.<locals>.<lambda>�s��q�w�wr)�keyc��|jSr�rZr�s rr�z$HashErrors.__str__.<locals>.<lambda>�s����rc3�<K�|]}|j����y�wr�)�body)r�r�s  rr�z%HashErrors.__str__.<locals>.<genexpr>�s����9�=�a�����=�s�r!rN)r��sortrr��head�extendr%)rF�lines�cls�
errors_of_clss    rrzzHashErrors.__str__�sr���������.��/�")�$�+�+�7L�"M��C���L�L����"��L�L�9�=�9�9�#N���9�9�U�#�#�rc�,�t|j�Sr�)�boolr�rHs r�__bool__zHashErrors.__bool__�s���D�K�K� � rN�rUrV)r8�	HashErrorrUrVrW)rUr�)r/r0r1r2rDr�rzr�r3rrr�r��s��D�*�"��!rr�c�J�eZdZUdZdZded<dZdZded<dd	�Zdd
�Z	dd�Z
y)
r�a�
    A failure to verify a package against known-good hashes

    :cvar order: An int sorting hash exception classes by difficulty of
        recovery (lower being harder), so the user doesn't bother fretting
        about unpinned packages when he has deeper issues, like VCS
        dependencies, to deal with. Also keeps error reports in a
        deterministic order.
    :cvar head: A section heading for display above potentially many
        exceptions of this kind
    :ivar req: The InstallRequirement that triggered this error. This is
        pasted on after the exception is instantiated, because it's not
        typically available earlier.

    NzInstallRequirement | None�reqrNr�r�r�c�(�d|j���S)a=Return a summary of me for display under the heading.

        This default implementation simply prints a description of the
        triggering requirement.

        :param req: The InstallRequirement that provoked this error, with
            its link already populated by the resolver's _populate_link().

        �    )�_requirement_namerHs rr�zHashError.body�s���d�,�,�.�/�0�0rc�@�|j�d|j���S)Nr!)r�r�rHs rrzzHashError.__str__�s���)�)��B�t�y�y�{�m�,�,rc�H�|jrt|j�SdS)z�Return a description of the requirement that triggered me.

        This default implementation returns long description of the req, with
        line numbers

        �unknown package)r�r6rHs rr�zHashError._requirement_name�s��!%���s�4�8�8�}�?�.?�?rrW)r/r0r1r2r�rXr�r�r�rzr�r3rrr�r��s2��� &*�C�	"�)�
�D��E�3�O�
1�-�@rr�c��eZdZdZdZdZy)�VcsHashUnsupported�uA hash was provided for a version-control-system-based requirement, but
    we don't have a method for hashing those.rzlCan't verify hashes for these requirements because we don't have a way to hash version control repositories:N�r/r0r1r2r�r�r3rrr�r�s��1�
�E�	;�	rr�c��eZdZdZdZdZy)�DirectoryUrlHashUnsupportedr��zUCan't verify hashes for these file:// requirements because they point to directories:Nr�r3rrr�r�s��1�
�E�	 �	rr�c�(�eZdZdZdZdZdd�Zdd�Zy)	�HashMissingz2A hash was needed for a requirement but is absent.�awHashes are required in --require-hashes mode, but they are missing from some requirements. Here is a list of those requirements along with the hashes their downloaded archives actually had. Add lines like these to your requirements files to prevent tampering. (If you did not enable --require-hashes manually, note that it turns on automatically when any package has a hash.)c��||_y)zq
        :param gotten_hash: The hash of the (possibly malicious) archive we
            just downloaded
        N)�gotten_hash)rFr�s  rrDzHashMissing.__init__,s��
'��rc���ddlm}d}|jrC|jjr|jjnt|jdd�}dj
|xsd||j�S)Nr)�
FAVORITE_HASHr�z    {} --hash={}:{}r�)�pip._internal.utils.hashesr�r��	is_direct�
original_link�getattr�formatr�)rFr�rns   rr�zHashMissing.body3sn��<����8�8��8�8�%�%����&�&��T�X�X�u�d�3�
�%�+�+��(�(�-��9I�9I�
�	
rN)r�r6rUrVrW)r/r0r1r2r�r�rDr�r3rrr�r�s��<�
�E�	�	�'�
rr�c��eZdZdZdZdZy)�HashUnpinnedzPA requirement had a hash specified but was not pinned to a specific
    version.�zaIn --require-hashes mode, all requirements must have their versions pinned with ==. These do not:Nr�r3rrrrHs���
�E�	1�	rrc�0�eZdZdZdZdZdd�Zd	d�Zd	d�Zy)
�HashMismatchz�
    Distribution file hash values don't match.

    :ivar package_name: The name of the package that triggered the hash
        mismatch. Feel free to write to this after the exception is raise to
        improve its error message.

    �z�THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.c� �||_||_y)z�
        :param allowed: A dict of algorithm names pointing to lists of allowed
            hex digests
        :param gots: A dict of algorithm names pointing to hashes we
            actually got from the files under suspicion
        N)�allowed�gots)rFrrs   rrDzHashMismatch.__init__es�������	rc�J�d|j��d|j���S)Nr��:
)r��_hash_comparisonrHs rr�zHashMismatch.bodyos)���d�,�,�.�/�s�4�3H�3H�3J�2K�L�Lrc���dd�}g}|jj�D]W\}}||��|j�fd�|D��|jd|j|j��d���Ydj
|�S)aE
        Return a comparison of actual and expected hash values.

        Example::

               Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde
                            or 123451234512345123451234512345123451234512345
                    Got        bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef

        c�.�t|gtd��S)Nz    or)rr)�	hash_names r�hash_then_orz3HashMismatch._hash_comparison.<locals>.hash_then_or~s���)��f�X�&6�7�7rc3�@�K�|]}dt���d|�����y�w)z        Expected � N)�next)r�r�r(s  �rr�z0HashMismatch._hash_comparison.<locals>.<genexpr>�s$�����U�9�a�-�d�6�l�^�1�Q�C�@�9�s�z             Got        r!)r
r6rUz
chain[str])r�itemsr�r�r�	hexdigestr%)rFrr�r
�	expectedsr(s     @rr
zHashMismatch._hash_comparisonrs����	8�
��$(�L�L�$6�$6�$8� �I�y�!�)�,�F��L�L�U�9�U�U��L�L�*�4�9�9�Y�+?�+I�+I�+K�*L�B�O�
�%9��y�y���rN)rzdict[str, list[str]]rzdict[str, _Hash]rUrVrW)	r/r0r1r2r�r�rDr�r
r3rrrrSs(���
�E�	/�	��M� rrc��eZdZdZy)�UnsupportedPythonVersionzMUnsupported python version according to Requires-Python package
    metadata.Nr.r3rrrr�s��rrc�B��eZdZdZ			d							d�fd�
Zdd�Z�xZS)�!ConfigurationFileCouldNotBeLoadedz8When there are errors while loading a configuration filec�N��t�|�|�||_||_||_yr�)rCrDrs�fnamer8)rFrsrr8rEs    �rrDz*ConfigurationFileCouldNotBeLoaded.__init__�s'���	����������
���
rc��|j�d|j�d�}n|j�J�d|j�d�}d|j�|��S)Nz in �.z.
r!zConfiguration file )rr8rs)rF�message_parts  rrzz)ConfigurationFileCouldNotBeLoaded.__str__�sU���:�:�!�!�$�*�*��Q�/�L��:�:�)�)�)� �����B�/�L�$�T�[�[�M�,��@�@r)zcould not be loadedNN)rsr6rrSr8zconfigparser.Error | NonerUrVrWr�rZs@rrr�sB���B�,� �+/�		��	��	�)�		�

�	�ArrzThe Python environment under z� is managed externally, and may not be
manipulated by the user. Please use specific tooling from the distributor of
the Python installation to interact with this environment instead.
c�T��eZdZdZdZd�fd�Zedd��Ze				dd��Z	�xZ
S)	�ExternallyManagedEnvironmentaPThe current environment is externally managed.

    This is raised when the current environment is externally managed, as
    defined by `PEP 668`_. The ``EXTERNALLY-MANAGED`` configuration is checked
    and displayed when the error is bubbled up to the user.

    :param error: The error message read from ``EXTERNALLY-MANAGED``.
    zexternally-managed-environmentc�x��|�tt�}nt|�}t�|�
d|dtd���y)Nz&This environment is externally managedz�If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.z+See PEP 668 for the detailed specification.rl)r�!_DEFAULT_EXTERNALLY_MANAGED_ERRORrCrD)rFr8rArEs   �rrDz%ExternallyManagedEnvironment.__init__�sE����=��<�=�G��5�k�G�
���<��J�
�H�I�	�
	
rc#��K�	tj}tj|�\}}|�-d|����dD]!}|j	|�\}}}|s�d|�����#d��y#t$rd}Y�AwxYw�w)NzError-)�-�_�Error)�locale�LC_MESSAGES�	getlocale�AttributeError�	partition)�category�langr$�sepr��founds      r�#_iter_externally_managed_error_keysz@ExternallyManagedEnvironment._iter_externally_managed_error_keys�s�����	1��)�)�H��&�&�x�0�G�D�!����4�&�/�!�!��#'�>�>�#�#6� ���q����v�h�'�'�	"�
�
���	$�#�D�	$�s(�A1�A �AA1� A.�+A1�-A.�.A1c���tjd��}	|j|d��|d}|j�D]1}t	j
t�5|||�cddd�cS	|d�S#1swY�FxYw#t$rY�tttjf$r6ddl
m}tj|�}tjd||��Y�qwxYw)	N)�
interpolationzutf-8)�encodingzexternally-managedr)�VERBOSEzFailed to read %s)�exc_info)�configparser�ConfigParser�readr/�
contextlib�suppress�KeyError�OSError�UnicodeDecodeError�ParsingError�pip._internal.utils._logr3�logger�isEnabledFor�warning)r��config�parser�sectionr�r3r4s       r�from_configz(ExternallyManagedEnvironment.from_config�s���
�*�*��>��	K��K�K���K�1��1�2�G��>�>�@���(�(��2��w�s�|�,�3�2�A��4�y��3�2���	���+�\�-F�-F�G�	K�8��*�*�7�3�H��N�N�.���N�J�		K�s7�AB	�A=�'B	�3B	�=B	�B	�		C'�AC'�&C')r8rSrUrV)rUz
Iterator[str])rBzpathlib.Path | strrUr)r/r0r1r2r7rD�staticmethodr/�classmethodrErYrZs@rrr�sN����1�I�
�"����*��"��
&���rrc�$��eZdZdZd�fd�Z�xZS)�UninstallMissingRecordzuninstall-no-record-filec���|j}|r|dk(r7|j�d|j��}tjdd|��df�}ntd|�d��}t
�|�td|���d	|j�d
�|��y)N�pipz==z,You might be able to recover from this via: z(pip install --force-reinstall --no-deps �greenzThe package was installed by z3. You should check if it can uninstall the package.�Cannot uninstall zAThe package's contents are unknown: no RECORD file was found for r�r@rArB)�	installer�raw_name�versionr�assemblerCrD)rF�distributionrO�dep�hintrEs     �rrDzUninstallMissingRecord.__init__�s���� �*�*�	��I��.�!�*�*�+�2�l�.B�.B�-C�D�C��=�=�>�;�C�5�A�7�K��D�
�/�	�{�;D�D��D�
	����,�\�N�;�<�0�0<�0E�0E�/F�a�I��
	�	
r�rSrrUrV�r/r0r1r7rDrYrZs@rrIrI�s���*�I�
�
rrIc�$��eZdZdZd�fd�Z�xZS)�LegacyDistutilsInstallz%uninstall-distutils-installed-packagec�B��t�|�td|���dd��y)NrMz�It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.rN)rCrDr)rFrSrEs  �rrDzLegacyDistutilsInstall.__init__s/���
����,�\�N�;�<���	�	
rrVrWrZs@rrYrYs���7�I�	
�	
rrYc�0��eZdZdZ						d�fd�Z�xZS)�InvalidInstalledPackagezinvalid-installed-packagec
����|j}t|t�rd}nd}t�|�td|�d�|rd|�d�ndzd|�d|jd	��z�d
|�d�d�
�y)N�requirementrQz!Cannot process installed package rzin rNzbecause it has an invalid r	rz.Starting with pip 24.1, packages with invalid zs can not be processed.z,To proceed this package must be uninstalled.rN)�installed_locationr#r
rCrDrr�)rFrw�invalid_excr_�invalid_typerEs     �rrDz InvalidInstalledPackage.__init__&s����"�4�4���k�#5�6�(�L�$�L�
����3�D�6��;�4F�S�+�.�a�0�B�P�.�|�n�C��@P�@P�QR�@S�?T�U�V��A��.� 7�9�E�	�	
r)rwrr`z#InvalidRequirement | InvalidVersionrUrVrWrZs@rr\r\#s0���+�I�
��
�9�	
�

�
�
rr\c�(��eZdZdZdZd�fd�Z�xZS)�IncompleteDownloadErrorzaRaised when the downloader receives fewer bytes than advertised
    in the Content-Length header.zincomplete-downloadc�@��ddlm}|j�J�||j��d||j���}|jrd|jdz�d�}d}nd}d	}td
|�d|�d��}t�|�|d
|jj��|d��y)Nr)�format_size�/zafter r�z
 attempts z7Use --resume-retries to configure resume attempt limit.rNz>Consider using --resume-retries to enable download resumption.zDownload failed z(because not enough bytes were received (�)zURL: z4This is an issue with network connectivity, not pip.r�)
�pip._internal.utils.miscre�size�bytes_received�
reattemptsrrCrDr;�redacted_url)rF�downloadre�download_status�retry_statusrUr@rEs       �rrDz IncompleteDownloadError.__init__Gs����8��}�}�(�(�(��8�2�2�3�4�A�k�(�-�-�6P�5Q�R�	����#�H�$7�$7�!�$;�#<�J�G�L�L�D��L�S�D���|�n�-�-�.�a�
1�
��
	�����H�M�M�6�6�7�8��L�		�	
r)rmrrUrVrorZs@rrcrcAs���%�&�I�
�
rrcc�(��eZdZdZdZd�fd�Z�xZS)�ResolutionTooDeepErrorzHRaised when the dependency resolver exceeds the maximum recursion depth.zresolution-too-deepc�,��t�|�dddd��y)Nz,Dependency resolution exceeded maximum depthzpPip cannot resolve the current dependencies as the dependency graph is too complex for pip to solve efficiently.zqTry adding lower bounds to constrain your dependencies, for example: 'package>=2.0.0' instead of just 'package'. z_https://pip.pypa.io/en/stable/topics/dependency-resolution/#handling-resolution-too-deep-errors)r@rArBr;)rCrD)rFrEs �rrDzResolutionTooDeepError.__init__hs)���
���B�?�L�s�	�	
rr�rorZs@rrqrqcs���R�%�I�
�
rrqc�$��eZdZdZd�fd�Z�xZS)�InstallWheelBuildErrorzfailed-wheel-build-for-installc�V��t�|�ddjd�|D��d��y)NzIFailed to build installable wheels for some pyproject.toml based projectsr�c3�4K�|]}|j���y�wr�)r�)r��rs  rr�z2InstallWheelBuildError.__init__.<locals>.<genexpr>�s����5�f��a�f�f�f�s�rN)rCrDr%)rF�failedrEs  �rrDzInstallWheelBuildError.__init__zs1���
���0��I�I�5�f�5�5��
	�	
r)rxzlist[InstallRequirement]rUrVrWrZs@rrtrtws���0�I�
�
rrt)rr6rUr�)
rz
Text | strr'rr(r6r)r6rUr)Zr2�
__future__rr5r8r&�logging�pathlibr�sys�collections.abcr�	itertoolsrrr�typingrr	�"pip._vendor.packaging.requirementsr
�pip._vendor.packaging.versionr�pip._vendor.rich.consolerr
r�pip._vendor.rich.markupr�pip._vendor.rich.textr�hashlibr�pip._vendor.requests.modelsrr�pip._internal.metadatar�pip._internal.network.downloadr�pip._internal.req.req_installr�	getLoggerr/r?rr+�	Exceptionr-r5r\r^r`rgrqrur}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr(r!rrIrYr\rcrqrtr3rr�<module>r�s����#���
���	�
�$�,�,�)�A�8�J�J�*�&���=�7�<�@�	��	�	�8�	$��:�)��)�
�)�
�	)�

�)�
�
)�"�y��p'��p'�l-��-�0��0�'�0�'�"
�$6�
�"
�$6�
�"Y��Y�86�/�6�C�0�C�N�,�N�O�!2�O��(��
;��;�B�8�B�E�H�E�#�X�#�8"�,�"��(��M�$�M�
�,�
�.K�'�K�&J�"4�6G�&J�R,�1�3D�,�&!�"�!�.+@�!�+@�\����)��'
�)�'
�T�9��7 �9�7 �t�0��
A�(:�A�.)�!�j�j�\�*�%�!�F�#5�F�R
�/�
�6
�/�
�
�0�
�<
�0�
�D
�/�
�(
�/�
r
Back to Directory File Manager