HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/python38/lib/python3.8/site-packages/pip/_internal/network/__pycache__/session.cpython-38.pyc
U

�{�e�H�@s~UdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
ZddlZddlmZmZmZmZmZmZmZmZmZmZddlmZmZddlmZ ddl!m"Z"m#Z#ddl!m$Z%ddl&m'Z'm(Z(dd	l)m*Z*dd
l+m,Z,ddl-m.Z.ddl/m0Z0dd
l1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;m<Z<ddl=m>Z>m?Z?ddl@mAZAe�r�ddlBmCZCddlDmEZEe�FeG�ZHeeIeIeeeJeIffZKejLde.d�ddddddgZMeeKeNd<d ZOePd!�d"d#�ZQeId!�d$d%�ZRGd&d'�d'e#�ZSGd(d)�d)�ZTGd*d+�d+eTe%�Z$Gd,d-�d-eTe �ZGd.d/�d/e$�ZUGd0d1�d1e�ZVGd2d3�d3ejW�ZXdS)4zhPipSession and supporting code, containing all pip-specific
network request configuration and behavior.
�N)
�
TYPE_CHECKING�Any�Dict�	Generator�List�Mapping�Optional�Sequence�Tuple�Union)�requests�urllib3)�CacheControlAdapter)�DEFAULT_POOLBLOCK�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)�
SSLContext)�PoolManager�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|]}|tjkVqdS�N)�os�environ)�.0�name�r6�A/tmp/pip-unpacked-wheel-_0scjqea/pip/_internal/network/session.py�	<genexpr>jsz looks_like_ci.<locals>.<genexpr>)�any�CI_ENVIRONMENT_VARIABLESr6r6r6r7�
looks_like_cicsr;c
Cs�dtd�t��dt��id�}|dddkr@t��|dd<n�|dddkr�tj}|jd	krl|d
d�}d�d
d�|D��|dd<nB|dddkr�t��|dd<n |dddkr�t��|dd<tj�d��rTddl	m
}|��|��|�
�f}ttdd�tdddg|���}ttdd�tddgt����}|�rF||d<|�rT||d<tj�d��r�t��d�r�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
k	�rt|j�|d"<t�d#�d
k	�rzztj d#d$gtj!d%d&�}Wnt"k
�rVYn$X|�d'��rz|�#d(�d)�$�|d*<t%��r�d+nd
|d,<t&j'�(d-�}	|	d
k	�r�|	|d.<d/j)|t*j+|d0d+d1�d2�S)3z6
    Return a string representing the user agent.
    �pip)r5�versionr5)�	installer�python�implementationr@�CPythonr=�PyPy�finalN��.cSsg|]}t|��qSr6)�str)r4�xr6r6r7�
<listcomp>�szuser_agent.<locals>.<listcomp>�Jython�
IronPython�linuxr)�distrocSs|dS�N�r6�rGr6r6r7�<lambda>��zuser_agent.<locals>.<lambda>�idcSs|dSrMr6rOr6r6r7rP�rQ�lib�libcrL�darwin�macOS�system�release�cpu�openssl_version�
setuptools�setuptools_versionZrustcz	--versiong�?)�stderr�timeoutsrustc � rNZ
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._vendorrLr5r=�codename�dict�filter�zipr�mac_verrW�
setdefaultrX�machiner�_ssl�OPENSSL_VERSIONr�get_distributionrF�shutil�which�
subprocess�check_output�STDOUT�	Exception�split�decoder;r2r3�get�formatrh�dumps)
rgrmrL�linux_distribution�distro_infosrT�sslZsetuptools_distZrustc_outputrbr6r6r7�
user_agentms���
�����




�

�r�c@sreZdZd
eeeeeeeeffeee	feee	ee	e	ffee
e	e	fed�dd�Zdd�dd	�Z
dS)�LocalFSAdapterFNT)�request�streamr^�verify�cert�proxiesr0c

Cs�t|j�}t�}d|_|j|_zt�|�}	WnRtk
r~}
z4d|_t|
�j|_	t
�|j	�d|
���d��|_
W5d}
~
XYnPXtjj|	jdd�}t�|�dp�d}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_coder2�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_typer6r6r7�send�s*	
0��
zLocalFSAdapter.sendr/cCsdSr1r6)r�r6r6r7r��szLocalFSAdapter.close)FNTNN)r��
__module__�__qualname__r�boolrr�floatr
rFrrr�r�r6r6r6r7r��s�
�'r�csReZdZdZdd�ededd��fdd�Zefeee	edd	��fd
d�
Z
�ZS)�_SSLContextAdapterMixina#Mixin to add the ``ssl_context`` constructor argument to HTTP adapters.

    The additional argument is forwarded directly to the pool manager. This allows us
    to dynamically decide what SSL store to use at runtime, which is used to implement
    the optional ``truststore`` backend.
    N)�ssl_contextr!)r��kwargsr0cs||_t�jf|�dSr1)�_ssl_context�super�__init__)r�r�r���	__class__r6r7r�sz _SSLContextAdapterMixin.__init__r")�connections�maxsize�block�pool_kwargsr0cs2|jdk	r|�d|j�t�jf|||d�|��S)Nr�)r�r�r�)r�rwr��init_poolmanager)r�r�r�r�r�r�r6r7r�s
��z(_SSLContextAdapterMixin.init_poolmanager)r�r�r��__doc__rrr�r�intr�r��
__classcell__r6r6r�r7r��s
��
��r�c@seZdZdS)rN�r�r�r�r6r6r6r7r src@seZdZdS)rNr�r6r6r6r7r$src	sFeZdZeeeeefeeeeeeffdd��fdd�Z	�Z
S)�InsecureHTTPAdapterN��connr�r�r�r0cst�j||d|d�dS�NF)r�r�r�r��r��cert_verify�r�r�r�r�r�r�r6r7r�)szInsecureHTTPAdapter.cert_verify�r�r�r�rrFrr�rr
r�r�r6r6r�r7r�(s
�r�c	sFeZdZeeeeefeeeeeeffdd��fdd�Z	�Z
S)�InsecureCacheControlAdapterNr�cst�j||d|d�dSr�r�r�r�r6r7r�4sz'InsecureCacheControlAdapter.cert_verifyr�r6r6r�r7r�3s
�r�c
s�eZdZUdZeeed<dddddd�eeeee	eee
eededd��fdd	�Ze
edd
�dd�Zdeeee
dd�dd�Zeeddfd�dd�Zee
d�dd�Zeeeeed��fdd�Z�ZS)�
PipSessionNr^rr6)�retries�cache�
trusted_hosts�
index_urlsr�r!)�argsr�r�r�r�r�r�r0cs�t�j||�g|_t�|jd<t|d�|_tj|ddddgdd�}t	|d	�}|rxt
t|�||d
�}	tt|�|d�|_
nt||d�}	||_
|�d
|	�|�d|�|�dt��|D]}
|j|
dd�q�dS)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�r�)r�r�)r�r�zhttps://zhttp://zfile://T)�suppress_loggingN)r�r��pip_trusted_originsr�r�r�authr
�Retryr�rrr��_trusted_host_adapterr�mountr��add_trusted_host)r�r�r�r�r�r�r�r��insecure_adapter�secure_adapter�hostr�r6r7r�As6
�
��
zPipSession.__init__)�new_index_urlsr0cCs||j_dS)zn
        :param new_index_urls: New index urls to update the authentication
            handler with.
        N)r�r�)r�r�r6r6r7�update_index_urls�szPipSession.update_index_urlsF)r��sourcer�r0cCs�|s0d|��}|dk	r&|d|�d�7}t�|�t|�\}}|dkrRtd|����||f|jkrp|j�||f�|�t|dd�d|j�|�t|�d|j�|s�|�t|dd�d	|j�|�t|�d	|j�dS)
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 �)z+Trusted host URL must include a host part: �http)�scheme�/rd)	�logger�infor�
ValueErrorr��appendr�rr�)r�r�r�r��msgZparsed_hostZparsed_portr6r6r7r��s*	

��zPipSession.add_trusted_hostr/ccs6tEdH|jD] \}}d||dkr(dn|fVqdS)Nr&)r*r�)r�r��portr6r6r7�iter_secure_origins�s
zPipSession.iter_secure_origins)�locationr0c	Cs�tj�t|��}|j|j|j}}}|�dd�d}|��D]�}|\}}}	||kr^|dkr^q>zt	�
|pjd�}
t	�|�}Wn4tk
r�|r�|�
�|�
�kr�|dkr�Yq>YnX|
|kr�q>||	kr�|	dkr�|	dk	r�q>dSt�d||�dS)	N�+rN���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�urlparserFr��hostnamer��rsplitr��	ipaddress�
ip_address�
ip_networkr��lowerr��warning)r�r��parsed�origin_protocol�origin_host�origin_port�
secure_origin�secure_protocol�secure_host�secure_port�addr�networkr6r6r7�is_secure_origin�sJ�


���
����	zPipSession.is_secure_origin)�methodr�r�r�r0cs2|�d|j�|�d|j�t�j||f|�|�S)Nr^r�)rwr^r�r�r�)r�rr�r�r�r�r6r7r�szPipSession.request)NF)r�r�r�r^rr��__annotations__rrFr	rr�r�r�r�r�SecureOriginr�rr
rr�r�r6r6r�r7r�>s8
�
�O��!Cr�)Yr��email.utilsr�r�r�rh�loggingr�r2rir|r~rl�urllib.parser��warnings�typingrrrrrrrr	r
rrqrr
Zpip._vendor.cachecontrolrZ_BaseCacheControlAdapterZpip._vendor.requests.adaptersrrrZ_BaseHTTPAdapterZpip._vendor.requests.modelsrrZpip._vendor.requests.structuresrZ"pip._vendor.urllib3.connectionpoolrZpip._vendor.urllib3.exceptionsrr<rZpip._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 r�r!Zpip._vendor.urllib3.poolmanagerr"�	getLoggerr�r�rFr�r
�filterwarningsr*rr:r�r;r�r�r�r�r��Sessionr�r6r6r6r7�<module>sl0

�
e,"