
    q"hG                        S r SSKrSSKrSSKrSSKrSSKJr  SSKJrJ	r	J
r
JrJrJrJr  SSKJr  SSKJrJr  SSKJr  SSKJr  SS	KJrJr  SS
KJr  SSKJr  SSKJ r   SSK!J"r"  SSK#J$r$  SSK%J&r&  SSK'J(r(  SSK)J*r*  SSK+J,r,J-r-  / SQr.\R^                  " \05      r1\Rd                  Rg                  5       r4S\5S\\5\\5   4   4S jr6S\\5   S\\5   4S jr7S\S\\5   S\4S jr8S\5S\\\5   \5\\5   4   4S jr9S\5SS4S jr:S\5S\54S  jr;\" S!S"9 " S# S$5      5       r<S\5S\<4S% jr= SBSS&SSS&S&S&SS'.S\5S(\\\"\54      S)\\>   S*\>S+\\
\5      S,\\	\5\
\5   4      S-\>S.\>S/\>S0\\	\5\\5\
\5   4   4      S\"4S1 jjjr?S2\5S\>4S3 jr@S\5S2\5S\\5   4S4 jrAS2\5S5\\5   S\<4S6 jrB SBSS&SSS&SS&SS7.S2\5S(\\\5\"4      S)\\>   S*\>S+\\
\5      S,\\	\5\
\5   4      S-\>S5\\5   S.\>S0\\	\5\\5\
\5   4   4      S\"4S8 jjjrC    SCS9\5S(\\"   S*\>S)\\>   S.\>S\"4S: jjrD    SDS;\ S*\>S)\\>   S.\>S0\\	\5\\5\
\5   4   4      S\"4S< jjrES=\S>\"S\"4S? jrFS>\"S\"4S@ jrGS>\"S\\5   S\"4SA jrHg)Ea~  Backing implementation for InstallRequirement's various constructors

The idea here is that these formed a major chunk of InstallRequirement's size
so, moving them and support code dedicated to them outside of that class
helps creates for better understandability for the rest of the code.

These are meant to be used elsewhere within pip to create instances of
InstallRequirement.
    N)	dataclass)
CollectionDictListOptionalSetTupleUnion)Marker)InvalidRequirementRequirement)	Specifier)InstallationError)PyPITestPyPI)Link)Wheel)ParsedRequirement)InstallRequirement)is_archive_file)is_installable_dir)get_requirement)path_to_url)is_urlvcs)install_req_from_editableinstall_req_from_lineparse_editablepathreturnc                     [         R                  " SU 5      nS nU(       a%  UR                  S5      nUR                  S5      nX24$ U nX24$ )Nz^(.+)(\[[^\]]+\])$      )rematchgroup)r   mextraspath_no_extrass       P/var/www/html/env/lib/python3.13/site-packages/pip/_internal/req/constructors.py_strip_extrasr+   ,   sP    
&-AF !! !!    r(   c                 p    U (       d
  [        5       $ [        SU R                  5       -   5      R                  $ )Nplaceholder)setr   lowerr(   )r(   s    r*   convert_extrasr1   8   s(    u=6<<>9:AAAr,   req
new_extrasc                 d   [         R                  " S[        U 5      [         R                  S9nUc   SU  S35       eUR	                  S5      nUR	                  S5      nUb  Uc   SU  S35       eSR                  U(       a  S	R                  [        U5      5      OS
5      n[        U U U 35      $ )z
Returns a new requirement based on the given one, with the supplied extras. If the
given requirement already has extras those are replaced (or dropped if no new extras
are given).
z([\w\t .-]+)(\[[^\]]*\])?(.*))flagszregex match on requirement z! failed, this should never happenr"      z&regex group selection for requirement z[{}], )	r$   	fullmatchstrASCIIr&   formatjoinsortedr   )r2   r3   r%   prepostr(   s         r*   _set_requirement_extrasrA   >   s     &(\\(Chh	&E 	L	$SE)JKLQC++a.DD,W	/u4UVW,--

); <PRSFcU6(4&122r,   editable_reqc                    U n[        U5      u  p#[        R                  R                  U5      (       a  [	        U5      nUR                  5       R                  S5      (       aQ  [        U5      R                  nU(       a)  UU[        SUR                  5       -   5      R                  4$ XB[        5       4$ [         H3  nUR                  5       R                  U S35      (       d  M,  U SU 3n  O   [        U5      nUR                  (       d0  SR                  [        R                  5      n[!        U  SU S35      eUR                  nU(       d  [!        SU  S	35      eXA[        5       4$ )
zParses an editable requirement into:
    - a requirement name
    - an URL
    - extras
    - editable options
Accepted requirements:
    svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir
    .[some_extra]
zfile:r.   :+z, zq is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with z).z'Could not detect requirement name for 'z1', please specify one with #egg=your_package_name)r+   osr   isdirr   r0   
startswithr   egg_fragmentr   r(   r/   r   is_vcsr=   all_schemesr   )rB   urlurl_no_extrasr(   package_nameversion_controllinkbackendss           r*   r   r   W   s\    C *#.M	ww}}]###M2''00M*77 >?FF   5599;!!_$5Q"788$%Qse,C 
 9D;;99S__-n 'j,
 	
 $$L5l^ D= =
 	
 ce##r,   filenamec                 F   [        U SSS9 nS S U 5        5       nU Hf  nSU;   a  USUR                  S5       nUR                  S5      (       a   USS	 R                  5       [	        US
5      -   n[        U5          SSS5        g   SSS5        g! , (       d  f       g= f)a  Check if file is parsable as a requirements file.

This is heavily based on ``pkg_resources.parse_requirements``, but
simplified to just check the first meaningful line.

:raises InvalidRequirement: If the first meaningful line cannot be parsed
    as an requirement.
zutf-8ignore)encodingerrorsc              3   h   #    U  H(  nU(       d  M  UR                  S 5      (       a  M$  Uv   M*     g7f)#N)rH   .0lines     r*   	<genexpr>2check_first_requirement_in_file.<locals>.<genexpr>   s-      
4  OOC0 D4s   22	2c              3   @   #    U  H  oR                  5       v   M     g 7fN)striprY   s     r*   r\   r]      s     4!$!s   z #N\r8   )openfindendswithr`   nextr   )rR   flinesr[   s       r*   check_first_requirement_in_fileri      s     
h	:a
4!4
 Dt|-diio.}}T""CRy(4r?:D!! 
;	:  
;	:	:s   A2BB
B c                     [         R                  R                  U 5      (       d  SU  S3$ Sn [        U 5        USU  S3-  nU$ ! [         a    [
        R                  SU 5         U$ f = f)zxReturns helpful msg in case requirements file does not exist,
or cannot be parsed.

:params req: Requirements file path
z File 'z' does not exist.z The path does exist. zThe argument you provided (zx) appears to be a requirements file. If that is the case, use the '-r' flag to install the packages specified within it.z&Cannot parse '%s' as requirements file)rF   r   existsri   r   loggerdebug)r2   msgs     r*   deduce_helpful_msgro      s     77>>#.//
"C
', 	u 12	
 J  D=sC JDs   A  A('A(T)frozenc                   V    \ rS rSr% \\   \S'   \\   \S'   \\   \S'   \	\
   \S'   Srg)RequirementParts   requirementrP   markersr(    N)__name__
__module____qualname____firstlineno__r   r   __annotations__r   r   r   r:   __static_attributes__rv   r,   r*   rr   rr      s,    +&&
4.fHr,   rr   c                     [        U 5      u  pnUb   [        U5      nOS n[	        U5      n[        XFS U5      $ ! [         a  n[        SU< SU 35      eS nAff = f)NInvalid requirement: : )r   r   r   r   r   rr   )rB   namerL   extras_overrider2   excrP   s          r*   parse_req_from_editabler      ss    !/!=D	M)8)>C 9DCt_== " 	M#&;D82cU$KLL	Ms   9 
AAAF)
use_pep517isolatedglobal_optionshash_options
constraintuser_suppliedpermit_editable_wheelsconfig_settings
comes_fromr   r   r   r   r   r   r   r   c                ~    [        U 5      n
[        U
R                  UUSUU
R                  UUUUUU	U
R                  S9$ )NT)r   r   editabler   rP   r   r   r   r   r   r   r(   )r   r   rt   rP   r(   )rB   r   r   r   r   r   r   r   r   r   partss              r*   r   r      sP     $L1E#5ZZ%!'|| r,   r   c                     [         R                  R                  U ;   a  g[         R                  R                  b  [         R                  R                  U ;   a  gU R	                  S5      (       a  gg)aS  Checks whether the string "looks like" a path on the filesystem.

This does not check whether the target actually exists, only judge from the
appearance.

Returns true if any of the following conditions is true:
* a path separator is found (either os.path.sep or os.path.altsep);
* a dot is found (which represents the current directory).
T.F)rF   r   sepaltseprH   )r   s    r*   _looks_like_pathr      sL     
ww{{d	ww~~!bggnn&<sr,   c                    [        U5      (       aO  [        R                  R                  U 5      (       a+  [	        U 5      (       a  [        U 5      $ [        SU< S35      e[        U 5      (       d  g[        R                  R                  U 5      (       a  [        U 5      $ UR                  SS5      n[        U5      S:  a  [        US   5      (       d  g[        R                  SU5        [        U 5      $ )	a3  
First, it checks whether a provided path is an installable directory. If it
is, returns the path.

If false, check if the path is an archive file (such as a .whl).
The function checks if the path is a file. If false, if the path has
an @, it will treat it as a PEP 440 URL requirement and return the path.
z
Directory zC is not installable. Neither 'setup.py' nor 'pyproject.toml' found.N@r"   r#   r   zARequirement %r looks like a filename, but the file does not exist)r   rF   r   rG   r   r   r   r   isfilesplitlenrl   warning)r   r   urlreq_partss      r*   _get_url_from_pathr     s     "''--"5"5d##t$$   !* *
 	
 4  	ww~~d4  ::c1%L
<A&6|A&G&G 
NNK tr,   line_sourcec           	      @  ^^ [        U 5      (       a  SnOSnX ;   a:  U R                  US5      u  pUR                  5       nU(       d  S nO[        U5      nOS nU R                  5       n S n[        R
                  R                  [        R
                  R                  U 5      5      nS nS n[        U 5      (       a  [        U 5      nO&[        U5      u  p[        X5      n
U
b  [        U
5      nU(       a  UR                  S:X  a~  [        R                  " SUR                  5      (       aX  [        [        [        R
                  R                  [        R
                  R                  UR
                  5      5      5      5      nUR                   (       a1  [#        UR$                  5      nUR&                   SUR(                   3nOUR*                  nOU n[-        U5      nS[.        S[.        4U4S	 jjmS
[.        S[0        4U4S jjnUb	  U" U5      nOS n[3        XXL5      $ )Nz; ;r"   filez\.\./z==textr    c                 &   > T(       d  U $ U  ST S3$ )Nz (from )rv   )r   r   s    r*   with_source(parse_req_from_line.<locals>.with_sourcec  s    Kw{m1--r,   req_as_stringc                 D  >^   [        T 5      $ ! [         a  n[        R                  R                  T ;   a  SnU[        T 5      -  nO)ST ;   a!  [        U 4S j[         5       5      (       d  SnOSnT" ST < SU 35      nU(       a  USU 3-  n[        U5      eS nAff = f)	NzIt looks like a path.=c              3   ,   >#    U  H	  oT;   v   M     g 7fr_   rv   )rZ   opr   s     r*   r\   Aparse_req_from_line.<locals>._parse_req_string.<locals>.<genexpr>o  s      2.7m#is   z,= is not a valid operator. Did you mean == ?r8   r~   r   z
Hint: )	r   r   rF   r   r   ro   any	operatorsr   )r   r   add_msgrn   r   s   `   r*   _parse_req_string.parse_req_from_line.<locals>._parse_req_stringh  s    	)"=11! 	)ww{{m+1-m<<%c 2.72 / / I 5m5FbNOC'++#C((	)s   
 
BBBB)r   r   r`   r   rF   r   normpathabspathr   r+   r   schemer$   searchrL   r   is_wheelr   rR   r   versionrI   r1   r:   r   rr   )r   r   
marker_sepmarkers_as_stringru   r   r   rP   extras_as_stringprL   wheelr(   r   r2   r   s    `             @r*   parse_req_from_liner   3  s   d||

"&**Z";-335 G./G::<DM77BGGOOD12DDd||Dz+D1 )?9D ;;& RYYx%B%BBGG$4$4RWW__TYY5O$PQRD==$--(E$zzl"U]]O<M !--M ,-F.# .# .
) ) )$  %6}%ECw77r,   )r   r   r   r   r   r   r   r   c                    [        X5      n
[        U
R                  UU
R                  U
R                  UUUUU	UU
R
                  US9$ )zCreates an InstallRequirement from a name, which might be a
requirement, directory containing 'setup.py', filename, or URL.

:param line_source: An optional string describing where the line is from,
    for logging purposes in case of an error.
)
rP   ru   r   r   r   r   r   r   r(   r   )r   r   rt   rP   ru   r(   )r   r   r   r   r   r   r   r   r   r   r   s              r*   r   r     sQ    &  2EZZ%!'||# r,   
req_stringc                 z    [        U 5      n[        R                  [
        R                  /nUR                  (       aN  U(       aG  UR                  (       a6  UR                  R                  U;   a  [        SUR                   SU S35      e[        UUUUUS9$ ! [         a  n[        SU < SU 35      eS nAff = f)Nr~   r   zZPackages installed from PyPI cannot depend on packages which are not also hosted on PyPI.
z depends on  )r   r   r   )r   r   r   r   file_storage_domainr   rL   rP   netlocr   r   )r   r   r   r   r   r2   r   domains_not_alloweds           r*   install_req_from_req_stringr     s    Oj)
 	  $$
 	OOOO""&99  3|C53
 	
 # )  O"7
~Ru MNNOs   B 
B:#B55B:
parsed_reqc                    U R                   (       a/  [        U R                  U R                  UU R                  UUUS9nU$ [        U R                  U R                  UUU R                  (       a  U R                  R                  S/ 5      O/ U R                  (       a  U R                  R                  S0 5      O0 U R                  U R                  UUS9
nU$ )N)r   r   r   r   r   r   r   hashes)	r   r   r   r   r   r   r   r   r   )	is_editabler   rt   r   r   r   optionsgetr   )r   r   r   r   r   r2   s         r*   #install_req_from_parsed_requirementr     s     '""!,,!!,,'+
: J% $""!,,! %% ""&&'7< 9C8J8J
""&&x4PR!,,"..'+!
$ Jr,   rP   ireqc                     [        UR                  UR                  UR                  U UR                  UR
                  UR                  UR                  UR                  UR                  UR                  S9$ )N)r2   r   r   rP   ru   r   r   r   r   r   r   )r   r2   r   r   ru   r   r   r   r   r   r   )rP   r   s     r*   install_req_from_link_and_ireqr     sb     HH????**&&,,(( r,   c                 `   [        U R                  b  [        U R                  [        5       5      OSU U R                  U R
                  U R                  U R                  U R                  U R                  U R                  U R                  / U R                  U R                  U R                  S9$ )z
Creates a new InstallationRequirement using the given template but without
any extras. Sets the original requirement as the new one's parent
(comes_from).
N)r2   r   r   rP   ru   r   r   r   r   r   r(   r   r   r   )r   r2   rA   r/   r   rP   ru   r   r   r   r   r   r   r   r   )r   s    r*   install_req_drop_extrasr     s     8<8L#DHHce4RVYY??**&&??,,((#::! r,   c                     [         R                   " U 5      n1 U R                  kUkUl        U R                  b'  [        U R                  UR                  5      Ul        U$ SUl        U$ )zu
Returns a copy of an installation requirement with some additional extras.
Makes a shallow copy of the ireq object.
N)copyr(   r2   rA   )r   r(   results      r*   install_req_extend_extrasr   !  sg     YYt_F+dkk+F+FM 88 	 &--8 J
 M  J
 Mr,   r_   )NFNF)FNFN)I__doc__r   loggingrF   r$   dataclassesr   typingr   r   r   r   r   r	   r
   pip._vendor.packaging.markersr   "pip._vendor.packaging.requirementsr   r    pip._vendor.packaging.specifiersr   pip._internal.exceptionsr   pip._internal.models.indexr   r   pip._internal.models.linkr   pip._internal.models.wheelr   pip._internal.req.req_filer   pip._internal.req.req_installr   pip._internal.utils.filetypesr   pip._internal.utils.miscr   pip._internal.utils.packagingr   pip._internal.utils.urlsr   pip._internal.vcsr   r   __all__	getLoggerrw   rl   
_operatorskeysr   r:   r+   r1   rA   r   ri   ro   rr   r   boolr   r   r   r   r   r   r   r   r   r   rv   r,   r*   <module>r      s     	 	 ! F F F 0 N 6 6 5 * , 8 < 9 7 9 0 ) 
		8	$  %%'		" 	"c8C=&8 9 	"B8C= BSX B3 3#c( 3{ 324$ 4$x}c3s8/K)L 4$nc d 8C C 2 $  ># >2B >* <@ "&*.37#(BF13678 	
  T#Y' 4T#Y/0   ! d3c49n(=#=>? @3 4 &S   DL8c L8 L8BR L8b <@" "&*.37!%BF"
"s$6678" 	"
 " T#Y'" 4T#Y/0" " #" " d3c49n(=#=>?" "N 04!%##+,# # 	#
 # #P !%BF%!%% % 	%
 d3c49n(=#=>?% %P
($"4 9K 4
sO r,   