
    )hX                        d Z ddlZddlZddlZddlm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j,                  e      Zeded   fd       Z G d de      ZdddeddfdZ G d dee      Zy)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)	lru_cache)Values)TYPE_CHECKINGListOptional)certifi)Command)CommandContextMixIn)
SSLContext
PipSessionreturnr   c                  |   t         j                  dk  rt        j                  d       y 	 dd l} 	 ddlm} |j                  | j                        }|j                  t        j                                |S # t
        $ r t        j                  d       Y y w xY w# t
        $ r t        j                  d       Y y w xY w)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   ctxs      R/var/www/html/venv/lib/python3.12/site-packages/pip/_internal/cli/index_command.py_create_truststore_ssl_contextr       s    
'!NO
*
 

 7 7
8Cgmmo.J  JK  NOs"   A6 B 6BBB;:B;c            	            e Zd ZdZd fdZededeee	      fd       Z
deddfdZ	 	 ddedee   d	ee   ddfd
Z xZS )SessionCommandMixinzE
    A class mixin for command classes needing _build_session().
    r   c                 0    t         |           d | _        y )N)super__init___session)self	__class__s    r   r%   zSessionCommandMixin.__init__9   s    .2    optionsc                     g }t        |dd      s t        |dd      }|r|j                  |       t        |dd      }|r|j                  |       |xs 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urlss        r   _get_index_urlsz#SessionCommandMixin._get_index_urls=   s_     
w
E2';5C!!#&w 2D9d#!T!r)   r   c                     | j                   3| j                  | j                  |            | _         | j                   J | j                   S )zGet a default-managed session.)r&   enter_context_build_session)r'   r*   s     r   get_default_sessionz'SessionCommandMixin.get_default_sessionK   sE    ==  ..t/B/B7/KLDM ==,,,}}r)   retriestimeoutc                    ddl m} |j                  }|r!t        j                  j                  |      sJ d|j                  vrt               }nd } ||r t        j                  j                  |d      nd ||n|j                  |j                  | j                  |      |      }|j                  r|j                  |_        |j                  r|j                  |_        |j                  s|r||n|j                  |_        |j                   r6|j                   |j                   d|_        d|_        |j                   |_        |j(                   |j*                  _        |j.                  |j*                  _        |S )Nr   r   zlegacy-certszhttp-v2)cacher;   trusted_hostsr3   ssl_context)httphttpsF)pip._internal.network.sessionr   	cache_dirospathisabsdeprecated_features_enabledr    joinr;   r?   r6   certverifyclient_certr<   proxyproxies	trust_env	pip_proxyno_inputauth	promptingkeyring_provider)r'   r*   r;   r<   r   rD   r@   sessions           r   r9   z"SessionCommandMixin._build_sessionU   s:    	=%%	i 888!D!DD8:KK8A"'',,y)4t&2G!//++G4#
 <<$\\GN "..GL ??g)0)<g'//GO == GO !&G 'G &-%5%5!5(/(@(@%r)   )r   N)NN)__name__
__module____qualname____doc__r%   classmethodr   r   r   strr6   r:   intr9   __classcell__)r(   s   @r   r"   r"   4   s    3 "f "$s)1D " "6 l  "&!%	11 #1 #	1
 
1r)   r"   rU   r   r*   c                 "    ddl m}  || |       y )Nr   )pip_self_version_check)!pip._internal.self_outdated_checkr_   )rU   r*   checks      r   _pip_self_version_checkrb      s    Q	'7r)   c                        e Zd ZdZdeddfdZy)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                 `   t        |d      sJ |j                  s|j                  ry	 | j                  |dt	        d|j
                              }|5  t        ||       ddd       y# 1 sw Y   yxY w# t        $ r/ t        j                  d       t        j                  dd	       Y yw xY w)
z
        Do the pip version check if not disabled.

        This overrides the default behavior of not doing the check.
        r,   Nr      )r;   r<   z6There was an error checking the latest version of pip.zSee below for errorT)exc_info)hasattrdisable_pip_version_checkr,   r9   minr<   rb   	Exceptionr   r   r   )r'   r*   rU   s      r   handle_pip_version_checkz*IndexGroupCommand.handle_pip_version_check   s     w
+++,,0@0@	?))Aw/ * G
  :'9: : : 	?NNSTLL.L>	?s/   *A5 A) A5 )A2.A5 2A5 55B-,B-)rV   rW   rX   rY   r   rl    r)   r   rd   rd      s    ? ?4 ?r)   rd   )rY   loggingrE   r   	functoolsr   optparser   typingr   r   r   r   r   pip._internal.cli.base_commandr	   !pip._internal.cli.command_contextr
   r   r   rC   r   	getLoggerrV   r   r    r"   rb   rd   rm   r)   r   <module>ru      s     	 
   0 0  2 A8			8	$ (>  ,R- Rj\ F t ?!4 ?r)   