OwlCyberSecurity - MANAGER
Edit File: index_command.cpython-39.pyc
a �F�f� � @ s� d Z ddlZddlZddlZddlmZ ddlmZmZm Z ddl mZ ddlm Z ddlmZ er|ddlmZ dd lmZ e�e�Ze d d�dd �ZG dd� de �Zdedd�dd�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. � N)�Values)� TYPE_CHECKING�List�Optional)�Command)�CommandContextMixIn)�CommandError)� SSLContext�� PipSessionr ��returnc C s� t jdk rtd��zdd l} W n ty< t�d� Y d S 0 zddlm} W n2 ty� } ztd|� ���W Y d }~n d }~0 0 |� | j �S )N)� � z9The truststore feature is only available for Python 3.10+r z1Disabling truststore since ssl support is missing)� truststorez'The truststore feature is unavailable: )�sys�version_infor �ssl�ImportError�logger�warningZpip._vendorr r �PROTOCOL_TLS_CLIENT)r r �e� r �a/home/gouroczh/virtualenv/test/3.9/lib/python3.9/site-packages/pip/_internal/cli/index_command.py�_create_truststore_ssl_context s $r c sr e Zd ZdZdd�� fdd�Zeeeee d�dd��Z ed d�d d�Zdeee ee e d d �dd�Z� ZS )�SessionCommandMixinzE A class mixin for command classes needing _build_session(). Nr c s t � �� d | _d S )N)�super�__init__�_session)�self�� __class__r r r 2 s zSessionCommandMixin.__init__��optionsr c C sL g }t |dd�s*t |dd�}|r*|�|� t |dd�}|rD|�|� |pJdS )z7Return a list of index urls from user-provided options.�no_indexF� index_urlN�extra_index_urls)�getattr�append�extend)�clsr$ � index_urls�url�urlsr r r �_get_index_urls6 s z#SessionCommandMixin._get_index_urlsr c C s0 | j du r*| �| �|��| _ | j dus*J �| j S )zGet a default-managed session.N)r � enter_context�_build_session)r r$ r r r �get_default_sessionD s z'SessionCommandMixin.get_default_sessionF)r$ �retries�timeout�fallback_to_certifir c C s ddl m} |j}|r&tj�|�s&J �d|jv rZz t� }W q^ tyV |sN� d }Y q^0 nd }||rrtj� |d�nd |d ur�|n|j |j| �|�|d�}|j r�|j |_|jr�|j|_ |js�|r�|d ur�|n|j|_|jr�|j|jd�|_d|_|j |j_|j|j_|S )Nr r r zhttp-v2)�cacher3 � trusted_hostsr, �ssl_context)�http�httpsF)�pip._internal.network.sessionr � cache_dir�os�path�isabs�features_enabledr � Exception�joinr3 r7 r/ �cert�verify�client_certr4 �proxy�proxiesZ trust_env�no_input�authZ prompting�keyring_provider) r r$ r3 r4 r5 r r<