
    dhU                        d Z ddlm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 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d       Z G d de      Zd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.
    )annotationsN)	lru_cache)Values)TYPE_CHECKING)certifi)Command)CommandContextMixIn)
SSLContext
PipSessionc                 |   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      a/var/www/html/vivango/api/ia/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                  Z     e Zd ZdZd fdZedd       ZddZ	 	 d		 	 	 	 	 	 	 d
dZ xZ	S )SessionCommandMixinzE
    A class mixin for command classes needing _build_session().
    c                0    t         |           d | _        y )N)super__init___session)self	__class__s    r   r#   zSessionCommandMixin.__init__;   s    +/    c                    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)clsoptions
index_urlsurlurlss        r   _get_index_urlsz#SessionCommandMixin._get_index_urls?   s_     
w
E2';5C!!#&w 2D9d#!T!r'   c                    | j                   3| j                  | j                  |            | _         | j                   J | j                   S )zGet a default-managed session.)r$   enter_context_build_session)r%   r0   s     r   get_default_sessionz'SessionCommandMixin.get_default_sessionM   sE    ==  ..t/B/B7/KLDM ==,,,}}r'   c                   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)cacheretriestrusted_hostsr1   ssl_context)httphttpsF)pip._internal.network.sessionr   	cache_dirospathisabsdeprecated_features_enabledr   joinr;   r<   r4   certverifyclient_certtimeoutproxyproxies	trust_env	pip_proxyno_inputauth	promptingkeyring_provider)r%   r0   r;   rJ   r   rA   r=   sessions           r   r7   z"SessionCommandMixin._build_sessionW   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'   )returnNone)r0   r   rT   zlist[str] | None)r0   r   rT   r   )NN)r0   r   r;   
int | NonerJ   rV   rT   r   )
__name__
__module____qualname____doc__r#   classmethodr4   r8   r7   __classcell__)r&   s   @r   r    r    6   sY    0 " " #"	11 1 	1
 
1r'   r    c                "    ddl m}  || |       y )Nr   )pip_self_version_check)!pip._internal.self_outdated_checkr^   )rS   r0   checks      r   _pip_self_version_checkra      s    Q	'7r'   c                      e Zd ZdZd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.
    c                `   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;   rJ   z6There was an error checking the latest version of pip.zSee below for errorT)exc_info)hasattrdisable_pip_version_checkr)   r7   minrJ   ra   	Exceptionr   r   r   )r%   r0   rS   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-N)r0   r   rT   rU   )rW   rX   rY   rZ   rk    r'   r   rc   rc      s    ?r'   rc   )rT   zSSLContext | None)rS   r   r0   r   rT   rU   )rZ   
__future__r   loggingrB   r   	functoolsr   optparser   typingr   r   r   pip._internal.cli.base_commandr   !pip._internal.cli.command_contextr	   r   r
   r@   r   	getLoggerrW   r   r   r    ra   rc   rl   r'   r   <module>ru      s}    #  	 
      2 A8			8	$  ,R- Rj?!4 ?r'   