o
    ­—ŽjÀ  ã                
   @   sb  U d dl mZ d dlmZmZmZmZ d dl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mZmZ d dlmZ eeed	B ed	B f B ejjB d	B Zeed
< ddiZee e f ed< dZ!dedd	fdd„Z"e!fdede#dee$d	d	f fdd„Z%deded defdd„Z&dej'j(de de dedef
dd „Z)d!e
j*e
jB de dedefd"d#„Z+d	S )$é    )Ú	Generator)ÚLiteralÚNoReturnÚ	TypeAliasÚcast)Úurlsplit)ÚrequestsÚurllib3)ÚResponse)ÚTimeoutStateError)ÚConnectionFailedErrorÚConnectionTimeoutErrorÚNetworkConnectionErrorÚProxyConnectionErrorÚSSLVerificationError)Úredact_auth_from_urlNÚTimeoutValuezAccept-EncodingÚidentityÚHEADERSi   ÚrespÚreturnc                 C   sÀ   d}t | jtƒr z| j d¡}W n ty   | j d¡}Y nw | j}d| j  kr.dk r=n n| j› d|› d| j› �}nd| j  krHdk rVn n| j› d	|› d| j› �}|r^t|| d
�‚d S )NÚ zutf-8z
iso-8859-1i�  iô  z Client Error: z
 for url: iX  z Server Error: )Úresponse)Ú
isinstanceÚreasonÚbytesÚdecodeÚUnicodeDecodeErrorÚstatus_codeÚurlr   )r   Úhttp_error_msgr   © r!   úX/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pip/_internal/network/utils.pyÚraise_for_status.   s"   ÿÿÿÿr#   r   Ú
chunk_sizec                 c   sT   � z| j j|dd�D ]}|V  q
W dS  ty)   	 | j  |¡}|s%Y dS |V  qw )z3Given a requests Response, provide the data chunks.F)Údecode_contentTN)ÚrawÚstreamÚAttributeErrorÚread)r   r$   Úchunkr!   r!   r"   Úresponse_chunksJ   s    €
èæüþr+   ÚtimeoutÚkind)Úconnectr)   c                 C   s„   t | tƒr
| \}}n$t | tjjƒr*ttd B | jƒ}z| j}W n t	y)   d }Y nw |  }}|dkr:|d us8J ‚|S |d us@J ‚|S )Nr.   )
r   Útupler	   ÚutilÚTimeoutr   ÚfloatÚconnect_timeoutÚread_timeoutr   )r,   r-   r3   r4   r!   r!   r"   Ú_parse_timeoutt   s   


ÿr5   r   r   Úhostc                 C   s:   t | tjjƒrt||dt|dƒd�‚t||dt|dƒd�‚)Nr.   )r-   r,   r)   )r   r	   Ú
exceptionsÚConnectTimeoutErrorr   r5   )r   r   r6   r,   r!   r!   r"   Ú_raise_timeout_errorŠ   s   ÿÿr9   Úerrorc                C   sJ  t |ƒ}t|ƒjpt|ƒj}| jr| jd n| }t|tjjƒr-t|tjj	ƒs-t
||||ƒ t|tjjƒr:t|||ƒ‚t|tjjƒsGt|||ƒ‚|}t|jtjjƒsSJ ‚|jj}|jj}|j}t|tjjƒrkt|||ƒ‚t|tjjƒr€t|tjj	ƒs€t
||||ƒ t|tjjƒr—|dus�J ‚t|t t|ƒƒ|ƒ‚t||t|tƒr¢|ƒ‚|ƒ‚)a   Raise a specific error for a given connection error, if possible.

    Note: requests.ConnectionError is the parent class of
          requests.ProxyError, requests.SSLError, and requests.ConnectTimeout
          so these errors are also handled here.
    r   N)r   r   ÚhostnameÚnetlocÚargsr   r	   r7   ÚTimeoutErrorÚNewConnectionErrorr9   ÚSSLErrorr   ÚMaxRetryErrorr   ÚpoolÚconnectionpoolÚHTTPConnectionPoolr6   Úproxyr   Ú
ProxyErrorr   ÚstrÚ	Exception)r:   r   r,   Úraw_hostnamer   Úmax_retry_errorr6   rE   r!   r!   r"   Úraise_connection_errorš   s<   ÿÿÿÿrK   ),Úcollections.abcr   Útypingr   r   r   r   Úurllib.parser   Úpip._vendorr   r	   Úpip._vendor.requests.modelsr
   Úpip._vendor.urllib3.exceptionsr   Úpip._internal.exceptionsr   r   r   r   r   Úpip._internal.utils.miscr   r2   r/   r0   r1   r   Ú__annotations__r   ÚdictrG   ÚDOWNLOAD_CHUNK_SIZEr#   Úintr   r+   r5   r7   r>   r9   ÚConnectionErrorrK   r!   r!   r!   r"   Ú<module>   sT    "
ÿÿÿÿ
þ*ÿþýü
û
ÿýüû