
    *,hH                     8   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mZ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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" ddl#m$Z$ ddl%m&Z& ddl'm(Z(m)Z)m*Z*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5m6Z6m7Z7 ddl8m9Z9 e	rddl:m;Z;  ejx                  e=      Z>ded   fdZ? G d de      Z@ G d d ee@      ZAe7j                  e7j                  e7j                  gZEd&d!ZFd"e
de
fd#ZG G d$ d%eA      ZHy)'a  Contains the Command base classes that depend on PipSession.

The classes in this module are in a separate module so the commands not
needing download / PackageFinder capability don't unnecessarily import the
PackageFinder machinery and all its vendored dependencies, etc.
    N)partial)Values)TYPE_CHECKINGAnyListOptionalTuple)
WheelCache)
cmdoptions)Command)CommandContextMixIn)CommandErrorPreviousBuildDirError)LinkCollector)PackageFinder)SelectionPreferences)TargetPython)
PipSession)BuildTracker)RequirementPreparer)install_req_from_editableinstall_req_from_line#install_req_from_parsed_requirementinstall_req_from_req_string)parse_requirements)InstallRequirement)BaseResolver)pip_self_version_check)TempDirectoryTempDirectoryTypeRegistrytempdir_kinds)running_under_virtualenv)
SSLContextreturnr#   c                      t         j                  dk  rt        d      	 dd l} 	 dd l}|j                  | j                        S # t        $ r t
        j                  d       Y y w xY w# t        $ r t        d      w xY w)N)   
   z9The truststore feature is only available for Python 3.10+r   z1Disabling truststore since ssl support is missingz]To use the truststore feature, 'truststore' must be installed into pip's current environment.)
sysversion_infor   sslImportErrorloggerwarning
truststorer#   PROTOCOL_TLS_CLIENT)r*   r.   s     _/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pip/_internal/cli/req_command.py_create_truststore_ssl_contextr1   2   s    
'!VWW

   !8!899  JK  
)
 	

s   A A( A%$A%(A=c                        e Zd ZdZd fdZededeee	      fd       Z
dedefdZ	 	 	 ddedee   dee   d	ede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    r0   r7   zSessionCommandMixin.__init__M   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        r0   _get_index_urlsz#SessionCommandMixin._get_index_urlsQ   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.)r8   enter_context_build_session)r9   r<   s     r0   get_default_sessionz'SessionCommandMixin.get_default_session_   sB    ==  ..t/B/B7/KLDM ==,,}}r;   retriestimeoutfallback_to_certific                    |j                   }|r!t        j                  j                  |      sJ d|j                  v r	 t               }nd }t        |r t        j                  j                  |d      nd ||n|j                  |j                  | j                  |      |      }|j                  r|j                  |_        |j                  r|j                  |_        |j                  s|r||n|j                  |_        |j                   r|j                   |j                   d|_        |j$                   |j&                  _        |j*                  |j&                  _        |S # t        $ r	 |s d }Y *w xY w)Nr.   http)cacherM   trusted_hostsrE   ssl_context)rQ   https)	cache_dirospathisabsfeatures_enabledr1   	Exceptionr   joinrM   rS   rH   certverifyclient_certrN   proxyproxiesno_inputauth	promptingkeyring_provider)r9   r<   rM   rN   rO   rV   rT   sessions           r0   rK   z"SessionCommandMixin._build_sessioni   sB    %%	i 887333#<> K5>"'',,y&1D&2G!//++G4#
 <<$\\GN "..GL ??g)0)<g'//GO == GO &-%5%5!5(/(@(@%M  #*"#s   
E% %E76E7r$   N)NNF)__name__
__module____qualname____doc__r7   classmethodr   r   r   strrH   r   rL   intboolrK   __classcell__r:   s   @r0   r3   r3   G   s    3 "f "$s)1D " "6 j  "&!%$)33 #3 #	3
 "3 
3r;   r3   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
                        d      }|5  t        ||       ddd       y# 1 sw Y   yxY w)z
        Do the pip version check if not disabled.

        This overrides the default behavior of not doing the check.
        r>   Nr      T)rM   rN   rO   )hasattrdisable_pip_version_checkr>   rK   minrN   r   )r9   r<   rf   s      r0   handle_pip_version_checkz*IndexGroupCommand.handle_pip_version_check   sy     w
++,,0@0@ %%7??+
 !% & 	
  	5"7G4	5 	5 	5s   A))A2)rh   ri   rj   rk   r   ry    r;   r0   rs   rs      s    5 54 5r;   rs   c                      t               ryt        t        d      syt        j                  dk(  st        j                  dk(  ryt        j
                         dk7  ryt        j                  d       y)zOutput a warning for sudo users on Unix.

    In a virtual environment, sudo pip still writes to virtualenv.
    On Windows, users may run pip as Administrator without issues.
    This warning only applies to Unix root users outside of virtualenv.
    Ngetuidwin32cygwinr   zRunning pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv)r"   rv   rW   r(   platformr|   r,   r-   rz   r;   r0   warn_if_run_as_rootr      sX      !2x  ||w#,,(":	yy{a
NN	,r;   funcc           	      |     dt         ddfddt        dt        dt        t           dt
        t           f fd}|S )	zNDecorator for common logic related to managing temporary
    directories.
    registryr$   Nc                 >    t         D ]  }| j                  |d        y )NF)KEEPABLE_TEMPDIR_TYPES
set_delete)r   ts     r0   configure_tempdir_registryz0with_cleanup.<locals>.configure_tempdir_registry   s!    ' 	*A5)	*r;   r9   r<   argsc                     | j                   J |j                  r | j                          	  | ||      S # t        $ r  | j                           w xY wr5   )tempdir_registryno_cleanr   )r9   r<   r   r   r   s      r0   wrapperzwith_cleanup.<locals>.wrapper   sa     $$00&t'<'<=	gt,,$ 	 't'<'<=	s	   	9 A)r    RequirementCommandr   r   r   r   rn   )r   r   r   s   ` @r0   with_cleanupr      sK    
*-F *4 * +19=c	#  Nr;   c                   h    e Zd Zdededdf fdZededefd       Ze		 	 dde
ded	ed
edededee   dedefd       Ze		 	 	 	 	 	 	 	 ddedededee   dedededededee   deeedf      defd       Zdee   deded
edee   f
dZededdfd       Z	 	 d ded
edee   dee   def
dZ xZS )!r   r   kwr$   Nc                 ~    t        |   |i | | j                  j                  t	        j
                                y r5   )r6   r7   cmd_opts
add_optionr   r   )r9   r   r   r:   s      r0   r7   zRequirementCommand.__init__  s0    $%"%  !4!4!67r;   r<   c                 "    d| j                   v ryy)zEDetermines which resolver should be used, based on the given options.zlegacy-resolverlegacy2020-resolver)deprecated_features_enabledr<   s    r0   determine_resolver_variantz-RequirementCommand.determine_resolver_variant	  s      C CCr;   temp_build_dirbuild_trackerrf   finderuse_user_sitedownload_dir	verbosityc	                    |j                   }	|	J d}
| j                  |      }|dk(  r&d|j                  v }|r=t        j	                  d       n'd}
d}d|j                  v rt        j	                  d       t        |	|j                  ||j                  |j                  |||j                  ||j                  ||||
      S )zQ
        Create a RequirementPreparer instance for the given parameters.
        Fr   z	fast-depszpip is using lazily downloaded wheels using HTTP range requests to obtain dependency information. This experimental feature is enabled through --use-feature=fast-deps and it is not ready for production.Tz;fast-deps has no effect when used with the legacy resolver.)	build_dirsrc_dirr   build_isolationcheck_build_depsr   rf   progress_barr   require_hashesr   
lazy_wheelr   legacy_resolver)rX   r   rZ   r,   r-   r   r   r   r   r   r   )rD   r   r<   r   rf   r   r   r   r   temp_build_dir_pathr   resolver_variantr   s                r0   make_requirement_preparerz,RequirementCommand.make_requirement_preparer  s     -11"..99'B.$(@(@@J" #OJg666Q #)OO%#33$55' --"11'!+
 	
r;   preparerwheel_cacheignore_installedignore_requires_pythonforce_reinstallupgrade_strategy
use_pep517py_version_info.c                    t        t        |j                  |
      }| j                  |      }|dk(  rRddl}|j
                  j                  j                  j                  j                  ||||||j                  ||||	|      S ddl}|j
                  j                  j                  j                  j                  ||||||j                  ||||	|      S )zF
        Create a Resolver instance for the given parameters.
        )isolatedr   r   r   N)r   r   r   make_install_reqr   ignore_dependenciesr   r   r   r   r   )r   r   isolated_moder   ,pip._internal.resolution.resolvelib.resolver	_internal
resolution
resolvelibresolverResolverr   (pip._internal.resolution.legacy.resolverr   )rD   r   r   r<   r   r   r   r   r   r   r   r   r   r   pips                  r0   make_resolverz RequirementCommand.make_resolverH  s    $ #'**!

 99'B .?==++66??HH!'!1+$+$?$?!1'= /!1 / I   	8}}''..77@@#-' ' ; ;-#9+-+ A 
 	
r;   c                 *   g }|j                   D ]@  }t        |d|||      D ]+  }t        ||j                  d      }|j	                  |       - B |D ]C  }	t        |	d|j                  |j                  dt        |dd            }|j	                  |       E |j                  D ]B  }	t        |	d|j                  |j                  t        |dd            }|j	                  |       D |j                  D ]r  }t        ||||	      D ]^  }t        ||j                  |j                  d|j                  r|j                  j                  d      nd
      }|j	                  |       ` t t        d |D              rd|_        |s|j                  s|j                  std| j                  i}
|j                   r?t#         dj$                  di t'        |
dj)                  |j                                     t#         dj$                  di |
      |S )zS
        Parse command-line arguments into the corresponding requirements.
        T)
constraintr   r<   rf   F)r   user_suppliedNconfig_settings)
comes_fromr   r   r   r   )r   r   r   r   )r   r<   rf   )r   r   r   r   c              3   4   K   | ]  }|j                     y wr5   )has_hash_options).0reqs     r0   	<genexpr>z6RequirementCommand.get_requirements.<locals>.<genexpr>  s     <s##<s   namezXYou must give at least one requirement to {name} (maybe you meant "pip {name} {links}"?) )linkszHYou must give at least one requirement to {name} (see "pip help {name}")rz   )constraintsr   r   r   rB   r   r   rA   	editablesr   requirementsr<   getanyr   r   
find_linksr   formatdictr\   )r9   r   r<   r   rf   r   filename
parsed_req
req_to_addr   optss              r0   get_requirementsz#RequirementCommand.get_requirements  sW    24++ 	0H0 0
 A$22"'

 ##J/0	0  		,C. .."--" '1BD IJ 
+		, $$ 	,C2" .."-- '1BD IJ 
+	,  ,, 	0H0' 0
 A$22&11"&!)) %/$6$6$:$:;L$M
 ##J/0	0  <|<<%)G"))W-A-ADII&D!!"E >>Dft388G4F4F+GH  #5 ..4f=7;= 
 r;   c                 l    | j                   }|j                         }|rt        j                  |       yy)zE
        Trace basic information about the provided objects.
        N)search_scopeget_formatted_locationsr,   info)r   r   	locationss      r0   trace_basic_infoz#RequirementCommand.trace_basic_info  s1     ** 88:	KK	" r;   target_pythonc                     t        j                  ||      }t        d|j                  |j                  |j
                  |      }t        j                  |||      S )z
        Create a package finder appropriate to this requirement command.

        :param ignore_requires_python: Whether to ignore incompatible
            "Requires-Python" values in links. Defaults to False.
        r   T)allow_yankedformat_controlallow_all_prereleasesprefer_binaryr   )link_collectorselection_prefsr   )r   creater   r   prer   r   )r9   r<   rf   r   r   r   r   s          r0   _build_package_finderz(RequirementCommand._build_package_finder  s]     '--gwG."11")++!//#9
 ##)+'
 	
r;   )Nr   )NFTFFzto-satisfy-onlyNN)NN)rh   ri   rj   r   r7   staticmethodr   rm   r   rl   r   r   r   r   ro   r   rn   r   r   r
   r	   r   r   r   r   r   r   r   r   rp   rq   s   @r0   r   r     s!   8c 8 8 8
 F s    '+4
%4
 4
 $	4

 4
 4
 4
 sm4
 4
 
4
 4
l  -1#!%', % 1%)598
%8
 8
 	8

 j)8
 8
 8
 !%8
 8
 8
 TN8
 "%S/28
 
8
 8
tR3iR R 	R
 R 
 	!Rh # #4 # # 1515

 
  -	

 !)
 

r;   r   rg   )Irk   loggingrW   r(   	functoolsr   optparser   typingr   r   r   r   r	   pip._internal.cacher
   pip._internal.clir   pip._internal.cli.base_commandr   !pip._internal.cli.command_contextr   pip._internal.exceptionsr   r   pip._internal.index.collectorr   "pip._internal.index.package_finderr   $pip._internal.models.selection_prefsr   "pip._internal.models.target_pythonr   pip._internal.network.sessionr   ,pip._internal.operations.build.build_trackerr    pip._internal.operations.preparer   pip._internal.req.constructorsr   r   r   r   pip._internal.req.req_filer   pip._internal.req.req_installr   pip._internal.resolution.baser   !pip._internal.self_outdated_checkr   pip._internal.utils.temp_dirr   r    r!   pip._internal.utils.virtualenvr"   r*   r#   	getLoggerrh   r,   r1   r3   rs   	BUILD_ENVEPHEM_WHEEL_CACHE	REQ_BUILDr   r   r   r   rz   r;   r0   <module>r
     s    	 
   < < * ( 2 A H 7 < E ; 4 E @  : < 6 D 
 D			8	$:(> :*U- Up 5!4  5H ## <s s 8y
* y
r;   