File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/pip/_internal/cli/__pycache__/index_command.cpython-310.pyc
Back
o ;jU � @ s� d Z ddlmZ ddlZddlZddlZddlmZ ddlm Z ddl mZ ddlm Z ddlmZ dd lmZ erFdd lmZ ddlmZ e�e�Zeddd��ZG dd� de�Zddd�ZG dd� dee�ZdS )a& Contains command classes which may interact with an index / the network. Unlike its sister module, req_command, this module still uses lazy imports so commands which don't always hit the network (e.g. list w/o --outdated or --uptodate) don't need waste time importing PipSession and friends. � )�annotationsN)� lru_cache)�Values)� TYPE_CHECKING)�certifi)�Command)�CommandContextMixIn)� SSLContext�� PipSession�return�SSLContext | Nonec C s� t jdk rt�d� d S zdd l} W n ty! t�d� Y d S w zddlm} W n ty9 t�d� Y d S w |� | j �}|�t� � � |S )N)� � z7Disabling truststore because Python version isn't 3.10+r z1Disabling truststore since ssl support is missing)� truststorez5Disabling truststore because platform isn't supported)�sys�version_info�logger�debug�ssl�ImportError�warning�pip._vendorr r �PROTOCOL_TLS_CLIENT�load_verify_locationsr �where)r r �ctx� r �S/opt/saltstack/salt/lib/python3.10/site-packages/pip/_internal/cli/index_command.py�_create_truststore_ssl_context s$ � �r c sJ e Zd ZdZd� fdd�Zedd d ��Zddd �Z dddd�Z� Z S )�SessionCommandMixinzE A class mixin for command classes needing _build_session(). r �Nonec s t � �� d | _d S )N)�super�__init__�_session)�self�� __class__r r r# ; s zSessionCommandMixin.__init__�optionsr �list[str] | Nonec C sL g }t |dd�st |dd�}|r|�|� t |dd�}|r"|�|� |p%dS )z7Return a list of index urls from user-provided options.�no_indexFZ index_urlNZextra_index_urls)�getattr�append�extend)�clsr( � index_urls�urlZurlsr r r �_get_index_urls? s z#SessionCommandMixin._get_index_urlsr c C s0 | j du r| �| �|��| _ | j dusJ �| j S )zGet a default-managed session.N)r$ � enter_context�_build_session)r% r( r r r �get_default_sessionM s z'SessionCommandMixin.get_default_sessionN�retries� int | None�timeoutc C s� ddl m} |j}|rtj�|�sJ �d|jvrt� }nd }||r(tj�|d�nd |d ur/|n|j |j | �|�|d�}|jrB|j|_ |jrI|j|_|jsN|rX|d urT|n|j|_|jrj|j|jd�|_d|_|j|_|j |j_|j|j_|S )Nr r zlegacy-certszhttp-v2)�cacher5 � trusted_hostsr/ �ssl_context)�http�httpsF)�pip._internal.network.sessionr � cache_dir�os�path�isabsZdeprecated_features_enabledr �joinr5 r9 r1 �certZverifyZclient_certr7 �proxyZproxiesZ trust_envZ pip_proxyZno_inputZauthZ promptingZkeyring_provider)r% r( r5 r7 r r>