HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pip/_internal/network/__pycache__/session.cpython-310.pyc
o

@%NeYA�@sUdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
ZddlZddlmZmZmZmZmZmZmZmZmZddlmZmZddlmZddlm Z m!Z!ddl"m#Z#m$Z$ddl%m&Z&dd	l'm(Z(dd
l)m*Z*ddl+m,Z,ddl-m.Z.dd
l/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:m;Z;ddl<m=Z=e�>e?�Z@eeAeAeeeBeAffZCejDde*d�gd�ZEeeCeFd<dZGdeHfdd�ZIdeAfdd�ZJGdd�de �ZKGd d!�d!e!�ZLGd"d#�d#e�ZMGd$d%�d%ejN�ZOdS)&zhPipSession and supporting code, containing all pip-specific
network request configuration and behavior.
�N)	�Any�Dict�Iterator�List�Mapping�Optional�Sequence�Tuple�Union)�requests�urllib3)�CacheControlAdapter)�BaseAdapter�HTTPAdapter)�PreparedRequest�Response)�CaseInsensitiveDict)�ConnectionPool)�InsecureRequestWarning)�__version__)�get_default_environment)�Link)�MultiDomainBasicAuth)�
SafeFileCache)�has_tls)�libc_ver)�build_url_from_netloc�parse_netloc)�url_to_path�ignore)�category))�https�*r")r"�	localhostr")r"z127.0.0.0/8r")r"z::1/128r")�filer"N)�sshr"r"�SECURE_ORIGINS)�
BUILD_BUILDID�BUILD_ID�CI�	PIP_IS_CI�returncCstdd�tD��S)z?
    Return whether it looks like pip is running under CI.
    css�|]}|tjvVqdS�N)�os�environ)�.0�name�r1�?/usr/lib/python3/dist-packages/pip/_internal/network/session.py�	<genexpr>Xs�z looks_like_ci.<locals>.<genexpr>)�any�CI_ENVIRONMENT_VARIABLESr1r1r1r2�
looks_like_ciQsr6c
Cs�dtd�t��dt��id�}|dddkr t��|dd<nF|dddkrEtj}|jd	kr6|d
d�}d�d
d�|D��|dd<n!|dddkrVt��|dd<n|dddkrft��|dd<tj�d�r�ddl	m
}|��|��|�
�f}ttdd�tgd�|���}ttdd�tddgt����}|r�||d<|r�||d<tj�d�r�t��dr�dt��dd�|d<t��r�t��|�di�d<t��r�t��|�di�d<t��r�t��|d<t�r�dd
l}|j|d <t��d!�}|d
u�rt|j�|d"<t�d#�d
u�r2z
tj d#d$gtj!d%d&�}Wn
t"�y Ynw|�d'��r2|�#d(�d)�$�|d*<t%��r8d+nd
|d,<t&j'�(d-�}	|	d
u�rK|	|d.<d/j)|t*j+|d0d+d1�d2�S)3z6
    Return a string representing the user agent.
    �pip)r0�versionr0)�	installer�python�implementationr;�CPythonr8�PyPy�finalN��.cSsg|]}t|��qSr1)�str)r/�xr1r1r2�
<listcomp>nszuser_agent.<locals>.<listcomp>�Jython�
IronPython�linuxr)�distrocS�|dS�N�r1�rBr1r1r2�<lambda>}�zuser_agent.<locals>.<lambda>)r0r8�idcSrHrIr1rKr1r1r2rL�rM�lib�libcrG�darwin�macOS�system�release�cpu�openssl_version�
setuptools�setuptools_version�rustcz	--versiong�?)�stderr�timeoutsrustc � rJ�
rustc_versionT�ci�PIP_USER_AGENT_USER_DATA�	user_dataz9{data[installer][name]}/{data[installer][version]} {json})�,�:)�
separators�	sort_keys)�data�json),r�platform�python_version�python_implementation�sys�pypy_version_info�releaselevel�join�
startswith�pip._vendorrGr0r8�codename�dict�filter�zipr�mac_verrS�
setdefaultrT�machiner�_ssl�OPENSSL_VERSIONr�get_distributionrA�shutil�which�
subprocess�check_output�STDOUT�	Exception�split�decoder6r-r.�get�formatrf�dumps)
rerkrG�linux_distribution�distro_infosrP�ssl�setuptools_dist�rustc_outputr`r1r1r2�
user_agent[s���
�����


��
�r�c@s�eZdZ					ddededeeeeeeffdeee	fdeee	ee	e	ffd	ee
e	e	fd
efdd�Zdd
d�Z
dS)�LocalFSAdapterFNT�request�streamr[�verify�cert�proxiesr+c

Cs�t|j�}t�}d|_|j|_zt�|�}	Wn+tyA}
zd|_t|
�j|_	t
�|j	�d|
���d��|_
WYd}
~
|Sd}
~
wwtjj|	jdd�}t�|�dpSd}t||	j|d	��|_t|d
�|_
|j
j|_|S)N��i�z: �utf8T)�usegmtrz
text/plain)zContent-TypezContent-Lengthz
Last-Modified�rb)r�urlr�status_coder-�stat�OSError�type�__name__�reason�io�BytesIO�encode�raw�email�utils�
formatdate�st_mtime�	mimetypes�
guess_typer�st_size�headers�open�close)
�selfr�r�r[r�r�r��pathname�resp�stats�exc�modified�content_typer1r1r2�send�s0
	(����
zLocalFSAdapter.sendcCsdSr,r1)r�r1r1r2r��szLocalFSAdapter.close)FNTNN)r+N)r��
__module__�__qualname__r�boolrr
�floatr	rArrr�r�r1r1r1r2r��s,����
���
�'r�c
�NeZdZdededeeefdeeeeeeffddf
�fdd�Z	�Z
S)	�InsecureHTTPAdapter�connr�r�r�r+Nc�t�j||d|d�dS�NF)r�r�r�r���super�cert_verify�r�r�r�r�r���	__class__r1r2r���zInsecureHTTPAdapter.cert_verify�r�r�r�rrAr
r�rr	r��
__classcell__r1r1r�r2r�����
���r�c
r�)	�InsecureCacheControlAdapterr�r�r�r�r+Ncr�r�r�r�r�r1r2r��r�z'InsecureCacheControlAdapter.cert_verifyr�r1r1r�r2r��r�r�cs�eZdZUdZeeed<ddddd�dededeed	e	ed
ee
ededdf�fd
d�Zde
eddfdd�Z	d!dedeede
ddfdd�Zdeefdd�Zdede
fdd�Zdededededef
�fdd �Z�ZS)"�
PipSessionNr[rr1)�retries�cache�
trusted_hosts�
index_urls�argsr�r�r�r��kwargsr+c
s�t�j|i|��g|_t�|jd<t|d�|_tj|gd�dd�}t	|d�}|r;t
t|�|d�}tt|�|d�|_
nt|d�}||_
|�d|�|�d	|�|�d
t��|D]	}	|j|	dd�qXd
S)zj
        :param trusted_hosts: Domains not to emit warnings for when not using
            HTTPS.
        z
User-Agent)r�)i�i�iig�?)�total�status_forcelist�backoff_factor)�max_retries)r�r�zhttps://zhttp://zfile://T)�suppress_loggingN)r��__init__�pip_trusted_originsr�r�r�authr�Retryr�r
rr��_trusted_host_adapterr�mountr��add_trusted_host)
r�r�r�r�r�r�r��insecure_adapter�secure_adapter�hostr�r1r2r�s6
�
�
�
�zPipSession.__init__�new_index_urlscCs||j_dS)zn
        :param new_index_urls: New index urls to update the authentication
            handler with.
        N)r�r�)r�r�r1r1r2�update_index_urlsSszPipSession.update_index_urlsFr��sourcer�cCs�|sd|��}|dur|d|�d�7}t�|�t|�}||jvr'|j�|�|�t|dd�d|j�|�t|�d|j�|ds]|�t|dd�d	|j�|�t|�d	|j�dSdS)
z�
        :param host: It is okay to provide a host that has previously been
            added.
        :param source: An optional source string, for logging where the host
            string came from.
        zadding trusted host: Nz (from �)�http)�scheme�/rJrb)�logger�inforr��appendr�rr�)r�r�r�r��msg�	host_portr1r1r2r�Zs&	


���zPipSession.add_trusted_hostccs8�tEdH|jD]\}}d||durdn|fVq	dS)Nr")r&r�)r�r��portr1r1r2�iter_secure_originsys
�
�zPipSession.iter_secure_origins�locationc	Cs�tj�t|��}|j|j|j}}}|�dd�d}|��D]J}|\}}}	||kr/|dkr/qzt	�
|�}
t	�|�}WntyT|rR|�
�|�
�krR|dkrRYqYnw|
|vrZq||	krg|	dkrg|	durgqdSt�d||�dS)N�+rJ���r"Tz�The repository located at %s is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host %s'.F)�urllib�parse�urlparserAr��hostnamer��rsplitr��	ipaddress�
ip_address�
ip_network�
ValueError�lowerr��warning)r�r��parsed�origin_protocol�origin_host�origin_port�
secure_origin�secure_protocol�secure_host�secure_port�addr�networkr1r1r2�is_secure_origin~sD
�


����	zPipSession.is_secure_origin�methodr�cs*|�d|j�t�j||g|�Ri|��S)Nr[)rur[r�r�)r�rr�r�r�r�r1r2r��szPipSession.request)NF)r�r�r�r[r�int�__annotations__rrArrr�r�r�r�r�SecureOriginr�rrrr�r�r1r1r�r2r�sF
�����
���M����
�*Cr�)P�__doc__�email.utilsr�r�r�rf�loggingr�r-rgrzr|rj�urllib.parser��warnings�typingrrrrrrrr	r
rorr�pip._vendor.cachecontrolr
�pip._vendor.requests.adaptersrr�pip._vendor.requests.modelsrr�pip._vendor.requests.structuresr�"pip._vendor.urllib3.connectionpoolr�pip._vendor.urllib3.exceptionsrr7r�pip._internal.metadatar�pip._internal.models.linkr�pip._internal.network.authr�pip._internal.network.cacher�pip._internal.utils.compatr�pip._internal.utils.glibcr�pip._internal.utils.miscrr�pip._internal.utils.urlsr�	getLoggerr�r�rArr�filterwarningsr&rr5r�r6r�r�r�r��Sessionr�r1r1r1r2�<module>sT,

e,