
    
3j+              	       j   S SK Jr  S SK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Jr  SSKJrJr  \R*                  " S5      rS	rS
R1                  \ V s/ s H  o R3                  SS5      PM     sn 5      r\R*                  " S\ S\ S35      r\R*                  " S5      r " S S5      rgs  sn f )    )unicode_literalsN)AnyDictListMatchOptionalTuplecast)Requirement   )get_hash_infoparse_extras_requireparse_fragment)VCSVCS_SCHEMESzE^(?P<scheme>https?|file|ftps?)://(?P<path>[^#]+)(#(?P<fragment>\S+))?z#(?:(?P<name>[\w\[\]_\-,]+)\s*@)?\s*|+z\+^z(?P<scheme>zU)://((?P<login>[^/@]+)@)?(?P<path>[^#@]+)(@(?P<revision>[^#]+))?(#(?P<fragment>\S+))?z9^((?P<scheme>file)://)?(?P<path>[^#]+)#(?P<fragment>\S+)?c                       \ rS rSrSrS\SS4S jrS\4S jrS\S\4S	 jr	S
\
S\4S jrS
\
S\4S jrS\4S jr\S\SS 4S j5       r\S\SS 4S j5       r\S\SS 4S j5       rSrg)r   -   a  
Represents a single requirement

Typically instances of this class are created with ``Requirement.parse``.
For local file requirements, there's no verification that the file
exists. This class attempts to be *dict-like*.

See: http://www.pip-installer.org/en/latest/logic.html

**Members**:

* ``line`` - the actual requirement line being parsed
* ``editable`` - a boolean whether this requirement is "editable"
* ``local_file`` - a boolean whether this requirement is a local file/path
* ``specifier`` - a boolean whether this requirement used a requirement
  specifier (eg. "django>=1.5" or "requirements")
* ``vcs`` - a string specifying the version control system
* ``revision`` - a version control system specifier
* ``name`` - the name of the requirement
* ``uri`` - the URI if this requirement was specified by URI
* ``subdirectory`` - the subdirectory fragment of the URI
* ``path`` - the local path to the requirement
* ``hash_name`` - the type of hashing algorithm indicated in the line
* ``hash`` - the hash value indicated by the requirement line
* ``extras`` - a list of extras for this requirement
  (eg. "mymodule[extra1, extra2]")
* ``specs`` - a list of specs for this requirement
  (eg. "mymodule>1.5,<1.6" => [('>', '1.5'), ('<', '1.6')])
linereturnNc                     Xl         SU l        SU l        SU l        S U l        S U l        S U l        S U l        S U l        S U l	        S U l
        S U l        / U l        / U l        g NF)r   editable
local_file	specifiervcsnamesubdirectoryuripathrevision	hash_namehashextrasspecs)selfr   s     R/home/wildlama/miniconda3/lib/python3.13/site-packages/requirements/requirement.py__init__Requirement.__init__L   sc    		 		!#,.
    c                 "    SU R                    S3$ )Nz<Requirement: "z">)r   r(   s    r)   __repr__Requirement.__repr__]   s     2..r,   keyc                     [        X5      $ N)getattr)r(   r1   s     r)   __getitem__Requirement.__getitem__`   s    t!!r,   otherc                    [        U[        5      (       a  [        U R                  UR                  :H  [	        U R
                  5      [	        UR
                  5      :H  U R                  UR                  :H  U R                  UR                  :H  U R                  UR                  :H  U R                  UR                  :H  U R                  UR                  :H  [	        U R                  5      [	        UR                  5      :H  /5      $ gr   )
isinstancer   allr   setr'   r   r   r#   r$   r%   r&   r(   r7   s     r)   __eq__Requirement.__eq__c   s    e[))		UZZ'DJJ3u{{#33/%//1/%//1		UZZ'DKK C$55	 	 	 r,   c                     X:X  + $ r3    r<   s     r)   __ne__Requirement.__ne__q   s      r,   c                 6    U R                   R                  5       $ r3   )__dict__keysr.   s    r)   rE   Requirement.keyst   s    }}!!##r,   c                    U " SU 35      nSUl         SU;   a  USUR                  S5       n[        R                  U5      n[        R                  U5      nUGb=  UR                  5       nUR                  S5      (       a  US    SUS    SUS	    3Ul        OUS    SUS	    3Ul        US
   Ul        US   (       as  [        US   5      n[        [        UR                  S5      5      n[        U5      u  Ul        Ul        [        U5      u  Ul        Ul        UR                  S5      Ul        US   (       a  [        US   5      u  Ul        Ul        [&         H4  n[        UR                  5      R)                  U5      (       d  M.  Xl        M6     U$ Ub  UR                  5       nSUl        US   (       as  [        US   5      n[        [        UR                  S5      5      n[        U5      u  Ul        Ul        [        U5      u  Ul        Ul        UR                  S5      Ul        [        [        US	   5      Ul        U$ SUl        UR1                  S5      u  Ul        ol        U$ )a  
Parses a Requirement from an "editable" requirement which is either
a local project path or a VCS project URI.

See: pip/req.py:from_editable()

:param line: an "editable" requirement
:returns: a Requirement instance for the given line
:raises: ValueError on an invalid requirement
z-e Tz #Nloginscheme://@r"   r#   fragmenteggr    r   /)r   find	VCS_REGEXmatchLOCAL_REGEX	groupdictgetr!   r#   r   r
   strr   r   r&   r   r$   r%   r    r   
startswithr   r   r"   
rpartition)
clsr   req	vcs_matchlocal_matchgroupsrL   rM   r   _s
             r)   parse_editableRequirement.parse_editablew   s7    Cv,4<(4)D*3//$*?	,7,=,=d,C %.%8%8%:Fzz'""#H-.c&/1B!F6NCST#H-.c&.1AB!*-CLj!)&*<=3U 34';C'@$#**7*A'sx#+<<#? f~';F6N'K$#*sww<**3//!G " 
 $ **,F!CNj!)&*<=3U 34';C'@$#**7*A'sx#+<<#? C0CH
 
 "CN$(OOC$8!CHa
r,   c                 b   U " U5      n[         R                  U5      n[        R                  U5      n[        R                  U5      nUGb/  UR	                  5       nUR                  S5      (       a  US    SUS    SUS    3Ul        OUS    SUS    3Ul        US   Ul        US   (       ae  [        US   5      nUR                  S	5      n[        U5      u  Ul
        Ul        [        U5      u  Ul        Ul        UR                  S
5      Ul        [          H4  n	[#        UR                  5      R%                  U	5      (       d  M.  Xl        M6     US   (       a  [        US   5      u  Ul
        Ul        U$ Ub  UR	                  5       nUS    SUS    3Ul        US   (       ae  [        US   5      nUR                  S	5      n[        U5      u  Ul
        Ul        [        U5      u  Ul        Ul        UR                  S
5      Ul        US   S:X  a  SUl        U$ SU;   a  Uc   S5       eUR	                  5       nSUl        US   (       ap  [        US   5      nUR                  S	5      n[        U5      u  pUR                  S	5      Ul
        [        U5      u  Ul        Ul        UR                  S
5      Ul        US   Ul        U$ SUl        [.        R0                  " SSU5      n[3        U5      nUR                  Ul
        [5        UR                  5       Vs/ s H  oR7                  5       PM     snUl        / nUR,                   HQ  n[.        R8                  " S[#        U5      SS9n[5        [;        SU5      5      nUR=                  [?        U5      5        MS     Xl         U$ s  snf )z
Parses a Requirement from a non-editable requirement.

See: pip/req.py:from_line()

:param line: a "non-editable" requirement
:returns: a Requirement instance for the given line
:raises: ValueError on an invalid requirement
NrH   rI   rJ   rK   r"   r#   rL   rM   r    r   fileTz#egg=zThis should match everythingz#.* z
([=<>~!]+)r   )maxsplit)!rP   rQ   	URI_REGEXrR   rS   rT   r!   r#   r   r   r   r&   r   r$   r%   r    r   rU   rV   r   r   r"   r   resubReqlistlowersplitfilterappendtupler'   )rX   r   rY   rZ   	uri_matchr[   r\   rL   rM   r   r   r&   line_without_commentpkg_reqxr'   r   specs                     r)   
parse_lineRequirement.parse_line   sb    $i*3//$*?	*3//$*?	,7,=,=d,C ((*Fzz'""#H-.c&/1B!F6NCST#H-.c&.1AB!*-CLj!)&*<=ll5)';C'@$#**7*A'sx#+<<#? sww<**3//!G  f~';F6N'K$#*R 
Q "((*F)*#fVn-=>CGj!)&*<=ll5)';C'@$#**7*A'sx#+<<#? h6)!%< 
; _*J,JJ* **,F!CNj!)&*<=ll5)3C8#<<.*7*A'sx#+<<#? f~CH" 
 !CM#%66%T#: ./G||CH-1'..-AB-A'')-ABCJ E$..	xxc)nqIF4./U4[) / I
 Cs    N,c                 2   UR                  S5      (       d  UR                  S5      (       a'  U R                  [        R                  " SSU5      5      $ SU;   a  USUR	                  S5       nSU;   a  USUR	                  S5       nU R                  U5      $ )z
Parses a Requirement from a line of a requirement file.

:param line: a line of a requirement file
:returns: a Requirement instance for the given line
:raises: ValueError on an invalid requirement
z-ez
--editablez^(-e|--editable=?)\s*rb   z --hash=Nz \)rV   r^   re   rf   rO   rs   )rX   r   s     r)   parseRequirement.parse   s     ??4  DOOL$A$A %%/T:< < .:./DD=)5)*D~~d##r,   )r   r&   r%   r$   r   r   r   r"   r#   r   r'   r    r!   r   )__name__
__module____qualname____firstlineno____doc__rU   r*   r/   r   r5   objectboolr=   rA   rE   classmethodr^   rs   rv   __static_attributes__r@   r,   r)   r   r   -   s    </S /T /"/# /"s "s "F t !F !t !$c $ 5# 5- 5 5n Kc Km K KZ $ $ $ $r,   r   )
__future__r   re   typingr   r   r   r   r   r	   r
   packaging.requirementsr   rg   rL   r   r   r   r   r   r   compilerd   VCS_OPTIONAL_NAME_REGEXjoinreplaceVCS_SCHEMES_REGEXrP   rR   )rI   s   0r)   <module>r      s   & ( 	 @ @ @ 5 I I !JJ	
 A IITf~~c59TU JJ	 !->,? @D D	 jjUVe$ e$ Us   B0