
    5>qj                       d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZmZ ddlmZmZmZ ddlmZmZ ddlmZ ddlmZ dd	lmZmZmZ dd
lmZ ddl m!Z! er.ddl"m#Z# ddl$m%Z% ddl&m'Z'm(Z(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1  ejd                  e3      Z4d{dZ5	 	 	 	 	 	 	 	 	 	 d|dZ6 G d de7      Z8 G d de8      Z9 G d de8      Z: G d de8      Z; G d de;      Z< G d d e9      Z= G d! d"e9      Z> G d# d$e8      Z? G d% d&e;      Z@ G d' d(e;      ZA G d) d*e;      ZB G d+ d,e;      ZC G d- d.e8      ZD G d/ d0e8      ZE G d1 d2e8      ZF G d3 d4e8      ZG G d5 d6e8      ZH G d7 d8e9      ZI G d9 d:e9      ZJ G d; d<e9      ZK G d= d>e9      ZL G d? d@e9      ZM G dA dBe;      ZN G dC dDe;      ZO G dE dFe;      ZP G dG dHe;      ZQ G dI dJeQ      ZR G dK dLe;      ZS G dM dNe9e;      ZT G dO dPe9e;      ZU G dQ dRe;      ZV G dS dTe;      ZW G dU dVeW      ZX G dW dXeW      ZY G dY dZeW      ZZ G d[ d\eW      Z[ G d] d^eW      Z\ G d_ d`e;      Z] G da dbe:      Z^dce
j                   ddZ` G de dfe9      Za G dg dhe9      Zb G di dje9      Zc G dk dle9      Zd G dm dne9      Ze G do dpe9      Zf G dq dre9      Zg G ds dte9      Zh G du dve9      Zi G dw dxe9      Zj G dy dze9      Zky)}zExceptions 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)IterableIterator)chaingroupbyrepeat)TYPE_CHECKINGLiteral)InvalidRequirement)InvalidVersion)ConsoleConsoleOptionsRenderResult)escape)Text)_Hash)urllib3)PreparedRequestRequestResponse)BaseDistribution)Link)_FileDownload)InstallRequirementc                2    t        j                  d|       d uS )Nz^[a-z]+(-[a-z]+)*$)rematch)ss    W/opt/rentech/trading_bot/.venv/lib/python3.12/site-packages/pip/_internal/exceptions.py_is_kebab_caser    .   s    88)1-T99    c                   t        | t              r| }n|j                  |       }|j                  |d      |j                  d| d      j                  |j	                  d            z   S )Nignore)overflow
T)allow_blank)
isinstancer   
render_strjoinsplit)r   consoleprefixindenttexts        r   _prefix_with_indentr/   2   ss     !T!!!$fx87;M;M
VH <N <
d4::$:'() )r!   c                      e Zd ZdZy)PipErrorzThe base pip error.N__name__
__module____qualname____doc__ r!   r   r1   r1   C   s    r!   r1   c                  v     e Zd ZU dZded<   ddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d
 fdZddZ	 	 	 	 	 	 dd	Z xZS )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)kindr;   	note_stmtlinkc               6   |t        | d      sJ d       | j                  }t        |      sJ d       || _        || _        || _        || _        || _        || _        || _        t        | )  d| j                  j                   d| j                   d       y )Nr;   zerror reference not provided!z#error reference must be kebab-case!<z: >)hasattrr;   r    r=   messagecontextr>   	hint_stmtr?   super__init__	__class__r3   )	selfr=   r;   rD   rE   rF   r>   r?   rI   s	           r   rH   zDiagnosticPipError.__init__T   s     4-N/NN-Ii(O*OO(	"""	1T^^445R7GqIJr!   c                    d| j                   j                   d| j                  d| j                  d| j                  d| j
                  d| j                  dS )NrA   z(reference=z
, message=z
, context=z, note_stmt=z, hint_stmt=z)>)rI   r3   r;   rD   rE   r>   rF   rJ   s    r   __repr__zDiagnosticPipError.__repr__r   sl    ''( )* +||& '||& '* +*	
r!   c              #    K   | j                   dk(  rdnd}d| d| j                    d| j                   d d |j                  so| j                  Gt	        | j
                  |d| d	d| d
       t	        | j                  |d| dd| d       nHt	        | j
                  |dd       n,| j
                   | j                  d | j                   | j                  | j                  d | j                  t	        | j                  |dd       | j                  t	        | j                  |dd       | j                  d d| j                    y y w)Nr<   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[/]: zLink: )	r=   r;   
ascii_onlyrE   r/   rD   r>   rF   r?   )rJ   r+   optionscolours       r   __rich_console__z#DiagnosticPipError.__rich_console__}   s    
 ))w.H&		{+dnn5ESII!!||')LLvhg.vhh/	  *LLvhl3vhh/	  *LL(	  ,,||'ll">>%)CH>>%%0	  >>%%-	  99 H499+&& !s   E.E0)r=   zLiteral['error', 'warning']r;   
str | NonerD   z
str | TextrE   str | Text | NonerF   rX   r>   rX   r?   rW   returnNonerY   r:   )r+   r   rT   r   rY   r   )	r3   r4   r5   r6   __annotations__rH   rM   rV   __classcell__rI   s   @r   r9   r9   G   s     N
 -4 $ (,K *K 	K
 K #K %K %K K 
K<	
:':'  :' 
	:'r!   r9   c                      e Zd ZdZy)ConfigurationErrorz"General exception in configurationNr2   r7   r!   r   r`   r`      s    ,r!   r`   c                      e Zd ZdZy)InstallationErrorz%General exception during installationNr2   r7   r!   r   rb   rb      s    /r!   rb   c                  4     e Zd ZdZ	 	 	 	 	 	 	 	 d fdZ xZS )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 )NzFailed to build 'z' when )rG   rH   lowerpackage_namerequirement_chainfailed_step)rJ   rg   rh   ri   rI   s       r   rH   z!FailedToPrepareCandidate.__init__   sB     	,\N'+BSBSBUAVWX(!2&r!   )rg   r:   rh   r:   ri   r:   rY   rZ   )r3   r4   r5   r6   rH   r]   r^   s   @r   rd   rd      s2    '"'7:'IL'	' 'r!   rd   c                  (     e Zd ZdZdZd fdZ xZS )MissingPyProjectBuildRequireszNRaised when pyproject.toml has `build-system`, but no `build-system.requires`.z'missing-pyproject-build-system-requiresc               h    t         |   dt        |       t        d      dt        d             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.rD   rE   r>   rF   rG   rH   r   r   )rJ   packagerI   s     r   rH   z&MissingPyProjectBuildRequires.__init__   sA    &vg&78T THI 	 	
r!   )rr   r:   rY   rZ   r3   r4   r5   r6   r;   rH   r]   r^   s   @r   rk   rk      s    X9I	
 	
r!   rk   c                  (     e Zd ZdZdZd fdZ xZS )InvalidPyProjectBuildRequiresz>Raised when pyproject.toml an invalid `build-system.requires`.z'invalid-pyproject-build-system-requiresc               n    t         |   dt        |       t        d|       dt        d             y )Nrm   zKThis package has an invalid `build-system.requires` key in pyproject.toml.
rn   ro   rp   rq   )rJ   rr   reasonrI   s      r   rH   z&InvalidPyProjectBuildRequires.__init__   sJ    &vg&78$$*8- THI 	 	
r!   )rr   r:   rw   r:   rY   rZ   rs   r^   s   @r   ru   ru      s    H9I	
 	
r!   ru   c                  ,    e Zd ZdZ	 	 	 	 	 	 ddZddZy)NoneMetadataErrora4  Raised 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)rJ   r{   r|   s      r   rH   zNoneMetadataError.__init__  s     	*r!   c                :    d| j                    d| j                   S )NzNone z" metadata found for distribution: )r|   r{   rL   s    r   __str__zNoneMetadataError.__str__  s#     t))**LTYYKXXr!   N)r{   r   r|   r:   rY   rZ   r[   r3   r4   r5   r6   rH   r~   r7   r!   r   ry   ry      s.    ++ + 
	+Yr!   ry   c                      e Zd ZdZddZy)UserInstallationInvalidzBA --user install is requested on an environment without user site.c                     y)Nz$User base directory is not specifiedr7   rL   s    r   r~   zUserInstallationInvalid.__str__  s    5r!   Nr[   r3   r4   r5   r6   r~   r7   r!   r   r   r     s
    L6r!   r   c                      e Zd ZddZy)InvalidSchemeCombinationc                x    dj                  d | j                  d d D              }d| d| j                  d    dS )N, c              3  2   K   | ]  }t        |        y wN)r:   ).0as     r   	<genexpr>z3InvalidSchemeCombination.__str__.<locals>.<genexpr>  s     :a3q6:s   zCannot set z and z	 together)r)   args)rJ   befores     r   r~   z InvalidSchemeCombination.__str__  s=    :499Sb>::VHE$))B-	BBr!   Nr[   )r3   r4   r5   r~   r7   r!   r   r   r     s    Cr!   r   c                      e Zd ZdZy)DistributionNotFoundzCRaised when a distribution cannot be found to satisfy a requirementNr2   r7   r!   r   r   r   !  s    Mr!   r   c                      e Zd ZdZy)RequirementsFileParseErrorzDRaised when a general error occurs parsing a requirements file line.Nr2   r7   r!   r   r   r   %  s    Nr!   r   c                      e Zd ZdZy)BestVersionAlreadyInstalledzNRaised when the most up-to-date version of a package is already
    installed.Nr2   r7   r!   r   r   r   )  s    r!   r   c                      e Zd ZdZy)
BadCommandz0Raised when virtualenv or a command is not foundNr2   r7   r!   r   r   r   .  s    :r!   r   c                      e Zd ZdZy)CommandErrorz7Raised when there is an error in command-line argumentsNr2   r7   r!   r   r   r   2  s    Ar!   r   c                      e Zd ZdZy)PreviousBuildDirErrorz:Raised when there's a previous conflicting build directoryNr2   r7   r!   r   r   r   6  s    Dr!   r   c                  @     e Zd ZdZ	 	 d	 	 	 	 	 	 	 d fdZddZ xZS )NetworkConnectionErrorzHTTP connection errorc                    || _         || _        || _        | j                   3| j                  s't        |d      r| j                   j                  | _        t        |   |||       y)zc
        Initialize NetworkConnectionError with  `request` and `response`
        objects.
        Nrequest)responser   	error_msgrC   rG   rH   )rJ   r   r   r   rI   s       r   rH   zNetworkConnectionError.__init__=  sW     !"MM%LL),==00DLHg6r!   c                ,    t        | j                        S r   )r:   r   rL   s    r   r~   zNetworkConnectionError.__str__R  s    4>>""r!   )NN)r   r:   r   zResponse | Noner   z Request | PreparedRequest | NonerY   rZ   r[   r3   r4   r5   r6   rH   r~   r]   r^   s   @r   r   r   :  s>    
 %)48	77 "7 2	7
 
7*#r!   r   c                  $     e Zd ZdZd fdZ xZS )ConnectionFailedErrorzconnection-failedc                   ddl m} ddlm}m}m} t        |      }t        ||      r*|j                  dd      }	t        |	      dk(  rmd|	d   z   }ndt        ||      r'|j                  d	d      }	t        |	      dk(  r7|	\  }
}n1t        ||      r%	 |j                  d   }t        ||t        f      rd
}	 t        | 9  dt        |       dt        |       t!        |      dt        |       d       y # t        $ r Y Lw xY w)Nr   )RemoteDisconnected)NameResolutionErrorNewConnectionErrorProtocolErrorzFailed to resolve    )maxsplit   z!Failed to resolve IP address for z&Failed to establish a new connection: z:the connection was closed without a reply from the server.zFailed to connect to [magenta][/] while fetching z\Are you connected to the Internet? If so, check whether your system can connect to [magenta]z[[/] before trying again. There may be a firewall or proxy that's preventing the connection.rD   rE   rF   )http.clientr   pip._vendor.urllib3.exceptionsr   r   r   r:   r'   r*   lenr   ConnectionResetError
IndexErrorrG   rH   r   r   )rJ   urlhostr<   r   r   r   r   detailsparts_rw   rI   s               r   rH   zConnectionFailedError.__init__Y  s#   2	
 	
 e*e01MM"6MCE5zQ=aH12MM"JUVMWE5zQ"
7}-A f'9;O&PQT  	0>Q#;-! M++1$<. 9UU 	 	
  s   C8 8	DD)r   r:   r   r:   r<   	ExceptionrY   rZ   r3   r4   r5   r;   rH   r]   r^   s   @r   r   r   V  s    #I(
 (
r!   r   c                  8     e Zd ZdZ	 	 	 	 	 	 	 	 	 	 d fdZ xZS )ConnectionTimeoutErrorzconnection-timeoutc                   t        j                  |dfd| d      }|dk(  r|j                  d       t        |   dt        |       |d       y )	Nmagentaz didn't respond within z secondsconnectz" (while establishing a connection)zUnable to fetch zThis is probably a temporary issue with the remote server or the network connection. If this error persists, check the network configuration. There may be a firewall or proxy that's preventing the connection.r   )r   assembleappendrG   rH   r   )rJ   r   r   r=   timeoutrE   rI   s         r   rH   zConnectionTimeoutError.__init__  sf     --9!8	J
 9NN?@&vc{m4"	 	 		
r!   )
r   r:   r   r:   r=   zLiteral['connect', 'read']r   floatrY   rZ   r   r^   s   @r   r   r     sB    $I

 

 )
 
 

 
r!   r   c                  $     e Zd ZdZd fdZ xZS )SSLMissingErrorzssl-missingc                B    t         |   dt        |       dd        y )Nz,Failed to establish a secure connection for z;The 'ssl' module is unavailable but required for HTTPS URLsr   rG   rH   r   )rJ   r   rI   s     r   rH   zSSLMissingError.__init__  s)    B6#;-PQ 	 	
r!   )r   r:   rY   rZ   r   r^   s   @r   r   r     s    I
 
r!   r   c                  $     e Zd ZdZd fdZ xZS )SSLVerificationErrorzssl-verification-failedc                    dt        |       dt        |       }d}t        | 	  |t        t	        |            |       y )Nz4Failed to establish a secure connection to [magenta]r   zEYou may need to use --cert or check your proxy/firewall configurationr   )r   rG   rH   r   r:   )rJ   r   r   r<   rD   hintrI   s         r   rH   zSSLVerificationError.__init__  sL    t~%8G 	 W$s5z2BdSr!   )r   r:   r   r:   r<   zurllib3.exceptions.SSLErrorrY   rZ   r   r^   s   @r   r   r     s    )IT Tr!   r   c                  4     e Zd ZdZ	 	 	 	 	 	 	 	 d fdZ xZS )ProxyConnectionErrorzproxy-connection-failedc                ~    t         |   dt        |       dt        |       t        t	        |            d       y )Nz$Failed to connect to proxy [magenta]r   z+This is likely a proxy configuration issue.r   )rG   rH   r   r   r:   )rJ   r   proxyr<   rI   s       r   rH   zProxyConnectionError.__init__  sG     	"5M?*=fSk]L U$C 	 	
r!   )r   r:   r   r:   r<   zurllib3.exceptions.ProxyErrorrY   rZ   r   r^   s   @r   r   r     s2    )I



"

+H

	

 

r!   r   c                      e Zd ZdZy)InvalidWheelFilenamezInvalid wheel filename.Nr2   r7   r!   r   r   r     s    !r!   r   c                      e Zd ZdZy)UnsupportedWheelzUnsupported wheel.Nr2   r7   r!   r   r   r     s    r!   r   c                       e Zd ZdZddZddZy)InvalidWheelzInvalid (e.g. corrupt) wheel.c                     || _         || _        y r   )locationname)rJ   r   r   s      r   rH   zInvalidWheel.__init__  s     	r!   c                <    d| j                    d| j                   dS )NzWheel 'z' located at z is invalid.)r   r   rL   s    r   r~   zInvalidWheel.__str__  s    =|LLr!   N)r   r:   r   r:   r[   r   r7   r!   r   r   r     s    'Mr!   r   c                  4    e Zd ZdZ	 	 	 	 	 	 	 	 	 	 ddZddZy)MetadataInconsistenta  Built 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                <    || _         || _        || _        || _        y r   ireqfieldf_valm_val)rJ   r   r   r   r   s        r   rH   zMetadataInconsistent.__init__  s      	


r!   c                n    d| j                    d| j                   d| j                  d| j                  S )N
Requested  has inconsistent z: expected z, but metadata has r   rL   s    r   r~   zMetadataInconsistent.__str__  s=    #5djj\ B

~%8H	
r!   N)
r   r   r   r:   r   r:   r   r:   rY   rZ   r[   r   r7   r!   r   r   r     s9    &/2;>GJ	
r!   r   c                      e Zd ZdZddZy)SidecarMetadataInconsistentav  The wheel's METADATA disagrees with its PEP 658 ``.metadata`` file.

    Raised after the wheel has been downloaded and hash-verified, when a
    resolver-affecting field in the wheel's embedded ``METADATA`` does not
    match the value taken from the remote ``.metadata`` sidecar that drove
    resolution. ``f_val`` is the sidecar value, ``m_val`` is the wheel value.
    c                n    d| j                    d| j                   d| j                  d| j                  S )Nr   r   zJ between its PEP 658 .metadata file and the wheel's METADATA: sidecar has z, wheel has r   rL   s    r   r~   z#SidecarMetadataInconsistent.__str__  s<    #5djj\ B::.TZZND	
r!   Nr[   r   r7   r!   r   r   r     s    
r!   r   c                       e Zd ZdZddZddZy)MetadataInvalidzMetadata is invalid.c                     || _         || _        y r   r   r<   )rJ   r   r<   s      r   rH   zMetadataInvalid.__init__  s    	
r!   c                :    d| j                    d| j                   S )Nr   z has invalid metadata: r   rL   s    r   r~   zMetadataInvalid.__str__	  s    DII;&=djj\JJr!   N)r   r   r<   r:   rY   rZ   r[   r   r7   r!   r   r   r     s    Kr!   r   c                  @     e Zd ZdZdZ	 	 	 	 	 	 	 	 d fdZddZ xZS )InstallationSubprocessErrorzA subprocess call failed.zsubprocess-exited-with-errorc               (   |t        d      }nSt        j                  dt        |       d      t        dj                  |            z   t        j                  d      z   }t        |   dt        |       d| |d d	       || _        || _        y )
NzNo available output.z[red][z lines of output][/]
rR   z[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.rD   rE   rF   r>   )	r   from_markupr   r)   rG   rH   r   command_description	exit_code)rJ   r   r   output_linesoutput_promptrI   s        r   rH   z$InstallationSubprocessError.__init__  s      !78M   6#l*;)<<R!STrww|,-.""#>?@  	&!456 7'[* "$ 	 	
 $7 "r!   c                8    | j                    d| j                   S )Nz exited with )r   r   rL   s    r   r~   z#InstallationSubprocessError.__str__2  s    **+=8HIIr!   )r   r:   r   intr   list[str] | NonerY   rZ   r[   )r3   r4   r5   r6   r;   rH   r~   r]   r^   s   @r   r   r     s?    #.I# !# 	#
 '# 
#@Jr!   r   c                  4     e Zd ZdZ	 	 	 	 d fdZddZ xZS )MetadataGenerationFailedzmetadata-generation-failedc               >    t         |   dt        |      dd       y )Nz4Encountered error while generating package metadata.zSee above for details.rn   r   r   )rJ   package_detailsrI   s     r   rH   z!MetadataGenerationFailed.__init__9  s(    
 	J?+.S	 	 	
r!   c                     y)Nzmetadata generation failedr7   rL   s    r   r~   z MetadataGenerationFailed.__str__E  s    +r!   )r   r:   rY   rZ   r[   )r3   r4   r5   r;   rH   r~   r]   r^   s   @r   r   r   6  s&    ,I

 

 
	

,r!   r   c                  0    e Zd ZdZddZddZd	dZd
dZy)
HashErrorsz:Multiple HashError instances rolled into one for reportingc                    g | _         y r   )errorsrL   s    r   rH   zHashErrors.__init__L  s	    ')r!   c                :    | j                   j                  |       y r   )r  r   )rJ   r<   s     r   r   zHashErrors.appendO  s    5!r!   c                   g }| j                   j                  d        t        | j                   d       D ]8  \  }}|j                  |j                         |j                  d |D               : |rdj                  |      S y)Nc                    | j                   S r   )orderes    r   <lambda>z$HashErrors.__str__.<locals>.<lambda>T  s
    qww r!   )keyc                    | j                   S r   r^   r  s    r   r	  z$HashErrors.__str__.<locals>.<lambda>U  s
     r!   c              3  <   K   | ]  }|j                           y wr   )body)r   r  s     r   r   z%HashErrors.__str__.<locals>.<genexpr>W  s     9a9s   r%   rR   )r  sortr   r   headextendr)   )rJ   linesclserrors_of_clss       r   r~   zHashErrors.__str__R  sv    ./")$++7L"M 	:CLL"LL9=99	: 99U##r!   c                ,    t        | j                        S r   )boolr  rL   s    r   __bool__zHashErrors.__bool__\  s    DKK  r!   NrY   rZ   )r<   	HashErrorrY   rZ   r[   )rY   r  )r3   r4   r5   r6   rH   r   r~   r  r7   r!   r   r   r   I  s    D*"!r!   r   c                  J    e Zd ZU dZdZded<   dZdZded<   dd	Zd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.

    NInstallRequirement | NonereqrR   r   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_namerL   s    r   r  zHashError.bodyu  s     d,,./00r!   c                @    | j                    d| j                          S )Nr%   )r  r  rL   s    r   r~   zHashError.__str__  s    ))Btyy{m,,r!   c                H    | j                   rt        | j                         S dS )zReturn a description of the requirement that triggered me.

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

        unknown package)r  r:   rL   s    r   r  zHashError._requirement_name  s     !%s488}?.??r!   r[   )r3   r4   r5   r6   r  r\   r  r  r  r~   r  r7   r!   r   r  r  `  s2      &*C	")DE3O
1-@r!   r  c                      e Zd ZdZdZdZy)VcsHashUnsupporteduA hash was provided for a version-control-system-based requirement, but
    we don't have a method for hashing those.r   zlCan't verify hashes for these requirements because we don't have a way to hash version control repositories:Nr3   r4   r5   r6   r  r  r7   r!   r   r#  r#    s    1 E	; 	r!   r#  c                      e Zd ZdZdZdZy)DirectoryUrlHashUnsupportedr$  r   zUCan't verify hashes for these file:// requirements because they point to directories:Nr%  r7   r!   r   r'  r'    s    1 E	  	r!   r'  c                  (    e Zd ZdZdZdZddZddZy)	HashMissingz2A hash was needed for a requirement but is absent.r   aw  Hashes 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)rJ   r+  s     r   rH   zHashMissing.__init__  s    
 'r!   c                    ddl m} d }| j                  rC| j                  j                  r| j                  j                  nt        | j                  dd       }dj                  |xs d|| j                        S )Nr   )FAVORITE_HASHr  z    {} --hash={}:{}r!  )pip._internal.utils.hashesr-  r  	is_directoriginal_linkgetattrformatr+  )rJ   r-  rr   s      r   r  zHashMissing.body  sn    <88 88%% && TXXud3  %++((-9I9I
 	
r!   N)r+  r:   rY   rZ   r[   )r3   r4   r5   r6   r  r  rH   r  r7   r!   r   r)  r)    s    <E	 	'
r!   r)  c                      e Zd ZdZdZdZy)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%  r7   r!   r   r4  r4    s     E	1 	r!   r4  c                  0    e Zd ZdZdZdZddZd	dZd	dZy)
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.

       zTHESE 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)rJ   r:  r;  s      r   rH   zHashMismatch.__init__  s     	r!   c                J    d| j                          d| j                          S )Nr  :
)r  _hash_comparisonrL   s    r   r  zHashMismatch.body  s)    d,,./s43H3H3J2KLLr!   c                   dd}g }| j                   j                         D ]W  \  }} ||      |j                  fd|D               |j                  d| j                  |   j                          d       Y dj                  |      S )aE  
        Return a comparison of actual and expected hash values.

        Example::

               Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde
                            or 123451234512345123451234512345123451234512345
                    Got        bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef

        c                .    t        | gt        d            S )Nz    or)r   r   )	hash_names    r   hash_then_orz3HashMismatch._hash_comparison.<locals>.hash_then_or  s     )fX&677r!   c              3  @   K   | ]  }d t               d|   yw)z        Expected  N)next)r   r  r,   s     r   r   z0HashMismatch._hash_comparison.<locals>.<genexpr>  s#     Ua-d6l^1QC@Us   z             Got        r%   )rA  r:   rY   z
chain[str])r:  itemsr  r   r;  	hexdigestr)   )rJ   rB  r  rA  	expectedsr,   s        @r   r>  zHashMismatch._hash_comparison  s    	8
 $(LL$6$6$8 	 Iy!),FLLU9UULL*499Y+?+I+I+K*LBO	 yyr!   N)r:  zdict[str, list[str]]r;  zdict[str, _Hash]rY   rZ   r[   )	r3   r4   r5   r6   r  r  rH   r  r>  r7   r!   r   r7  r7    s(     E	/ 	M r!   r7  c                      e Zd ZdZy)UnsupportedPythonVersionzMUnsupported python version according to Requires-Python package
    metadata.Nr2   r7   r!   r   rJ  rJ    s    r!   rJ  c                  B     e Zd ZdZ	 	 	 d	 	 	 	 	 	 	 d fdZddZ xZS )!ConfigurationFileCouldNotBeLoadedz8When there are errors while loading a configuration filec                N    t         |   |       || _        || _        || _        y r   )rG   rH   rw   fnamer<   )rJ   rw   rN  r<   rI   s       r   rH   z*ConfigurationFileCouldNotBeLoaded.__init__  s'     	

r!   c                    | j                   d| j                    d}n| j                  J d| j                   d}d| j                   | S )Nz in .z.
r%   zConfiguration file )rN  r<   rw   )rJ   message_parts     r   r~   z)ConfigurationFileCouldNotBeLoaded.__str__&  sU    ::!!$**Q/L::))) B/L$T[[M,@@r!   )zcould not be loadedNN)rw   r:   rN  rW   r<   zconfigparser.Error | NonerY   rZ   r[   r   r^   s   @r   rL  rL    sB    B , +/			 	 )		
 
	Ar!   rL  zThe 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     e Zd ZdZdZd fdZedd       Ze	 	 	 	 dd       Z	 xZ
S )	ExternallyManagedEnvironmentaP  The 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``.
    zexternally-managed-environmentc                x    |t        t              }nt        |      }t        |   d|dt        d             y )Nz&This environment is externally managedzIf 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.rp   )r   !_DEFAULT_EXTERNALLY_MANAGED_ERRORrG   rH   )rJ   r<   rE   rI   s      r   rH   z%ExternallyManagedEnvironment.__init__B  sE    =<=G5kG<J
 HI 	 
	
r!   c               #     K   	 t         j                  } t        j                  |       \  }}|-d|  dD ]!  }|j	                  |      \  }}}|sd|  # d y # t        $ r d }Y Aw xY ww)NzError-)-r   Error)localeLC_MESSAGES	getlocaleAttributeError	partition)categorylangr   sepr   founds         r   #_iter_externally_managed_error_keysz@ExternallyManagedEnvironment._iter_externally_managed_error_keysS  s     	1))H &&x0GD!4&/!! (#'>>##6 qvh''	(
   	$#D	$s(   A1A  AA1 A.+A1-A..A1c                   t        j                  d       }	 |j                  |d       |d   }| j                         D ]1  }t	        j
                  t              5   | ||         cd d d        c S  	  | d       S # 1 sw Y   FxY w# t        $ r Y t        t        t         j                  f$ r6 ddl
m} t        j                  |      }t        j                  d||       Y qw xY w)	N)interpolationzutf-8)encodingzexternally-managedr   )VERBOSEzFailed to read %s)exc_info)configparserConfigParserreadrb  
contextlibsuppressKeyErrorOSErrorUnicodeDecodeErrorParsingErrorpip._internal.utils._logrf  loggerisEnabledForwarning)r  configparsersectionr
  rf  rg  s          r   from_configz(ExternallyManagedEnvironment.from_configi  s    
 **>	KKKK112G>>@ -((2 -ws|,- -- 4y- - 	+\-F-FG 	K8**73HNN.NJ		Ks7   AB	 A='B	 3B	 =B	B	 		C'AC'&C')r<   rW   rY   rZ   )rY   zIterator[str])ru  zpathlib.Path | strrY   rS  )r3   r4   r5   r6   r;   rH   staticmethodrb  classmethodrx  r]   r^   s   @r   rS  rS  6  sN     1I
"  * " 
& r!   rS  c                  $     e Zd ZdZd fdZ xZS )UninstallMissingRecordzuninstall-no-record-filec                  |j                   }|r|dk(  r7|j                   d|j                   }t        j                  dd| df      }nt        d| d      }t
        |   t        d|       d	|j                   d
|       y )Npipz==z,You might be able to recover from this via: z)pip install --ignore-installed --no-deps greenzThe 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 rP  r   )	installerraw_nameversionr   r   rG   rH   )rJ   distributionr  depr   rI   s        r   rH   zUninstallMissingRecord.__init__  s     **	I.!**+2l.B.B-CDC==><SEBGLD
 /	{ ;D DD
 	,\N;<00<0E0E/FaI  	 	
r!   r  r   rY   rZ   r   r^   s   @r   r|  r|    s    *I
 
r!   r|  c                  $     e Zd ZdZd fdZ xZS )LegacyDistutilsInstallz%uninstall-distutils-installed-packagec               B    t         |   t        d|       dd        y )Nr  zIt is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.r   )rG   rH   r   )rJ   r  rI   s     r   rH   zLegacyDistutilsInstall.__init__  s/    ,\N;<  	 	
r!   r  r   r^   s   @r   r  r    s    7I	
 	
r!   r  c                  0     e Zd ZdZ	 	 	 	 	 	 d fdZ xZS )InvalidInstalledPackagezinvalid-installed-packagec          
         |j                   }t        |t              rd}nd}t        |   t        d| d|rd|dndz   d| d|j                  d	    z         d
| dd       y )Nrequirementr  z!Cannot process installed package rD  zin rR   zbecause it has an invalid r=  r   z.Starting with pip 24.1, packages with invalid zs can not be processed.z,To proceed this package must be uninstalled.r   )installed_locationr'   r   rG   rH   r   r   )rJ   r{   invalid_excr  invalid_typerI   s        r   rH   z InvalidInstalledPackage.__init__  s     "44k#56(L$L3D6;4FS+.a0BP.|nC@P@PQR@S?TUV A. 79 E 	 	
r!   )r{   r   r  z#InvalidRequirement | InvalidVersionrY   rZ   r   r^   s   @r   r  r    s0    +I
 
 9	

 

 
r!   r  c                  (     e Zd ZdZdZd fdZ xZS )IncompleteDownloadErrorzaRaised when the downloader receives fewer bytes than advertised
    in the Content-Length header.zincomplete-downloadc                @   ddl m} |j                  J  ||j                         d ||j                         }|j                  rd|j                  dz    d}d}nd}d	}t        d
| d| d      }t        |   |d|j                  j                   |d       y )Nr   )format_size/zafter r   z
 attempts z7Use --resume-retries to configure resume attempt limit.rR   z>Consider using --resume-retries to enable download resumption.zDownload failed z(because not enough bytes were received ()zURL: z4This is an issue with network connectivity, not pip.r   )
pip._internal.utils.miscr  sizebytes_received
reattemptsr   rG   rH   r?   redacted_url)rJ   downloadr  download_statusretry_statusr   rD   rI   s          r   rH   z IncompleteDownloadError.__init__  s    8}}(((82234Ak(--6P5QR 	 #H$7$7!$;#<JGLLD LSD|n --.a1

 	HMM6678L	 	 	
r!   )r  r   rY   rZ   rs   r^   s   @r   r  r    s    % &I
 
r!   r  c                  (     e Zd ZdZdZd fdZ xZS )ResolutionTooDeepErrorzHRaised when the dependency resolver exceeds the maximum recursion depth.zresolution-too-deepc                ,    t         |   dddd       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)rD   rE   rF   r?   )rG   rH   )rJ   rI   s    r   rH   zResolutionTooDeepError.__init__  s)    B?L s 	 	
r!   r  rs   r^   s   @r   r  r    s    R%I
 
r!   r  c                  $     e Zd ZdZd fdZ xZS )InstallWheelBuildErrorzfailed-wheel-build-for-installc                V    t         |   ddj                  d |D              d        y )NzIFailed to build installable wheels for some pyproject.toml based projectsr   c              3  4   K   | ]  }|j                     y wr   )r   )r   rs     r   r   z2InstallWheelBuildError.__init__.<locals>.<genexpr>  s     5aff5s   r   )rG   rH   r)   )rJ   failedrI   s     r   rH   zInstallWheelBuildError.__init__   s1    0 II5f55 	 	
r!   )r  zlist[InstallRequirement]rY   rZ   r   r^   s   @r   r  r    s    0I
 
r!   r  c                  $     e Zd ZdZd fdZ xZS )InvalidEggFragmentzinvalid-egg-fragmentc           	         d}d|v sd|v sd|v rd}d|v r	d|v r|dz  }|sd	}t         |   d
t        |       ddt        t        |             dt        |             y )NrR   rB   =rA   zIVersion specifiers are silently ignored for URL references. Remove them. rQ   ]z@Try using the Direct URL requirement syntax: 'name[extra] @ URL'z/Egg fragments can only be a valid project name.zThe 'z' egg fragment is invalidzfrom ''r   )rG   rH   r   r:   )rJ   r?   fragmentr   rI   s       r   rH   zInvalidEggFragment.__init__  s    (?cXo   (?shVVDDDF8,--FGVCI./q1Tl 	 	
r!   )r?   r   r  r:   rY   rZ   r   r^   s   @r   r  r    s    &I
 
r!   r  c                  <     e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 d fdZ xZS )BuildDependencyInstallErrorz3Raised when build dependencies cannot be installed.zfailed-build-dependency-installc                  t        |t              rd}nd}|t        d      }nt        |t              r|j                  d|        nA|j	                  dj                  t        j                  |            j                                t        j                  ddj                  |       dd	t        |       d
dfdj                  |      d      }t        dd      }|r|t        d|       z  }t        | 1  ||d |       y )Nz&This is likely not a problem with pip.zmpip crashed unexpectedly. Please file an issue on pip's issue tracker: https://github.com/pypa/pip/issues/newzSee above for more details.zERROR: rR   zInstalling rD  r%   rQ   z lines of output]
rO   )z
[end of output]rO   z!Cannot install build dependenciesr  z for r   )r'   r1   r   r   r  r)   	tracebackformat_exception
splitlinesr   r   rG   rH   )	rJ   r  
build_reqscause	log_linesnoterE   rD   rI   s	           r   rH   z$BuildDependencyInstallError.__init__'  s    eX&;DB 
 89G%*  75'!23   GGI66u=>IIK mmchhz2326S^$$78%@		)$,	G :GDteC5M**GW 	 	
r!   )
r  r  r  zIterable[str]r  r   r  r   rY   rZ   rs   r^   s   @r   r  r  "  sE    =1I(
&(
 "(

 (
 $(
 
(
 (
r!   r  c                  (     e Zd ZdZdZd fdZ xZS )VenvImportErrorz%Raised when 'venv' can't be imported.zvenv-import-errorc                \    t         j                  dk7  rd }nd}t        |   ddd|       y )NlinuxzIf this is an OS-provided Python, it's likely that your OS package maintainers have split Python's standard library across multiple OS packages.z>Cannot import the 'venv' module of the Python standard libraryzMThis is a symptom of a broken/modified Python, which cannot be used with pip.z>This is an issue with the Python installation itself, not pip.rp   )sysplatformrG   rH   )rJ   rF   rI   s     r   rH   zVenvImportError.__init__W  sC    <<7"I( 
 	T W 	 	
r!   r  rs   r^   s   @r   r  r  R  s    /#I
 
r!   r  c                  (     e Zd ZdZdZd fdZ xZS )VenvCreationErrorz3Raised when a virtual environment can't be created.zvenv-creation-errorc                l    t         j                  dk(  rd}nd }t        |   dt	        |      |       y )Nntz1This may be caused by running antivirus software.z#Cannot create a virtual environmentr   )osr   rG   rH   r   )rJ   rE   r   rI   s      r   rH   zVenvCreationError.__init__p  s7    77d?FDD9M 	 	
r!   )rE   r:   rY   rZ   rs   r^   s   @r   r  r  k  s    =%I	
 	
r!   r  )r   r:   rY   r  )
r   z
Text | strr+   r   r,   r:   r-   r:   rY   r   )lr6   
__future__r   rh  rk  rY  loggingr  pathlibr   r  r  collections.abcr   r   	itertoolsr   r   r   typingr	   r
   "pip._vendor.packaging.requirementsr   pip._vendor.packaging.versionr   pip._vendor.rich.consoler   r   r   pip._vendor.rich.markupr   pip._vendor.rich.textr   hashlibr   pip._vendorr   pip._vendor.requests.modelsr   r   r   pip._internal.metadatar   pip._internal.models.linkr   pip._internal.network.downloadr   pip._internal.req.req_installr   	getLoggerr3   rr  r    r/   r   r1   r9   r`   rb   rd   rk   ru   ry   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r#  r'  r)  r4  r7  rJ  rL  r,   rU  rS  r|  r  r  r  r  r  r  r  r  r  r7   r!   r   <module>r     sn   #     	  	 
  . , , ) A 8 J J * &#NN7.<@			8	$:))) 	)
 ) 
)"y p' p'l- -0 0'0 '"
$6 
"
$6 
"Y Y86/ 6C0 CN, NO!2 O( 
; ;B8 BEH E#X #8+
. +
\
/ 
8
( 
	T- 	T
- 
 ", "( M$ M
, 
.
"6 
"K' K&J"46G &JR,13D ,&!" !.+@! +@\ ) '
) '
T9 7 9 7 t0 
A(: A.)!jj\ *% !F#5 FR
/ 
6
/ 

0 
<
0 
D
/ 
(
/ 

+ 
.-
"4 -
`
( 
2
* 
r!   