o
    =g-                     @   s   d Z ddlZddlZddlZddlmZ ddlmZmZm	Z	 ddl
mZ ddlmZ ddlmZ er>ddlmZ dd	lmZ eeZd
e	d fddZG dd deZddded
dfddZG dd deeZdS )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)certifi)Command)CommandContextMixIn)
SSLContext
PipSessionreturnr	   c                  C   s   t jdk rtd d S zdd l} W n ty!   td Y d S w zddlm} W n ty9   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   R/var/www/html/venv/lib/python3.10/site-packages/pip/_internal/cli/index_command.py_create_truststore_ssl_context   s$   



r   c                	       sz   e Zd ZdZd fddZededeee	  fddZ
dedd	fd
dZ		ddedee dee dd	fddZ  ZS )SessionCommandMixinzE
    A class mixin for command classes needing _build_session().
    r   Nc                    s   t    d | _d S )N)super__init___session)self	__class__r   r   r!   7   s   

zSessionCommandMixin.__init__optionsc                 C   sL   g }t |ddst |dd}|r|| t |dd}|r"|| |p%dS )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_urls;   s   

z#SessionCommandMixin._get_index_urlsr   c                 C   s0   | j du r| | || _ | j dusJ | j S )zGet a default-managed session.N)r"   enter_context_build_session)r#   r&   r   r   r   get_default_sessionI   s   
z'SessionCommandMixin.get_default_sessionretriestimeoutc                 C   s   ddl m} |j}|rtj|sJ d|jvrt }nd }||r(tj|dnd |d ur/|n|j	|j
| ||d}|jrB|j|_|jrI|j|_|jsN|rX|d urT|n|j|_|jrj|j|jd|_d|_|j|_|j |j_|j|j_|S )Nr   r
   zlegacy-certszhttp-v2)cacher5   trusted_hostsr.   ssl_context)httphttpsF)pip._internal.network.sessionr   	cache_dirospathisabsdeprecated_features_enabledr   joinr5   r8   r1   certverifyclient_certr6   proxyproxies	trust_env	pip_proxyno_inputauth	promptingkeyring_provider)r#   r&   r5   r6   r   r=   r9   sessionr   r   r   r3   S   s8   
	

z"SessionCommandMixin._build_session)r   N)NN)__name__
__module____qualname____doc__r!   classmethodr   r   r   strr1   r4   intr3   __classcell__r   r   r$   r   r   2   s"    r   rN   r   r&   c                 C   s   ddl m} || | d S )Nr   )pip_self_version_check)!pip._internal.self_outdated_checkrW   )rN   r&   checkr   r   r   _pip_self_version_check   s   rZ   c                   @   s"   e Zd ZdZdeddfddZdS )IndexGroupCommandz
    Abstract base class for commands with the index_group options.

    This also corresponds to the commands that permit the pip version check.
    r&   r   Nc                 C   s   t |dsJ |js|jrdS z(| j|dtd|jd}| t|| W d   W dS 1 s0w   Y  W dS  tyM   t	d tj
ddd	 Y dS w )
z
        Do the pip version check if not disabled.

        This overrides the default behavior of not doing the check.
        r'   Nr      )r5   r6   z6There was an error checking the latest version of pip.zSee below for errorT)exc_info)hasattrdisable_pip_version_checkr'   r3   minr6   rZ   	Exceptionr   r   r   )r#   r&   rN   r   r   r   handle_pip_version_check   s    
&
z*IndexGroupCommand.handle_pip_version_check)rO   rP   rQ   rR   r   rb   r   r   r   r   r[      s    r[   )rR   loggingr>   r   optparser   typingr   r   r   r   r   pip._internal.cli.base_commandr   !pip._internal.cli.command_contextr   r   r	   r<   r   	getLoggerrO   r   r   r   rZ   r[   r   r   r   r   <module>   s"    
U