HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/pip/_internal/network/__pycache__/session.cpython-310.pyc
o

��h�J�@s�UdZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlmZmZmZddlmZmZmZmZddlmZmZddlm Z!ddl"m#Z#m$Z$dd	l"m%Z&dd
l'm(Z(m)Z)ddl*m+Z+ddl,m-Z-dd
l.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9ddl:m;Z;ddl<m=Z=ddl>m?Z?m@Z@ddlAmBZBer�ddlCmDZDddlEmFZFddlGmHZHe	�IeJ�ZKeLeMeMeeeNeMffZOejPde/d�gd�ZQdeRd<dZSd7d"d#�ZTejUd$d%�d8d'd(��ZVGd)d*�d*e$�ZWGd+d,�d,�ZXGd-d.�d.eXe&�Z%Gd/d0�d0eXe!�Z Gd1d2�d2e%�ZYGd3d4�d4e �ZZGd5d6�d6ej[�Z\dS)9zhPipSession and supporting code, containing all pip-specific
network request configuration and behavior.
�)�annotationsN)�	Generator�Mapping�Sequence)�
TYPE_CHECKING�Any�Optional�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)�ProxyManager�ignore)�category))�https�*r%)r%�	localhostr%)r%z127.0.0.0/8r%)r%z::1/128r%)�filer%N)�sshr%r%zlist[SecureOrigin]�SECURE_ORIGINS)�
BUILD_BUILDID�BUILD_ID�CI�	PIP_IS_CI�return�boolcCstdd�tD��S)z?
    Return whether it looks like pip is running under CI.
    css�|]}|tjvVqdS�N)�os�environ)�.0�name�r5�H/usr/local/lib/python3.10/dist-packages/pip/_internal/network/session.py�	<genexpr>is�z looks_like_ci.<locals>.<genexpr>)�any�CI_ENVIRONMENT_VARIABLESr5r5r5r6�
looks_like_cibsr:�)�maxsize�strc
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)r4�versionr4)�	installer�python�implementationrB�CPythonr?�PyPy�finalN��.cSsg|]}t|��qSr5)r=)r3�xr5r5r6�
<listcomp>�szuser_agent.<locals>.<listcomp>�Jython�
IronPython�linuxr)�distrocS�|dS�Nr;r5�rHr5r5r6�<lambda>��zuser_agent.<locals>.<lambda>)r4r?�idcSrNrOr5rPr5r5r6rQ�rR�lib�libcrM�darwin�macOS�system�release�cpu�openssl_version�
setuptools�setuptools_version�rustcz	--versiong�?)�stderr�timeoutsrustc � r;�
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._vendorrMr4r?�codename�dict�filter�zipr�mac_verrX�
setdefaultrY�machiner�_ssl�OPENSSL_VERSIONr�get_distributionr=�shutil�which�
subprocess�check_output�STDOUT�	Exception�split�decoder:r1r2�get�formatrk�dumps)
rjrprM�linux_distribution�distro_infosrU�ssl�setuptools_dist�rustc_outputrer5r5r6�
user_agentls���
�����


��
�r�c@s,eZdZ					dddd�Zddd�ZdS)�LocalFSAdapterFNT�requestr�streamr/r`�"float | tuple[float, float] | None�verify�
bool | str�cert�str | tuple[str, str] | None�proxies�Mapping[str, str] | Noner.rc

Cs�t|j�}t�}d|_|j|_zt�|�}	Wn*ty@}
zd|_t|
�j|_	t
�|j	�d|
�����|_
WYd}
~
|Sd}
~
wwtjj|	jdd�}t�|�dpRd}t||	j|d��|_t|d	�|_
|j
j|_|S)
N��i�z: T)�usegmtrz
text/plain)zContent-TypezContent-Lengthz
Last-Modified�rb)r�urlr�status_coder1�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_typer5r5r6�send�s0
	&����
zLocalFSAdapter.send�NonecCsdSr0r5)r�r5r5r6r��szLocalFSAdapter.close)FNTNN)r�rr�r/r`r�r�r�r�r�r�r�r.r)r.r�)r��
__module__�__qualname__r�r�r5r5r5r6r��s�'r�csHeZdZdZdd�d�fd
d�Zefd�fdd�
Zd�fdd�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��SSLContext | None�kwargsrr.r�cs||_t�jdi|��dS)Nr5)�_ssl_context�super�__init__)r�r�r���	__class__r5r6r�sz _SSLContextAdapterMixin.__init__�connections�intr<�blockr/�pool_kwargsr cs2|jdur|�d|j�t�jd|||d�|��S)Nr�)r�r<r�r5)r�rzr��init_poolmanager)r�r�r<r�r�r�r5r6r�s
��z(_SSLContextAdapterMixin.init_poolmanager�proxyr=�proxy_kwargsr!cs,|jdur|�d|j�t�j|fi|��S)Nr�)r�rzr��proxy_manager_for)r�r�r�r�r5r6r�s
z)_SSLContextAdapterMixin.proxy_manager_for)r�r�r�rr.r�)
r�r�r<r�r�r/r�rr.r )r�r=r�rr.r!)	r�r�r��__doc__r�r
r�r��
__classcell__r5r5r�r6r��s
�
�r�c@�eZdZdS)rN�r�r�r�r5r5r5r6r'�rc@r�)rNr�r5r5r5r6r+r�rc�eZdZd
�fdd�Z�ZS)�InsecureHTTPAdapter�connrr�r=r�r�r�r�r.r�c�t�j||d|d�dS�NF)r�r�r�r��r��cert_verify�r�r�r�r�r�r�r5r6r�0�zInsecureHTTPAdapter.cert_verify�
r�rr�r=r�r�r�r�r.r��r�r�r�r�r�r5r5r�r6r�/�r�cr�)�InsecureCacheControlAdapterr�rr�r=r�r�r�r�r.r�cr�r�r�r�r�r5r6r�;r�z'InsecureCacheControlAdapter.cert_verifyr�r�r5r5r�r6r�:r�r�csteZdZUdZded<dddddd�d0�fdd�Zd1dd�Z	d2d3d"d#�Zd4d%d&�Zd5d)d*�Z	d6�fd.d/�Z
�ZS)7�
PipSessionNz
int | Noner`rr5)�retries�cache�
trusted_hosts�
index_urlsr��argsrr�r�r��
str | Noner��
Sequence[str]r��list[str] | Noner�r�r�r.r�cs�t�j|i|��g|_d|_t�|jd<t|d�|_tj	|gd�dd�}t
|d�}|r?tt|�||d�}	t
t|�|d	�|_n	t||d
�}	||_|�d|	�|�d|�|�d
t��|D]	}
|j|
dd�q]dS)zj
        :param trusted_hosts: Domains not to emit warnings for when not using
            HTTPS.
        Nz
User-Agent)r�)i�i�i�iig�?)�total�status_forcelist�backoff_factor)�max_retries)r�r�r�)r�r�)r�r�zhttps://zhttp://zfile://T)�suppress_logging)r�r��pip_trusted_origins�	pip_proxyr�r�r�authr�Retryr�rrr��_trusted_host_adapterr�mountr��add_trusted_host)r�r�r�r�r�r�r�r��insecure_adapter�secure_adapter�hostr�r5r6r�Hs:�
�
��zPipSession.__init__�new_index_urls�	list[str]cCs||j_dS)zn
        :param new_index_urls: New index urls to update the authentication
            handler with.
        N)r�r�)r�r�r5r5r6�update_index_urls�szPipSession.update_index_urlsFr�r=�sourcer�r/cCs�|sd|��}|dur|d|�d�7}t�|�t|�\}}|dur)td|����||f|jvr8|j�||f�|�t|dd�d|j�|�t|�d|j�|sl|�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 �)z+Trusted host URL must include a host part: �http)�scheme�/rg)	�logger�infor�
ValueErrorr��appendr�rr�)r�r�r�r��msg�parsed_host�parsed_portr5r5r6r��s*	

���zPipSession.add_trusted_host�#Generator[SecureOrigin, None, None]ccs8�tEdH|jD]\}}d||durdn|fVq	dS)Nr%)r)r�)r�r��portr5r5r6�iter_secure_origins�s
�
�zPipSession.iter_secure_origins�locationrc	Cs�tj�t|��}|j|j|j}}}|�dd�d}|��D]L}|\}}}	||kr/|dkr/qzt	�
|p5d�}
t	�|�}WntyV|rT|�
�|�
�krT|dkrTYqYnw|
|vr\q||	kri|	dkri|	duriqdSt�d||�dS)	N�+r;���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�urlparser=r��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�networkr5r5r6�is_secure_origin�sD
�

����	zPipSession.is_secure_origin�methodr�rcs8|�d|j�|�d|j�t�j||g|�Ri|��S)Nr`r�)rzr`r�r�r�)r�r#r�r�r�r�r5r6r�	szPipSession.request)r�rr�r�r�r�r�r�r�r�r�r�r�rr.r�)r�r�r.r�)NF)r�r=r�r�r�r/r.r�)r.r)r
rr.r/)
r#r=r�r=r�rr�rr.r)r�r�r�r`�__annotations__r�r�r�r	r"r�r�r5r5r�r6r�Es
�
Q�
!
Cr�)r.r/)r.r=)]r��
__future__r�email.utilsr��	functoolsr�rrk�loggingr�r1rlrr�ro�urllib.parser�warnings�collections.abcrrr�typingrrrr	rtr
r�pip._vendor.cachecontrolr�_BaseCacheControlAdapter�pip._vendor.requests.adaptersr
rr�_BaseHTTPAdapter�pip._vendor.requests.modelsrr�pip._vendor.requests.structuresr�"pip._vendor.urllib3.connectionpoolr�pip._vendor.urllib3.exceptionsrr>r�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.urlsrr�r�pip._vendor.urllib3.poolmanagerr � pip._vendor.urllib3.proxymanagerr!�	getLoggerr�r�tupler=r��SecureOrigin�filterwarningsr)r$r9r:�	lru_cacher�r�r�r�r��Sessionr�r5r5r5r6�<module>sl



e,)