
    ܖiWx                    0   U d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlZd dlZd dl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mZmZmZmZmZmZmZmZmZm Z 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- d dl.m/Z/ d dl0m1Z1 d dl0m2Z2 d dl3m4Z4 	 	  G d d      Z5 G d d      Z6 G d d      Z7 e	jp                  de	jr                        jt                  Z;de<fdZ= G d de6      Z> G d de>      Z?	 	 ddZ@ G d de7e6      ZAd  ZB G d! d"e7e6      ZC G d# d$eC      ZDej                  j                  d%      xs  ej                  d&k(  xr ej                  d'k(  ZHe j                  d(fe j                  d)fe j                  d*fe j                  d+fe j                  d,fe j                  d-fe j                  d.fgZPee"eQe<f      eRd/<    e	jp                  d0      ZSd1eQd2e<fd3ZT G d4 d5eU      ZV G d6 d7eV      ZW G d8 d9eW      ZX G d: d;eV      ZY G d< d=eW      ZZ eed>d?d@dAdBddCD      Z[edEef   eRdA<   d2efdFZ\ eedGdHdIddJK      Z]edEef   eRdH<   d2efdLZ^d2efdMZ_d2efdNZ`d2efdOZad2efdPZbd2efdQZcd2efdRZd eedSdTdIddUK      ZeedEef   eRdT<    eedVdWdXdYdZ[      ZfedEef   eRdW<    eed\d]dXdYd^[      ZgedEef   eRd]<    eed_dIdd`a      ZhedEef   eRdb<   d2efdcZi eedddedIddfK      ZjedEef   eRde<   d2efdgZk	  eedhdidIdj      ZledEef   eRdi<   d2efdkZmd2efdlZn	  eedmdndodIdj      ZoedEef   eRdo<   	  eedpdqdIdj      ZpedEef   eRdq<   elemeneoepgZqeedEej(                  f      eRdr<   eqD  cg c]  }  e< |        j                         c} Zs G ds dte      Zt G du dve      Zuee$e"eve<f   eteuf      Zwee<ge"e<ef   f   Zx e	jp                  dwe	j                        Zz e	jp                  dx      Z{e[e\e]e`eaebe^ecedeeejehe_ekgZ|eedEej(                  f      eRdy<   e|D  cg c]  }  e< |        j                         c} Z} e~e}esz         ZefegeigZeedEej(                  f      eRdz<   eD  cg c]  }  e< |        j                         c} Zd{ e|ez   eqz   D        ZeD  ci c]$  }  e<| j                        | j                         & c} Z G d| d}      Z G d~ d      Z	 	 dde<deded2ee$eeAeCe?f      fdZde<d2ewfdZddZded2efdZded2efdZded2ee$eeAeCf      fdZ G d d      Zd2exfdZde<d2e"e<e<f   fdZ G d deU      ZddZd2ej$                  fdZdewd2ewfdZdewd2ewfdZde<d2e<fdZde<d2e e<   fdZde<d2e<fdZ G d d      Z ede<      Zde<d2efdZdZ G d de      Z G d de      Zded2efdZ ej@                  d      deded2efd       Z G d de7e6      Zde$e<e4e2f   d2e$e4e2f   fdZde-d2ee<   fdZ G d de      Zg dZg dZde<d2efdZe"e<e"e e<   e e<   f   f   ZejT                  fdedevd2eeQ   fdZde<d2e"e<e<f   fdZde<d2efdZdZdZe"e<dEf   eRd<   dZe"e<dEf   eRd<   defZe"e<dEf   eRd<   dZe"e<dEf   eRd<   eez   ez   ez   Zde<d2efdǄZ ejj                  e      Ze,jp                  js                         Zde<d2e"e<e e<   f   fdȄZde e<   d2e!e<   fdʄZde<d2e"e e<   e<e!e<   f   fd̄Z G d̈́ dΫ      Zde<d2efdτZ	 	 	 	 dde<de e>   dYe ee<ef      de ee<ef      ded2efd҄Z e	jp                  dӫ      jt                  Zde<d2efdԄZ G dՄ de      Zde<d2efd؄Zde<d2efdلZde<de<d2e e<   fdڄZde<d2efd܄Z	 	 	 	 dde<de e>   dYe ee<ef      de ee<ef      ded2efd݄Zded2efd߄Z G d d      Zyc c} w c c} w c c} w c c} w )    N)partial)ValuesOption)AnyBinaryIOCallable
CollectionDictIterableIteratorList
NamedTupleNewTypeOptionalSetTupleTypeUnioncast)Marker)InvalidRequirement)Requirement)	Specifier)SpecifierSet)Tag)parse)Version)LegacyVersionc                       e Zd ZdZdeded   ded   ded   d	ed
   ddfdZeddedd fd       Zededd fd       Z	e	 	 ddede
ed      fd       ZddZddZy)RequirementsFilez
    This represents a pip requirements file. It contains the requirements and
    other pip-related options found in a requirerents file. Optionally contains
    nested requirements and constraints files content.
    filenamerequirementsInstallRequirementoptions
OptionLineinvalid_linesInvalidRequirementLinecommentsCommentRequirementLinereturnNc                 J    || _         || _        || _        || _        || _        y)zT
        Initialise a new RequirementsFile from a ``filename`` path string.
        Nr"   r#   r%   r'   r)   )selfr"   r#   r%   r'   r)   s         [/var/www/html/content-pipeline/venv/lib/python3.12/site-packages/pip_requirements_parser.py__init__zRequirementsFile.__init__   s)     !(*     c                    g }g }g }g }| j                  ||      D ]  }t        |t              r|j                  |       %t        |t              r|j                  |       Gt        |t
              r|j                  |       it        |t              r|j                  |       t        d       t        |||||      S )a  
        Return a new RequirementsFile from a ``filename`` path string.

        If ``include_nested`` is True also resolve, parse and load
        -r/--requirement adn -c--constraint requirements and constraints files
        referenced in the requirements file.
        r"   include_nestedz)Unknown requirement line type: {parsed!r}r-   )	r   
isinstancer(   appendr*   r&   r$   	Exceptionr!   )clsr"   r4   r#   r%   r'   r)   parseds           r/   	from_filezRequirementsFile.from_file   s     24$&WY13ii)   
 	MF
 &"89$$V,F$:;'FJ/v&F$67##F+ KLL	M   %'
 	
r1   textc                    d}	 t        t        t        j                                     }|dz  }t	        |d      5 }|j                  |       ddd       | j                  t        |      d      |r2|j                         r!t        j                  t        |      d       S S S # 1 sw Y   YxY w# |r2|j                         r!t        j                  t        |      d       w w w xY w)z
        Return a new RequirementsFile from a ``text`` string.

        Since pip requirements are deeply based on files, we create a temp file
        to feed to pip even if this feels a bit hackish.
        Nzrequirements.txtwFr3   T)pathignore_errors)
Pathstrtempfilemkdtempopenwriter:   existsshutilrmtree)r8   r;   tmpdirreq_filerfs        r/   from_stringzRequirementsFile.from_string  s     	D#h..012F 22Hh$ ==#h-=N&--/3v;dC *v	  &--/3v;dC *vs"   7B1 B%#B1 %B.*B1 16C')r$   r&   r(   r*   c              #   b  K   t        |||      D ]  }t        |t        t        f      r| t        |t              rD| |j
                  D ]0  }|t        v st        |   }t        |j                  d|        2 r	 t        |t              sJ t        |      }|j                  r4t        |j                        }d| }	t        |j                  |	       n|  y# t        $ r;}
t        |j                  t        |
      j!                                Y d}
~
d}
~
ww xY ww)a  
        Yield requirements, options and lines from a ``filename``.

        If ``include_nested`` is True also resolve, parse and load
        -r/--requirement adn -c--constraint requirements and constraints files
        referenced in the requirements file.

        )r"   r4   is_constraintzUnsupported, legacy option: requirement_lineerror_messagez?Invalid global options, not supported with a requirement spec: N)parse_requirementsr5   r(   r*   r&   r%   LEGACY_OPTIONS_DESTOPT_BY_OPTIONS_DESTIncorrectRequirementLinerP   ParsedRequirementbuild_req_from_parsedreqinvalid_optionsdumps_global_optionsr7   rA   strip)r8   r"   r4   rN   r9   optoptsreqinvosmsges              r/   r   zRequirementsFile.parse  s=    ( ))'
 &	F
 &#9;Q"RSFJ/!>> C112376-3-D-D,H*O %f.?@@@26:C** 4S5H5H I1169  5-3-D-D*- 
 "	C&	D ! 0)/)@)@&)!flln  s7   AD/(D/A!C(%D/(	D,10D'!D/'D,,D/c                    t        | j                  D cg c]  }|j                  |       c}| j                  D cg c]  }|j                  |       c}| j                  D cg c]  }|j                  |       c}| j
                  D cg c]  }|j                  |       c}      S c c}w c c}w c c}w c c}w )zT
        Return a mapping of plain Python objects for this RequirementsFile
        include_filename)r%   r#   r'   r)   )dictr%   to_dictr#   r'   r)   )r.   rc   oiruplcls         r/   re   zRequirementsFile.to_dictR  s       		+;	< ++ 

,<
=  -- -=> -- 

,<
=!
 	



s   B0B5
&B:B?c                 $   | j                   | j                  z   | j                  z   | j                  z   }d }t	        ||      }g }d}|D ]  }|r|j
                  |j
                  k(  r2t        |t              ra|d   }|j                         }	| d|	 }
|
|d<   P|r=|j
                  |j
                  dz   kD  r!t        |t              s|j                  d       |j                  |j                                |} dj                  |      dz   }|S )	z
        Return a requirements string representing this requirements file. The
        requirements are reconstructed from the parsed data.
        c                 Z    | j                   t        | t              t        | t               fS N)line_numberr5   r*   r(   )ls    r/   <lambda>z(RequirementsFile.dumps.<locals>.<lambda>{  s)    MMq021466
 r1   keyN     
)r#   r'   r%   r)   sortedrm   r5   r*   dumpsr(   r6   join)r.   preserve_one_empty_lineitemssort_byby_line_numberdumpedpreviousrqprevious_linetrailing_commentline_with_commentrx   s               r/   rx   zRequirementsFile.dumpsl  s       !ll mm 	
  73  	B''2>>9!"&<=(.r
+-88:(0=a@P?Q-R)%6r
  0NNX-A-AA-EE *2/E Fb)MM"((*%H'	* 		&!D(r1   FFF)__name__
__module____qualname____doc__rA   r   r0   classmethodr:   rL   r   r   r   re   rx    r1   r/   r!   r!      s    !!/0! l#! 45	!
 /0! 
!  #
 #
?Q #
 #
J Ds D'9 D D$  	99
 
%	" 
9 9v
40r1   r!   c                       e Zd Zd ZddZy)ToDictMixinc                 |    t        || j                        xr% | j                  d      |j                  d      k(  S )NTrb   )r5   	__class__re   r.   others     r/   __eq__zToDictMixin.__eq__  s;    udnn- 8LL$L/==$=78	
r1   c                     t        | j                  | j                        }|r%|j                  t        | j                               |S )Nrm   line)r"   )rd   rm   r   updater"   r.   rc   datas      r/   re   zToDictMixin.to_dict  s;    ((
 KKdmm45r1   Nr   )r   r   r   r   re   r   r1   r/   r   r     s    
r1   r   c                   `    e Zd Zedee   fd       Zedee   fd       Zedee   fd       Z	y)RequirementLineMixinr+   c                 R    | j                   xr | j                   j                  xs d S rl   )rP   r   r.   s    r/   r   zRequirementLineMixin.line  s$    $$C)>)>)C)CLLr1   c                 R    | j                   xr | j                   j                  xs d S rl   )rP   rm   r   s    r/   rm   z RequirementLineMixin.line_number  s$    $$J)>)>)J)JStSr1   c                 R    | j                   xr | j                   j                  xs d S rl   )rP   r"   r   s    r/   r"   zRequirementLineMixin.filename  s$    $$G)>)>)G)GPDPr1   N)
r   r   r   propertyr   rA   r   intrm   r"   r   r1   r/   r   r     sf    Mhsm M M TXc] T T Q(3- Q Qr1   r   z)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$namec                      | xr t        |       S )z
    Return True if the name is a valid Python package name
    per:
    - https://www.python.org/dev/peps/pep-0426/#name
    - https://www.python.org/dev/peps/pep-0508/#names
    )IS_VALID_NAMEr   s    r/   is_valid_namer     s     'M$''r1   c            	       F    e Zd ZdZ	 	 d
dedee   dee   ddfdZd Zd	 Z	y)RequirementLinez
    A line from a requirement ``filename``. This is a logical line with folded
    continuations where ``line_number`` is the first line number where this
    logical line started.
    Nr   rm   r"   r+   c                 .    || _         || _        || _        y rl   )r   r"   rm   )r.   r   rm   r"   s       r/   r0   zRequirementLine.__init__  s     	 &r1   c                     | j                   j                   d| j                  d| j                  d| j                  dS )Nz(line_number=z, line=z, filename=))r   r   rm   r   r"   r   s    r/   __repr__zRequirementLine.__repr__  sM    ~~&&' (#//2 3		} % MM,		
r1   c                     | j                   S rl   r   r   s    r/   rx   zRequirementLine.dumps  s    yyr1   )r   N)
r   r   r   r   rA   r   r   r0   r   rx   r   r1   r/   r   r     sL     &'"&		'	' c]	' 3-		'
 
	'
r1   r   c                       e Zd ZdZy)r*   zO
    This represents the comment portion of a line in a requirements file.
    Nr   r   r   r   r   r1   r/   r*   r*     s    r1   r*   Fc           
      B   g }|rd}nd}|rd}nd}| D ]z  }t        |t              r|j                  | | d| | |        0t        |t              r-t	        |      D ]  }|j                  | | d| | |          mt        d|d       dj                  |      S )z
    Given a list of ``options`` and an ``opt_string``, return a string suitable
    for use in a pip requirements file. Raise Exception if any option name or
    value type is unknown.
    "ru   z\
    =+Internal error: Unknown requirement option rs   )r5   rA   r6   listrw   r7   ry   )	r%   
opt_stringquote_valueone_per_lineoption_itemsqrn   r[   vals	            r/   dumps_requirement_optionsr     s     L 	c31#j\1#cU1# >?T"c{ D##qc*Qqc#qc$BCD =cWAF 	 88L!!r1   c                   8    e Zd ZdZdededdfdZd
dZd Zd	 Z	y)r&   z
    This represents an a CLI-style "global" option line in a requirements file
    with a mapping of name to values. Technically only one global option per
    line is allowed, but we track a mapping in case this is not the case.
    rP   r%   r+   Nc                      || _         || _        y rl   rP   r%   )r.   rP   r%   s      r/   r0   zOptionLine.__init__  s     !1r1   c                 t    | j                   j                  |      }|j                  | j                         |S )Nrb   )rP   re   r   r%   r   s      r/   re   zOptionLine.to_dict(  s1    $$,,>N,ODLL!r1   c                 h    | j                   j                   d| j                  d| j                  dS )N(requirement_line=z
, options=r   )r   r   rP   r%   r   s    r/   r   zOptionLine.__repr__-  s?    ~~&&' ($$($9$9#< =<<*	
r1   c                 ,    t        | j                        S rl   )rY   r%   r   s    r/   rx   zOptionLine.dumps5  s    #DLL11r1   r   )
r   r   r   r   r   r   r0   re   r   rx   r   r1   r/   r&   r&     s7    
)  
	

2r1   r&   c                    g }t        | j                               D ]  \  }}t        j                  |      }d|d|}|st	        |      t        |t              r|D ]  }|j                  | d|         ^t        |t              r|j                  | d|        t        |t              s||j                  |        t	        |       dj                  |      S )z
    Given a mapping of options, return a string suitable for use in a pip
    requirements file. Raise Exception if the options name or value type is
    unknown.
    r   z with value: rs   )rw   r{   rT   getInstallationErrorr5   r   r6   rA   boolry   )r%   r   r   valuer   invalid_messager   s          r/   rY   rY   9  s     Lgmmo. 5e(,,T2
 :$ B )% 	
 #O44eT" ;##zl!C5$9:; s#:,aw 78t$:,0 $O44-50 88L!!r1   c                   8    e Zd ZdZdededdfdZd
dZd Zd	 Z	y)r(   zO
    This represents an unparsable or invalid line of a requirements file.
    rP   rQ   r+   Nc                 <    || _         |j                         | _        y rl   )rP   rZ   rQ   )r.   rP   rQ   s      r/   r0   zInvalidRequirementLine.__init__`  s    
 !1*002r1   c                 v    | j                   j                  |      }|j                  | j                         |S )Nrb   rQ   )rP   re   r   rQ   r   s      r/   re   zInvalidRequirementLine.to_dicth  s5    $$,,>N,O$"4"45r1   c                 h    | j                   j                   d| j                  d| j                  dS )Nr   z, error_message=r   )r   r   rP   rQ   r   s    r/   r   zInvalidRequirementLine.__repr__m  sA    ~~&&' ($$($9$9#< =!!%!3!3 6	
r1   c                 :    d| j                    d| j                   S )N# rv   )rQ   r   r   s    r/   rx   zInvalidRequirementLine.dumpsu  s"     D&&'r$))55r1   r   )
r   r   r   r   r   rA   r0   re   r   rx   r   r1   r/   r(   r(   \  s7    3)3 3 
	3

6r1   r(   c                       e Zd ZdZd Zy)rU   zl
    This represents an incorrect line of a requirements file. It can be parsed
    but is not correct.
    c                      d| j                    S )Nr   r   r   s    r/   rx   zIncorrectRequirementLine.dumps  s     D&&'((r1   Nr   r   r   r   rx   r   r1   r/   rU   rU   {  s    
)r1   rU   winclintzutf-8zutf-16z	utf-16-bez	utf-16-lezutf-32z	utf-32-bez	utf-32-leBOMSs   coding[:=]\s*([-\w.]+)r   r+   c                    t         D ]5  \  }}| j                  |      s| t        |      d j                  |      c S  | j	                  d      dd D ]n  }|dd dk(  st
        j                  |      s"t
        j                  |      }|J |j                         d   j                  d      }| j                  |      c S  | j                  t        j                  d      xs t        j                               S )	zCheck a bytes string for a BOM to correctly detect the encoding
    Fallback to locale.getpreferredencoding(False) like open() on Python3N   
   r   rt      #asciiF)r   
startswithlendecodesplitENCODING_REsearchgroupslocalegetpreferredencodingsysgetdefaultencoding)r   bomencodingr   results        r/   auto_decoder     s      5X??3C
#**8445 

5!"1% )!9!3!3D!9 ''-F%%%}}q)009H;;x(() ;;##E*Fc.D.D.F r1   c                       e Zd ZdZy)PipErrorzThe base pip error.Nr   r   r1   r/   r   r     s    r1   r   c                       e Zd ZdZy)r   z%General exception during installationNr   r   r1   r/   r   r     s    /r1   r   c                       e Zd ZdZy)RequirementsFileParseErrorzDRaised when a general error occurs parsing a requirements file line.Nr   r   r1   r/   r   r     s    Nr1   r   c                       e Zd ZdZy)CommandErrorz7Raised when there is an error in command-line argumentsNr   r   r1   r/   r   r     s    Ar1   r   c                       e Zd ZdZy)InvalidWheelFilenamezInvalid wheel filename.Nr   r   r1   r/   r   r     s    !r1   r   z-iz--index-urlz
--pypi-url	index_urlURLzBase URL of the Python Package Index (default %default). This should point to a repository compliant with PEP 503 (the simple repository API) or a local directory laid out in the same format.)destmetavardefaulthelp.c                  $    t        ddddg d      S )Nz--extra-index-urlextra_index_urlsr   r6   zmExtra URLs of package indexes to use in addition to --index-url. Should follow the same rules as --index-url.)r   r   actionr   r   r   r   r1   r/   extra_index_urlr     s#    	 	r1   z
--no-indexno_index
store_truezAIgnore package index (only looking at --find-links URLs instead).r   r   r   r   c            	      &    t        ddddg dd      S )Nz-fz--find-links
find_linksr6   urla  If a URL or path to an html file, then parse for links to archives such as sdist (.tar.gz) or wheel (.whl) files. If a local path or file:// URL that's a directory, then look for archives in the directory listing. Links to VCS project URLs are not supported.r   r   r   r   r   r   r   r1   r/   r  r    s&    7 r1   c                  $    t        ddddg d      S )Nz--trusted-hosttrusted_hostsr6   HOSTNAMEz]Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS.)r   r   r   r   r   r   r   r1   r/   trusted_hostr    s#    , r1   c            	      &    t        ddddg dd      S )Nz-cz--constraintconstraintsr6   filez\Constrain versions using the given constraints file. This option can be used multiple times.r  r   r   r1   r/   r
  r
     s&    2	 	r1   c            
      (    t        dddddg dd      S )	Nz-rz--requirementz--requirementsr#   r6   r  zQInstall from the given requirements file. This option can be used multiple times.r  r   r   r1   r/   r#   r#   .  s+     	2 r1   c            	      &    t        ddddg dd      S )Nz-ez
--editable	editablesr6   zpath/urlzkInstall a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url.r  r   r   r1   r/   editabler  @  s'    F r1   c                  $    t        dddg dd      S )Nz--no-binary	no_binaryr6   rA   av  Do not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either ":all:" to disable all binary packages, ":none:" to empty the set (notice the colons), or one or more package names with commas between them (no colons). Note that some packages are tricky to compile and may fail to install when this option is used on them.)r   r   r   typer   r   r   r1   r/   r  r  P  s$    D r1   c                  "    t        dddg d      S )Nz--only-binaryonly_binaryr6   aK  Do not use source packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either ":all:" to disable all source packages, ":none:" to empty the set, or one or more package names with commas between them. Packages without binary distributions will fail to install when this option is used on them.r   r   r   r1   r/   r  r  a  s     " r1   z--prefer-binaryprefer_binaryz8Prefer older binary packages over newer source packages.--install-optioninstall_optionsr6   r%   a"  Extra arguments to be supplied to the setup.py install command (use like --install-option="--install-scripts=/usr/local/bin"). Use multiple --install-option options to pass multiple options to setup.py install. If you are using an option with a directory path, be sure to use absolute path.)r   r   r   r   --global-optionglobal_optionszcExtra global options to be supplied to the setup.py call before the install or bdist_wheel command.z--prezYInclude pre-release and development versions. By default, pip only finds stable versions.)r   r   r   prec                  "    t        dddg d      S )N--hashhashesr6   zgVerify that the package's archive matches this hash before installing. Example: --hash=sha256:abcdef...r   r   r   r1   r/   cmdoptions_hashr    s!    C r1   z--require-hashesrequire_hasheszRequire a hash to check each requirement against, for repeatable installs. This option is implied when any package in a requirements file has a --hash option.c                  "    t        dddg d      S )Nz--use-featureuse_featuresr6   z<Enable new functionality, that may be backward incompatible.r   r   r   r1   r/   use_featurer"    s    		G r1   z--allow-all-externalallow_all_externalr   r   r   c                       t        dddg       S )Nz--allow-externalallow_externalr6   r$  r   r   r1   r/   r&  r&    s    	 r1   c                       t        dddg       S )Nz--allow-unverifiedallow_unverifiedr6   r$  r   r   r1   r/   r(  r(    s    	 r1   z-Zz--always-unzipalways_unzipz--no-use-wheelno_use_wheelLEGACY_OPTIONSc                   "    e Zd ZU eed<   eed<   y)TextLinerm   r   Nr   r   r   r   __annotations__rA   r   r1   r/   r-  r-        
Ir1   r-  c                   "    e Zd ZU eed<   eed<   y)CommentLinerm   r   Nr.  r   r1   r/   r2  r2    r0  r1   r2  z^(http|https|file):z(^|\s+)(#.*)$SUPPORTED_OPTIONSSUPPORTED_OPTIONS_REQc              #   *   K   | ]  } |         y wrl   r   ).0rf   s     r/   	<genexpr>r7  D  s      ACs   c                   ^    e Zd Z	 	 	 d
dedededeeeef      dee   deeeef      ddfd	Z	y)rV   Nrequirement_stringis_editablerN   r%   rP   rX   r+   c                 X    || _         || _        || _        || _        || _        || _        y rl   r9  r:  rN   r%   rP   rX   )r.   r9  r:  rN   r%   rP   rX   s          r/   r0   zParsedRequirement.__init__O  s3     #5&* 0.r1   )NNN)
r   r   r   rA   r   r   r   r   r   r0   r   r1   r/   rV   rV   N  su     -16:48// / 	/
 $sCx.)/ #?3/ "$sCx.1/ 
/r1   rV   c                   <    e Zd Z	 d	dededededeee      ddfdZ	y)

ParsedLinerP   r9  r%   rN   	argumentsr+   Nc                     || _         || _        || _        |xs g | _        d| _        d| _        |r|| _        y |j                  rd| _        |j                  d   | _        y d| _        y )NTFr   )rP   r%   rN   r?  is_requirementr:  r9  r  )r.   rP   r9  r%   rN   r?  s         r/   r0   zParsedLine.__init__a  so     !1*"b" &8D##D '.&7&7&:D#"'Dr1   )r   )
r   r   r   r   rA   r   r   r   r   r0   r   r1   r/   r>  r>  `  sO     *,()(  ( 	(
 ( DI&( 
(r1   r>  r"   rN   r4   c              #      K   t               }t        |      }|j                  | ||      D ]G  }t        |t              rt        |      D ]	  }||  ,t        |t        t        f      sJ | I yw)a  Parse a requirements file and yield ParsedRequirement,
    InvalidRequirementLine or CommentRequirementLine instances.

    :param filename:    Path or url of requirements file.
    :param is_constraint:  If true, parsing a constraint file rather than
        requirements file.
    :param include_nested: if true, also load and parse -r/--requirements
        and -c/--constraints nested files.
    r"   rN   r4   parsed_lineN)get_line_parserRequirementsFileParserr   r5   r>  handle_liner(   r*   )r"   rN   r4   line_parserparserrE  parsed_req_or_opts          r/   rR   rR   ~  s     & "#K#K0F||#% $   k:.%0[%I ,!$0++,
 k,BDZ+\]]]s   AA7&A7contentc                 h    t        | j                         d      }t        |      }t        |      }|S )zSplit, filter, and join lines, and return a line iterator.
    This contains both CommentLine and TextLine.

    :param content: the content of the requirements file
    rt   )start)	enumerate
splitlines
join_linessplit_comments)rL  
lines_enumlines_and_comments_enums      r/   
preprocessrU    s4      )););)=QGJJ'J,Z8""r1   c                 z    | j                   }i }t        D ]#  }|r|dk(  r|j                  |      }|s|||<   % |S )zJ
    Given an optparse Values object, return a {dest: value} mapping.
    r  )__dict__rT   r   )optparse_optionsskip_editableoptions_by_destr%   r   r   s         r/   get_options_by_destr[    sS     '//OG# "T[0##D)!GDM" Nr1   rE  c                    | j                   sJ | j                  rOt        | j                  d      }t	        | j
                  | j                  | j                  | j                  |      S t        | j                        }i }i }|j                         D ]  \  }}|t        v r|||<   |||<    t	        | j
                  | j                  | j                  || j                  |      S )NT)rX  rY  )r9  r:  rN   rP   rX   )rX  r<  )
rA  r:  r[  r%   rV   r9  rN   rP   r{   SUPPORTED_OPTIONS_REQ_DEST)rE  rX   r%   req_optionsr   r   s         r/   handle_requirement_liner_    s     %%%% .(00

 !*==#//%33(99+
 	
 &(00

  "==? 	.KD%11$)D!(-%		. !*==#//%33(99+
 	
r1   r\   c                 <   i }t         t        z   D ]  }t        | |      st        | |      }||v rt	        d|       |s1t        |t              r|j                  d      }t        |t              r|D cg c]  }|j                  d       }}|||<    |S c c}w )zF
    Return a mapping of {name: value} for supported pip options.
    z Invalid duplicated option name: r   )	SUPPORTED_OPTIONS_DESTrS   hasattrgetattrr   r5   rA   lstripr   )r\   r%   r   r   vs        r/   handle_option_linerf    s     G&)<< &4D$'Ew'*J4&(QRReS)!LL-EeT*49:qQXXc]:E: %& N ;s   6Bc              #     K   | j                   rt        |        yt        | j                        }| j                  }|r/|r-dj                  |      }t        | j                  d|        t        | j                  |       yw)a  Handle a single parsed requirements line

    :param parsed_line:        The parsed line to be processed.

    Yield one or mpre a ParsedRequirement, OptionLine or InvalidRequirementLine

    For lines that contain requirements, the only options that have an effect
    are from SUPPORTED_OPTIONS_REQ, and they are scoped to the
    requirement. Other options from SUPPORTED_OPTIONS may be present, but are
    ignored.

    For lines that do not contain requirements, the only options that have an
    effect are from SUPPORTED_OPTIONS. Options from SUPPORTED_OPTIONS_REQ may
    be present, but are ignored. These lines may contain multiple options
    (although our docs imply only one is supported)
    rD  )r\   , z,Incorrect and ignored trailing argument(s): rO   r   N)	rA  r_  rf  r%   r?  ry   rU   rP   r&   )rE  r%   argss      r/   rH  rH    s     & !!%+>>$$$
 $$t 99T?D*!,!=!= LTFS 
 (99
 	
s   B	Bc                       e Zd ZdeddfdZ	 ddedededeee	e
ef      fdZ	 ddedededeee	e
ef      fd	Zdededeee	e
ef      fd
Zy)rG  rI  r+   Nc                     || _         y rl   )_line_parser)r.   rI  s     r/   r0   zRequirementsFileParser.__init__2  s
    'r1   r"   rN   r4   c              #   H   K   | j                  |||      E d{    y7 w)  
        Parse a requirements ``filename``, yielding ParsedLine,
        InvalidRequirementLine or CommentRequirementLine.

        If ``include_nested`` is True, also load nested requirements and
        constraints files -r/--requirements and -c/--constraints recursively.

        If ``is_constraint`` is True, tag the ParsedLine as being "constraint"
        originating from a "constraint" file rather than a requirements file.
        rC  N)_parse_and_recurse)r.   r"   rN   r4   s       r/   r   zRequirementsFileParser.parse5  s.       **') + 
 	
 	
s   " "c              #   V  K   | j                  ||      D ]  }|rt        |t              rq|j                  sd|j                  j
                  s|j                  j                  r7|j                  j
                  r?t        |j                  j
                        dk7  r	 |j                  j
                  d   }d}n>t        |j                  j                        dk7  r	 |j                  j                  d   }d}t        j                  |      r!t        j                  j                  ||      }nRt        j                  |      s=t        j                  j                  t        j                  j!                  |      |      }| j#                  |||      E d{    |  y7 w)rn  )r"   rN   rt   r   FTrC  N)_parse_filer5   r>  rA  r%   r#   r
  r   	SCHEME_REr   urllibr   urljoinosr>   ry   dirnamero  )r.   r"   rN   r4   r   req_pathis_nested_constraints          r/   ro  z)RequirementsFileParser._parse_and_recurseK  s`      $$hm$T *	DtZ0++**dll.F.F <<,,4<<4459#||88;H+0( 4<<334q8#||77:H+/( ##H-%||33HhGH #))(3!ww||1  H
  22%"6#1 3    JU*	Fs   FF)F'F)c              #   Z  K   t        |      }t        |      }|D ]^  }|\  }}t        |t              rt	        |||       )t        |||      }	 | j                  |      \  }	}
}t        |	|
|||       ` y# t        $ r"}t        |t        |             Y d}~d}~ww xY ww)a(  
        Parse a single requirements ``filename``, yielding ParsedLine,
        InvalidRequirementLine or CommentRequirementLine.

        If ``is_constraint`` is True, tag the ParsedLine as being "constraint"
        originating from a "constraint" file rather than a requirements file.
        )r   rm   r"   )r9  r%   rN   rP   r?  rO   N)get_file_contentrU  r5   r2  r*   r   rl  r>  r7   r(   rA   )r.   r"   rN   rL  numbered_linesnumbered_linerm   r   rP   r9  r%   r?  r`   s                r/   rq  z"RequirementsFileParser._parse_file  s      #8,#G,+ 	M -K-5, +% 
 .'! 9=9J9J49P6"GY '9#"/%5' '	4  ,%5"%a& s0   AB+'A=:B+=	B(B#B+#B((B+T)r   r   r   
LineParserr0   rA   r   r   r   r>  r(   r*   r   ro  rq  r   r1   r/   rG  rG  0  s    (J (4 (  $	

 
 	

 
%
$:<RRS	T
4  $	:: : 	:
 
%
$:<RRS	T:x+C + +	%
$:<RRS	T+r1   rG  c                  @    dt         dt        t         t        f   fd} | S )Nr   r+   c                     t               }|j                         }t        |       \  }}|j                  t	        j
                  |      |      \  }}|||fS rl   )build_parserget_default_valuesbreak_args_options
parse_argsshlexr   )r   rJ  defaultsargs_stroptions_strr\   r?  s          r/   
parse_linez#get_line_parser.<locals>.parse_line  sT     ,,. 24 8+ ++EKK,DhOiy((r1   )rA   r   r   )r  s    r/   rF  rF    s&    ) )sF{!3 ) r1   r   c                    | j                  d      }g }|dd }|D ]H  }|j                  d      s|j                  d      r n$|j                  |       |j                  d       J dj	                  |      dj	                  |      fS )zBreak up the line into an args and options string.  We only want to shlex
    (and then optparse) the options, not the args.  args can contain marker
    which are corrupted by shlex.
    rs   N-z--r   )r   r   r6   popry   )r   tokensri  r%   tokens        r/   r  r    s    
 ZZ_FDQiG C E$4$4T$:KKKKN 88D>388G,,,r1   c                       e Zd ZdeddfdZy)OptionParsingErrorr_   r+   Nc                     || _         y rl   )r_   r.   r_   s     r/   r0   zOptionParsingError.__init__  s	    r1   )r   r   r   rA   r0   r   r1   r/   r  r    s    C D r1   r  c                      y)za
    A mock optparse.OptionParser method to avoid junk outputs on option parsing
    errors.
    Nr   )r.   r  s     r/   print_usager    s    
 r1   c                      t        j                  dd      } t        | _        t        t        z   t
        z   }|D ]  } |       }| j                  |        dt        dt        ddfd}|| _	        | S )	z7
    Return a parser for parsing requirement lines
    Fpip_requirements_parser)add_help_optionprogr.   r_   r+   NoReturnc                     t        |      rl   )r  r  s     r/   parser_exitz!build_parser.<locals>.parser_exit  s     %%r1   )
optparseOptionParserr  r3  r4  r+  
add_optionr   rA   exit)rJ  option_factoriesoption_factoryoptionr  s        r/   r  r    s     "" '	F %F(+@@>Q* "!&!"&# &C &J &
 FKMr1   rS  c              #     K   d}g }| D ]  \  }}|j                  d      rt        j                  |      rPt        j                  |      rd|z   }|r-|j                  |       |J |dj	                  |      f g }u||f ||s|}|j                  |j                  d              |r|J |dj	                  |      f yyw)zJoins a line ending in '' with the previous line (except when following
    comments).  The joined line takes on the index of the first line.
    N\rs   ru   )endswith
COMMENT_REmatchr6   ry   rZ   )rS  primary_line_numbernew_linerm   r   s        r/   rQ  rQ    s      H' .T}}T"j&6&6t&<%Tz%*666)2778+<<<!4''&1#OODJJt,-.$ "...!2778#444 s   CCc              #     K   | D ]  \  }}t         j                  |      D cg c]#  }|j                         s|j                         % }}t        |      dk(  r6|d   }|j	                  d      rt        ||       {t        ||       t        |      dk(  r$|\  }}t        ||       t        ||       |st        d|       yc c}w w)zh
    Split comments from text, strip text and filter empty lines.
    Yield TextLine or Commentline
    rt   r   #r   r   zInvalid line/comment: N)r  r   rZ   r   r   r2  r-  r7   )rS  rm   r   rn   partspartcomments          r/   rR  rR    s     
 ( CT$.$4$4T$:HqaggiHHu:?8Ds#!kEE;TBBZ1_!MD'{>>+GDD "8 ABB%CHs    CCC
A:CCc                     	 t        | d      5 }t        |j                               }ddd       |S # 1 sw Y   S xY w# t        $ r}t	        d|  d|       d}~ww xY w)z
    Return the unicode text content of a filename.
    Respects # -*- coding: declarations on the retrieved files.

    :param filename:         File path.
    rbNz"Could not open requirements file: z|n)rD   r   readOSErrorr   )r"   frL  excs       r/   rz  rz  5  so    
(D! 	,Q!!&&(+G	, N	, N	  
0
"SEB
 	

s)   ? 2? <? ? 	AAAr  c                 R    d| vry | j                  dd      d   j                         S )N:rt   r   )r   lowerr  s    r/   get_url_schemer  L  s+    
#~99S!Q%%''r1   c                    | j                  d      sJ d| d       t        j                  j                  |       \  }}}}}|r|dk(  rd}nt        rd|z   }nt        d|       t        j                  j                  ||z         }t        r9|s7t        |      dk\  r)|d	   d
k(  r!|d   t        j                  v r|dd dv r|dd }|S )z(
    Convert a file: URL to a path.
    file:z1You can only turn file: urls into filenames (not r   	localhostru   z\\z8non-local file URIs are not supported on this platform:    r   /rt   r      )r  z:/N)r   rs  r   urlsplitWINDOWS
ValueErrorrequesturl2pathnamer   stringascii_letters)r  _netlocr>   s       r/   url_to_pathr  R  s     >> D	:3'CD  #LL11#6AvtQV{*	&FsgN
 	
 >>&&v}5D 	INGsNGv+++1I$ABxKr1   c                       e Zd ZdZddgZdeded    ddfdZdefd	Z	d
ede
fdZd
ede
fdZd
ede
fdZd
ede
fdZd
ede
fdZd
edeeege
f   de
fdZy)KeyBasedCompareMixinz7Provides comparison capabilities that is based on a key_compare_key_defining_classrq   defining_classr+   Nc                      || _         || _        y rl   )r  r  )r.   rq   r  s      r/   r0   zKeyBasedCompareMixin.__init__  s    -r1   c                 ,    t        | j                        S rl   )hashr  r   s    r/   __hash__zKeyBasedCompareMixin.__hash__  s    D%%&&r1   r   c                 B    | j                  |t        j                        S rl   )_compareoperator__lt__r   s     r/   r  zKeyBasedCompareMixin.__lt__      }}UHOO44r1   c                 B    | j                  |t        j                        S rl   )r  r  __le__r   s     r/   r  zKeyBasedCompareMixin.__le__  r  r1   c                 B    | j                  |t        j                        S rl   )r  r  __gt__r   s     r/   r  zKeyBasedCompareMixin.__gt__  r  r1   c                 B    | j                  |t        j                        S rl   )r  r  __ge__r   s     r/   r  zKeyBasedCompareMixin.__ge__  r  r1   c                 B    | j                  |t        j                        S rl   )r  r  r   r   s     r/   r   zKeyBasedCompareMixin.__eq__  r  r1   methodc                 t    t        || j                        st        S  || j                  |j                        S rl   )r5   r  NotImplementedr  )r.   r   r  s      r/   r  zKeyBasedCompareMixin._compare  s1    %!5!56!!d''););<<r1   )r   r   r   r   	__slots__r   r   r0   r   r  r   r  r  r  r  r   r	   r  r   r1   r/   r  r    s    A!23I.C .6L1M .RV .'# '5C 5D 55C 5D 55C 5D 55C 5D 55C 5D 5=c =8S#J4D+E =$ =r1   r  NormalizedExtraextrac                 h    t        t        t        j                  dd|       j	                               S )aD  Convert an arbitrary string to a standard 'extra' name

    Any runs of non-alphanumeric characters are replaced with a single '_',
    and the result is always lowercased.

    This function is duplicated from ``pkg_resources``. Note that this is not
    the same to either ``canonicalize_name`` or ``_egg_link_name``.
    z[^A-Za-z0-9.-]+r  )r   r  resubr  )r  s    r/   
safe_extrar    s(     (93!F!L!L!NOOr1   )sha1sha224sha384sha256sha512md5c                       e Zd ZdZddgZdeddf fdZdefdZdefd	Ze	defd
       Z
e	defd       Ze	defd       Ze	defd       Ze	defd       Ze	defd       Zdeeef   fdZe	defd       Ze	defd       Z ej*                  d      Ze	dee   fd       Z ej*                  d      Ze	dee   fd       Z ej*                  dj7                  dj9                  e                  Ze	dee   fd       Ze	dee   fd       Z e	defd       Z!e	de"fd       Z#e	de"fd       Z$e	de"fd       Z%e	de"fd        Z& xZ'S )!Linkz:Represents a parsed link from a Package Index's simple URL_parsed_url_urlr  r+   Nc                     t         j                  j                  |      | _        |xr |j	                         xs || _        t        |   |t               y)zO
        :param url: url of the resource pointed to (href of the link)
        )rq   r  N)	rs  r   r  r  rZ   r  superr0   r  )r.   r  r   s     r/   r0   zLink.__init__  sG     "<<005 'CIIK.3	S6r1   c                     | j                   S rl   r  r   s    r/   __str__zLink.__str__  s    xxr1   c                     d|  dS )Nz<Link >r   r   s    r/   r   zLink.__repr__  s    vQr1   c                     | j                   S rl   )r  r   s    r/   r  zLink.url  s    yyr1   c                 
   | j                   j                  d      }t        j                  |      }|st	        | j
                        \  }}|S t        j                  j                  |      }|sJ d| j                  d       |S )Nr  zURL z produced no filename)
r>   rstrip	posixpathbasenamesplit_auth_from_netlocr  rs  r   unquoter  )r.   r>   r   r  
_user_passs        r/   r"   zLink.filename  sw    yy$!!$' "8!DFJM||##D)>tDII=(=>>tr1   c                 ,    t        | j                        S rl   )r  r  r   s    r/   	file_pathzLink.file_path  s    488$$r1   c                 .    | j                   j                  S rl   )r  schemer   s    r/   r  zLink.scheme  s    &&&r1   c                 .    | j                   j                  S )z4
        This can contain auth information.
        )r  r  r   s    r/   r  zLink.netloc  s    
 &&&r1   c                 h    t         j                  j                  | j                  j                        S rl   )rs  r   r  r  r>   r   s    r/   r>   z	Link.path  s#    ||##D$4$4$9$9::r1   c                 p    t        t        j                  | j                  j	                  d                  S )Nr  )splitextr  r  r>   r  r   s    r/   r  zLink.splitext   s'    	**499+;+;C+@ABBr1   c                 (    | j                         d   S Nrt   )r  r   s    r/   extzLink.ext  s    }}q!!r1   c                 n    | j                   \  }}}}}t        j                  j                  ||||df      S Nru   )r  rs  r   
urlunsplit)r.   r  r  r>   query	_fragments         r/   url_without_fragmentzLink.url_without_fragment  s8    151A1A.eY||&&eR'HIIr1   z[#&]egg=([^&]*)c                 t    | j                   j                  | j                        }|sy |j                  d      S r
  )_egg_fragment_rer   r  groupr.   r  s     r/   egg_fragmentzLink.egg_fragment  s0    %%,,TYY7{{1~r1   z[#&]subdirectory=([^&]*)c                 t    | j                   j                  | j                        }|sy |j                  d      S r
  )_subdirectory_fragment_rer   r  r  r  s     r/   subdirectory_fragmentzLink.subdirectory_fragment  s0    ..55dii@{{1~r1   z({choices})=([a-f0-9]+)|)choicesc                 t    | j                   j                  | j                        }|r|j                  d      S y )Nr   _hash_rer   r  r  r  s     r/   r  z	Link.hash"  .    $$TYY/;;q>!r1   c                 t    | j                   j                  | j                        }|r|j                  d      S y r
  r  r  s     r/   	hash_namezLink.hash_name)  r  r1   c                     t        j                  | j                  j                  dd      d   j                  dd      d         S )Nr  rt   r   ?)r  r  r  r   r   s    r/   show_urlzLink.show_url0  s9    !!$))//#q"9!"<"B"B3"J1"MNNr1   c                      | j                   dk(  S )Nr  )r  r   s    r/   is_filezLink.is_file4  s    {{f$$r1   c                 (    | j                   t        k(  S rl   )r  WHEEL_EXTENSIONr   s    r/   is_wheelzLink.is_wheel8  s    xx?**r1   c                 &    | j                   t        v S rl   )r  vcs_all_schemesr   s    r/   is_vcszLink.is_vcs<  s    {{o--r1   c                     | j                   d uS rl   )r!  r   s    r/   has_hashzLink.has_hash@  s    ~~T))r1   )(r   r   r   r   r  rA   r0   r  r   r   r  r"   r  r  r  r>   r   r  r  r  r  compiler  r   r  r  r  formatry   _SUPPORTED_HASHESr  r  r!  r$  r   r&  r)  r,  r.  __classcell__)r   s   @r/   r  r    s   D 	I
77 
7  #   S   #   %3 % % ' ' ' ' ' ' ;c ; ;C%S/ C "S " " Jc J J "rzz"45hsm   !+

+F Gx}   rzz"))#((;L2M)NH hsm   8C=   O# O O % % % +$ + + . . . *$ * *r1   r  c                   |    e Zd ZU dZej
                  j                  ed<   ee	e
e	   f   ed<   e	ed<   ee	e	f   ed<   y)_CleanResulta  Convert link for equivalency check.

    This is used in the resolver to check whether two URL-specified requirements
    likely point to the same distribution and can be considered equivalent. This
    equivalency logic avoids comparing URLs literally, which can be too strict
    (e.g. "a=1&b=2" vs "b=2&a=1") and produce conflicts unexpecting to users.

    Currently this does three things:

    1. Drop the basic auth part. This is technically wrong since a server can
       serve different content based on auth, but if it does that, it is even
       impossible to guarantee two URLs without auth are equivalent, since
       the user can input different auth information when prompted. So the
       practical solution is to assume the auth doesn't affect the response.
    2. Parse the query to avoid the ordering issue. Note that ordering under the
       same key in the query are NOT cleaned; i.e. "a=1&a=2" and "a=2&a=1" are
       still considered different.
    3. Explicitly drop most of the fragment part, except ``subdirectory=`` and
       hash values, since it should have no impact the downloaded content. Note
       that this drops the "egg=" part historically used to denote the requested
       project (and extras), which is wrong in the strictest sense, but too many
       people are supplying it inconsistently to cause superfluous resolution
       conflicts, so we choose to also ignore them.
    r9   r  subdirectoryr  N)r   r   r   r   rs  r   SplitResultr/  r   rA   r   r   r1   r/   r4  r4  E  s@    2 LL$$$T#YcNr1   r4  linkc                    | j                   }|j                  j                  dd      d   }|j                  dk(  r|sd}t        j
                  j                  |j                        }d|v rt        j                  d|        	 |d   d	   }t        D ci c]  }||v s|||   d	    }}t        |j                  |d
d
      t        j
                  j                  |j                        ||      S # t        t        f$ r d
}Y zw xY wc c}w )N@rt   rr   r  r  eggzIgnoring egg= fragment in %sr5  r   ru   )r  r  fragment)r9   r  r5  r  )r  r  rsplitr  rs  r   parse_qsr;  loggerdebug
IndexErrorKeyErrorr1  r4  _replacer  )r7  r9   r  r;  r5  kr  s          r/   _clean_linkrD  e  s   F]]!!#q)"-F}}v||$$V__5H3T:  /2
 *;LAa8ma!QLFLfBDll##FLL1!	  !  Ms   C2 	D	D	2DD)maxsizelink1link2c                 0    t        |       t        |      k(  S rl   )rD  )rF  rG  s     r/   links_equivalentrI    s    uU!333r1   c                   J   e Zd ZdZ	 	 	 	 	 	 	 	 d'dee   dedee   dee   dee	e
      dee	e
      d	ee	e
      d
edee
   deee
ef      ddfdZde
fdZde
fdZedee
   fd       Zedefd       Zedefd       Zd(deee
      defdZedefd       Zede
fd       Zedefd       Zedefd       Zedefd       Zedefd       Zedefd       Zedefd       Z edefd       Z!de
fdZ"de
fd Z#de
fd!Z$de
fd"Z%de
fd#Z&de
fd$Z'd)defd%Z(d*de
fd&Z)y)+r$   zy
    Represents a pip requirement either directly installable or a link where to
    fetch the relevant requirement.
    Nr]   rP   r7  markerr  r  hash_optionsrN   extrasrX   r+   c                    |t        |t              sJ |       || _        || _        || _        |r!|j
                  rt        |j
                        }|| _        |	r|	| _        n:|r)|j                  D ch c]  }t        |       c}| _        nt               | _        ||r|j                  }|| _        |xs g | _        |xs g | _        |xs g | _        |
xs i | _        yc c}w )a  
        Initialize a new pip requirement
        
        - ``req`` is a packaging Requirement object that may be None
        - ``requirement_line`` is the original line this requirement was found
        - ``link`` is a Link object provided when the requirement is a path or URL
        - ``marker`` is a packaging Marker object.
          This is provided when a marker is used and there is no ``req`` Requirement.
        - ``install_options``, ``global_options`` and ``hash_options`` are the
          CLI-style pip options for this specifc requirement.
        - ``is_constraint`` is True if this requirement came from loading a
           nested ``-c/--constraint`` file.
        - ``extras`` is a list of [extra] strings for this package.
           This is provided when extras are used and there is no ``req`` Requirement.
        - ``invalid_options`` are global pip options that are mistakenly set at the line-level.
           This is an error.
        N)r5   r   r]   rP   rN   r  r  r7  rM  r  setrK  r  r  rL  rX   )r.   r]   rP   r7  rK  r  r  rL  rN   rM  rX   r  s               r/   r0   zInstallRequirement.__init__  s    < {jk:?C?: 0*377=D	 DK:=**E:e,EDK%DK>cZZF  /4",2(.B.4" Fs   3C!c                 "   | j                   rJt        | j                         }| j                  rN|dj                  | j                  j                        z  }n%| j                  r| j                  j                  }nd}|d| j
                   dz  }|S )Nz from {}z<{self.__class__.__name__}>z (from r   )r]   rA   r7  r0  r  rP   )r.   ss     r/   r  zInstallRequirement.__str__  sr    88DHHAyyZ&&tyy}}55YY		A-A	wt,,-Q//r1   c           	          d| j                   j                   d| j                  d| j                  d| j                   d	S )N<z: req=, link=z
 (from z)>)r   r   r]   r7  rP   r   s    r/   r   zInstallRequirement.__repr__  sL    ''(txxl ;II= !++, -	
r1   c                 R    | j                   xr | j                   j                  xs d S rl   )r]   r   r   s    r/   r   zInstallRequirement.name  s    xx)DHHMM1T1r1   c                 R    | j                   xr | j                   j                  xs d S rl   )r]   	specifierr   s    r/   rW  zInstallRequirement.specifier  s     xx.DHH..6$6r1   c                     | j                   }|xr0 t        |      dk(  xr  t        t        |            j                  dv S )zReturn whether I am pinned to an exact version.

        For example, some-package==1.2 is pinned; some-package>1.2 is not.
        rt   >   =====)rW  r   nextiterr  )r.   
specifierss     r/   	is_pinnedzInstallRequirement.is_pinned  s<     ^^
gc*o2gtD<L7M7V7VZg7ggr1   extras_requestedc                 N     |sd} j                   t         fd|D              S y)N)ru   c              3   X   K   | ]!  }j                   j                  d |i       # yw)r  N)rK  evaluate)r6  r  r.   s     r/   r7  z2InstallRequirement.match_marker.<locals>.<genexpr>  s*      ;@$$gu%56s   '*T)rK  any)r.   r_  s   ` r/   match_markerzInstallRequirement.match_marker  s7      %;;" DT   r1   c                     | j                   xr | j                   j                  xs- | j                  xr | j                  j                  t              S rl   )r7  r)  r   r  r(  r   s    r/   r)  zInstallRequirement.is_wheel  s@     YY-499-- C		Adii00A	
r1   c                 r    | j                   r+t        t        | j                        d   j                        S y)z2
        Return a pinned version or None.
        r   N)r^  rA   r   rW  versionr   s    r/   get_pinned_versionz%InstallRequirement.get_pinned_version	  s/    
 >>tDNN+A.6677 r1   c                 "    t        | t              S rl   )r5   EditableRequirementr   s    r/   r:  zInstallRequirement.is_editable  s    $ 344r1   c                     t        | j                        xs- | j                  xr t        | j                  j                        S rl   )is_archive_filer   r7  r  r   s    r/   
is_archivezInstallRequirement.is_archive  s1    tyy) 
II8/$))--8	
r1   c                 \    | j                   xr t        | j                   j                        S rl   )r7  is_urlr  r   s    r/   ro  zInstallRequirement.is_url  s    yy2VDIIMM22r1   c                 J    | j                   xr | j                   j                  S rl   )r7  r,  r   s    r/   
is_vcs_urlzInstallRequirement.is_vcs_url   s    yy-TYY---r1   c                     | j                   xr | j                   j                  d      xs- | j                  xr t        | j                  j                        S )N.)r   r   r7  _looks_like_pathr  r   s    r/   is_local_pathz InstallRequirement.is_local_path$  sC     YY4499//4 ?		=.tyy}}=	
r1   c                 ,    t        | j                        S rl   )is_name_at_url_requirementr   r   s    r/   is_name_at_urlz!InstallRequirement.is_name_at_url+  s    )$))44r1   c                 :    | j                   xr d| j                   v S )Nz#eggr   r   s    r/   has_egg_fragmentz#InstallRequirement.has_egg_fragment/  s    yy0Vtyy00r1   c                     | j                   sy| j                  rJd| j                   }|| j                         z  }|| j                         z  }|| j	                         z  }|S y)Nru   #egg=)rz  r   dumps_extrasdumps_specifierdumps_marker)r.   egg_frags     r/   dumps_egg_fragmentz%InstallRequirement.dumps_egg_fragment3  sf    $$99tyyk*H))++H,,..H))++HOr1   c                 "    | j                   xs dS r  r   r   s    r/   
dumps_namezInstallRequirement.dumps_name?  s    yyBr1   c                 n    | j                   xr$ dj                  t        | j                               xs dS )N,ru   )rW  ry   sorted_specifiersr   s    r/   r~  z"InstallRequirement.dumps_specifierB  s*    ~~M#((+<T^^+L"MSQSSr1   c                 x    | j                   sydj                  t        | j                   xs g             }d| dS )Nru   r  [])rM  ry   rw   )r.   rM  s     r/   r}  zInstallRequirement.dumps_extrasE  s6    {{&!2346(!}r1   c                 D    | j                   xr d| j                    xs dS )N; ru   )rK  r   s    r/   r  zInstallRequirement.dumps_markerK  s!    {{1DKK=17R7r1   c                 d    | j                   xr t        | j                   j                        xs dS r  )r7  rA   r  r   s    r/   	dumps_urlzInstallRequirement.dumps_urlN  s#    yy/S/525r1   c                 4   t        di d| j                  dt        | j                        d| j                  d| j
                  xr | j                  xs dd| j                  j                  |      d| j                  xr | j                  j                  xs dd	| j                  xr t        | j                        xs dd
| j                  xs g d| j                  xs g d| j                  xs g d| j                   d| j"                  xr t%        | j"                        xs g d| j&                  xs i d| j(                  d| j*                  d| j,                  d| j.                  d| j0                  d| j2                  d| j4                  S )ze
        Return a mapping of plain Python type representing this
        InstallRequirement.
        r   rW  r:  r^  FrP   r7  NrK  r  r  rL  rN   rM  rX   rm  r)  ro  rq  rx  ru  rz  r   )rd   r   r  rW  r:  r]   r^  rP   re   r7  r  rK  rA   r  r  rL  rN   rM  rw   rX   rm  r)  ro  rq  rx  ru  rz  )r.   rc   s     r/   re   zInstallRequirement.to_dictQ  s   
  

'7
 ((
 hh14>>:U	

 "22::;KL
 ,tyy}}4
 ;;33t{{#3;t
 !006B
  ..4"
 **0b
 ,,
 ;;66$++#6<"
 !006B
 
 ]]
  ;;!
" #
$  ..%
& ,,'
( "22)
 	
r1   c                 .	   g }| j                   r| j                         | j                         z   dz   }| j                  rU| j                  j                  j                  |      s|j                  |       |j                  | j                                | j                  r|j                  d       |j                  | j                                n| j                  rL| j                         }|j                  |       | j                         }|r||vr|j                  |       n| j                  rL| j                         }|j                  |       | j                         }|rP||vrK|j                  |       n8| j                  r| j                  r |j                  | j                                n|j                  | j                                | j                  r0|j                  d       |j                  | j                                | j                  r|j                  d       |j                  | j                                nf| j                  s| j                   r| j                  r |j                  | j                                n|j                  | j                                | j                  r0|j                  d       |j                  | j                                | j                  r| j                  s|j                  d       |j                  | j                                n~|r|j                  | j                                |j                  | j                                |j                  | j#                                |j                  | j                                | j$                  r8|j                  d       |j                  t'        | j$                  dd             | j(                  r7|j                  d       |j                  t'        | j(                  d             | j*                  r8|j                  d       |j                  t'        | j*                  dd	             d
j-                  |      S )z
        Return a single string line representing this InstallRequirement
        suitable to use in a requirements file.
        Optionally exclude the name if ``with_name`` is False for simple
        requirements
        r9  rs   r  T)r%   r   r   r  )r%   r   r  )r%   r   r   ru   )rx  r  r}  r7  r  r   r6   r  rK  r  rq  r  ro  ru  rM  r)  rm  r~  r  r   r  rL  ry   )r.   	with_namer  name_aturefs         r/   rx   zInstallRequirement.dumpsm  sB    oo'$*;*;*==CGyyyy}}//8LL)T^^-.{{S!T..01__!BLL((*BblR [[!BLL((*BblR yyT^^-.T__./{{S!T..01{{S!T..01mmtyyT^^-.T__./{{S!T..01{{{{LL%T..01 T__./LL**,-LL--/0LL**,- LLLL2,,-   LLLL2++, 
 LLLL) --'!% wwu~r1   )NNNNNFr   Nrl   r   r}  )*r   r   r   r   r   r   r   r  r   r   rA   r   r
   r   r   r0   r  r   r   r   r   rW  r^  r   rd  r)  rh  r:  rm  ro  rq  ru  rx  rz  r  r  r~  r}  r  r  re   rx   r   r1   r/   r$   r$     s     $#'/3.2,0#"$4875k"75 *75 tn	75
  75 "$s),75 !c+75 tCy)75 75 375 "$sCx.175 
75r
 

# 
 2hsm 2 2 7< 7 7 h4 h h
Xhsm-D 
PT 
 
$ 
 
 8C 8 8 5T 5 5 
D 
 

 3 3 3 .D . . 
t 
 
 5 5 5 1$ 1 1
C 
C T Tc 8c 863 6
 
8_s _r1   r$   rg  c                 j    t        | t        t        f      r| S | j                  d      } t	        |       S )zE
    Return a packaging Version-like object suitable for sorting
    z.*)r5   r   r   r  r   )rg  s    r/   _as_versionr    s2    
 'M734 ..&W~r1   rW  c                 b    d }t        | xs g |      D cg c]  }t        |       c}S c c}w )z
    Return a list of sorted Specificier from a SpecifierSet, each converted to a
    string.
    The sort is done by version, then operator
    c                 Z    t        | j                        | j                  | j                  fS rl   )r  rg  r  )specs    r/   ro   z#sorted_specifiers.<locals>.<lambda>  s    DLL 94<<W r1   rp   )rw   rA   )rW  
by_versionrQ  s      r/   r  r    s-     XJ"9?
CDqCFDDDs   ,c                       e Zd ZdZd Zy)rj  ac  
    Represents a pip editable requirement.
    These are special because they are unique to pip (e.g., they cannot be
    specified only as packaging.requriements.Requirement.
    They track:
    - a path/ or a path/subpath to a dir with an optional [extra]. 
    - a VCS URL with a package name i.e., the "#egg=<name>" fragment
      Using "#egg=<name>[extras]<specifier>" is accepted too, but version
      specifier and extras will be ignored and whatever is pointed to by the VCS
      will be used instead:
       -e git+https://github.com/bastikr/boolean.py.git#egg=boolean.py[foo]==3.8
      is the same as:
       -e git+https://github.com/bastikr/boolean.py.git#egg=boolean.py
    
    As a recap for VCS URL in #egg=<name> the <name> can be a packaging
    Requirement-compatible string, but only name is kept and used.
    Trailing marker is an error
    c                    dg}| j                   r| j                   j                  }n8| j                  r,| j                  j                  r| j                  j                  }|j                         t	        |      rS| j                         }||vr|j                  | j                                |j                  | j                                nt        | j                   xr | j                   j                        rs| j                  rd| j                   nd}| j                         }||vr||z  }|| j                         z  }|| j                         z  }|r||vr|j                  |       dj                  |      S )z{
        Return a single string line representing this requirement
        suitable to use in a requirements file.
        z--editable r|  ru   )r7  r  r]   r6   rt  r}  r  ro  r   r~  ry   )r.   r  r7  rM  r  s        r/   rx   zEditableRequirement.dumps  s,   
 9999==DXX$((,,88<<DTD!&&(FT!T..01LL**,-DII/$))--0.2iityyk*RH&&(FT!F",,..H))++HHD0X&wwu~r1   Nr   r   r1   r/   rj  rj    s    &!r1   rj  )zbzr+httpz	bzr+httpszbzr+sshzbzr+sftpzbzr+ftpzbzr+lpzbzr+filezgit+httpz	git+httpszgit+sshzgit+gitzgit+filezhg+filezhg+httpzhg+httpszhg+sshzhg+static-httpzsvn+sshzsvn+httpz	svn+httpszsvn+svnzsvn+file)sshgithgbzrsftpsvnc                 8    t        |       }|y|g dt        z   v S )aH  
    Return true if the name looks like a URL.

    For example:
    >>> is_url("name@http://foo.com")
    False
    >>> is_url("git+http://foo.com")
    True
    >>> is_url("ftp://foo.com")
    True
    >>> is_url("file://foo.com")
    True
    >>> is_url("git://foo.com")
    False
    >>> is_url("www.foo.com")
    False
    F)httphttpsr  ftp)r  r+  )r   r  s     r/   ro  ro  +	  s'    $ D!F~5GGGr1   r  sizec              #   >   K   	 | j                  |      }|sy| w)z7Yield pieces of data from a file-like object until EOF.N)r  )r  r  chunks      r/   read_chunksr  L	  s&     
		$	 s   r>   c                     t        j                  |       \  }}|j                         j                  d      r|dd |z   }|dd }||fS )z,Like os.path.splitext, but take off .tar too.tarN)r  r  r  r  )r>   baser  s      r/   r  r  U	  sN    ""4(ID#zz|V$23i#oCRy9r1   r  c                    d| vr| dfS | j                  dd      \  }} d}d|v r|j                  dd      \  }}n|d}}t        j                  j	                  |      }|t        j                  j	                  |      }| ||ffS )zp
    Parse out and remove the auth information from a netloc.

    Returns: (netloc, (username, password)).
    r9  )NNrt   Nr  )r<  r   rs  r   r  )r  authpwusers       r/   r  r  ^	  s     &|##
 ==a(LD&B
d{ ::c1%bb<<%D	~\\!!"%D":r1   z.whl)z.tar.bz2z.tbzBZ2_EXTENSIONS)z.tar.xzz.txzz.tlzz.tar.lzz	.tar.lzmaXZ_EXTENSIONSz.zipZIP_EXTENSIONS)z.tar.gzz.tgzr  TAR_EXTENSIONSc                 T    | syt        |       d   j                         }|t        v ryy)a1  
    Return True if `name` is a considered as an archive file.
    For example:
    >>> assert is_archive_file("foo.whl")
    >>> assert is_archive_file("foo.zip")
    >>> assert is_archive_file("foo.tar.gz")
    >>> assert is_archive_file("foo.tar")
    >>> assert not is_archive_file("foo.tar.baz")
    Frt   T)r  r  ARCHIVE_EXTENSIONS)r   r  s     r/   rl  rl  	  s0     
4.

!
!
#C
  r1   c                     t        j                  d|       }d }|r&|j                  d      }|j                  d      }||fS | }||fS )Nz^(.+)(\[[^\]]+\])$rt   r   )r  r  r  )r>   mrM  path_no_extrass       r/   _strip_extrasr  	  sT    
&-AF 6!! 6!!r1   rM  c                 f    | s
t               S t        d| j                         z         j                  S )Nplaceholder)rO  r   r  rM  )rM  s    r/   convert_extrasr  	  s(    u}v||~56===r1   editable_reqc                    | }t        |      \  }}|j                         }|j                  d      st        |      st	        |      rMt        |      j                  }|r)||t        d|j                         z         j                  fS ||t               fS t        D ]-  }|j                         j                  | d      s&| d| } n t        |      }t        |      xs t	        |      }|j                  s(|s&dj                  t              }	t        |  d|	 d      |j                  }|s|st        dj                  |             ||t               fS )	zParses an editable requirement into:
        - a requirement name
        - an URL
        - extras

    Accepted requirements:
        svn+http://blahblah@rev#egg=Foobar[baz]
        .[some_extra]
    )r  rs  r  r  +rh  zq is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with z).zZCould not detect requirement name for '{}', please specify one with #egg=your_package_name)r  r  r   rt  _is_plain_namer  r  r   rM  rO  vcsr,  ry   r+  r   r0  )
r  r  url_no_extrasrM  unelpackage_nameversion_controlr7  is_path_likebackendss
             r/   parse_editabler  	  sh    C *#.M6 D(D!$M*77MFLLN:;BB   55 99;!!_$5Q"78$%Qse,C
 9D#C(?N3,?LKK<99_-n 'j,
 	
 $$L**0&*>
 	
 ce##r1   c            	       B    e Zd Zdee   dee   dee   dee   fdZ	d Z
y)RequirementPartsrequirementr7  rK  rM  c                 <    || _         || _        || _        || _        y rl   r  r7  rK  rM  )r.   r  r7  rK  rM  s        r/   r0   zRequirementParts.__init__	  s!     '	r1   c           	      p    d| j                   d| j                  d| j                  d| j                  d	S )NzRequirementParts(requirement=rT  z	, marker=z	, extras=r   r  r   s    r/   r   zRequirementParts.__repr__
  sC    +D,<,<+? @II=	$++ 9kk_A'	
r1   N)r   r   r   r   r   r  r   r   rA   r0   r   r   r1   r/   r  r  	  sD    
k*
 tn
  	

 C

r1   r  c                     t        |       \  }}}d }|	 t        |      }t	        |t        |      d |      S # t        $ r}t        d| d|       d }~ww xY w)NzInvalid requirement: 'z': r  )r  r   r   r   r  r  )r  r   r  extras_overrider]   r`   s         r/   parse_reqparts_from_editabler  
  sz    !/!=D#
C	Kd#C #Y	  " 	K#&<TF#aS$IJJ	Ks   8 	AAArP   rX   c                     t        |       }t        |j                  ||j                  ||r|j	                  dg       ng |r|j	                  dg       ng |r|j	                  dg       ng |j
                  |	      S )Nr  r  r  )	r]   rP   r7  rN   r  r  rL  rM  rX   )r  rj  r  r7  r   rM  )r  rP   r%   rX   rN   r  s         r/   build_editable_reqr  !
  ss     )6E)ZZ#>E$5r:2<Cw{{#3R829W[[2.r||'
 
r1   z[\w\-\.\_]+c                     | syt         j                  j                  | v ryt         j                  j                  t         j                  j                  | v ry| j	                  d      ryy)au  Checks whether the string ``name``  "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).
    FTrs  )ru  r>   sepaltsepr   r   s    r/   rt  rt  <
  sO     	ww{{d	ww~~!bggnn&<sr1   c                   "    e Zd ZU eed<   eed<   y)	NameAtUrlr  r  N)r   r   r   rA   r/  r   r1   r/   r  r  Q
  s    
I	Hr1   r  reqstrc                     | syd| v rY| j                  d      \  }}}|j                         }|j                         }t        |      st        |      rt	        ||      S yyy)a&  
    Split ``reqstr`` and return a NameAtUrl tuple or None if this is not
    a PEP-508-like requirement such as:
    foo @ https://fooo.com/bar.tgz

    For example::
    >>> assert split_as_name_at_url("foo") == None
    >>> assert split_as_name_at_url("") is None

    >>> split = split_as_name_at_url("foo@https://example.com")
    >>> expected = NameAtUrl(spec='foo', url='https://example.com')
    >>> assert split == expected, split

    >>> split = split_as_name_at_url("fo/o@https://example.com")
    >>> assert split is None

    >>> split = split_as_name_at_url("foo@example.com")
    >>> assert split is None

    >>> split = split_as_name_at_url("foo@git+https://example.com")
    >>> expected = NameAtUrl(spec='foo', url='git+https://example.com')
    >>> assert split == expected, split
    Nr9  )	partitionrZ   rt  ro  r  )r  r  r  r  s       r/   split_as_name_at_urlr  V
  sg    0 
f} '',azz|iik%&+T3'' +6% r1   c                 2    t        | xr t        |             S )a#  
    Return True if this requirement is in the "name@url" format.
    For example:
    >>> is_name_at_url_requirement("foo@https://foo.com")
    True
    >>> is_name_at_url_requirement("foo@ https://foo.com")
    True
    >>> is_name_at_url_requirement("foo @ https://foo.com")
    True
    )r   r  )r  s    r/   rw  rw  z
  s     7/788r1   c                 p    | r|syt        |      r| S t        |       syt        |      st        |       ry| S )z
    First, it checks whether a provided path looks like a path. If it
    is, returns the path.

    Otherwise, check if the path is notan archive file (such as a .whl) or is a
    PEP 508 URL "name@url" requirement and return None
    N)rt  rl  rw  )r>   r   s     r/   _get_url_from_pathr  
  s<     T4 !$'+Ed+KKr1   r9  c                    t        |       rd}nd}|| v r6| j                  |d      \  } }|j                         }|sd}nt        |      }nd}| j                         }d}|}d}d}t        |      rt	        |      }n2t        |      s't        |      \  }	}t        |	|      }
|
rt	        |
      }|r|j                  dk(  r5t        j                  d|j                        rt	        |j                        }|j                  r1t        |j                        }|j                    d|j"                   }n|j$                  }n|}t'        |      }dt(        d	t*        fd
}|	 ||      }nd}t-        ||||      S )z_
    Return RequirementParts from a ``requirement_string``.
    Raise exceptions on error.
    r  ;rt   Nr  z\.\./rZ  req_as_stringr+   c                 h    d }	 t               }|j                  D ]/  }t        |      }|j                  d      s d| d}t	        |       |S # t
        $ rX}t        j                  j                   v rd}n!d v rt         fdt        D              sd}nd}d	| d
| }t	        |      d }~ww xY w)Nr  z"Unsupported extras after version 'z'.zIt looks like a path.r   c              3   &   K   | ]  }|v  
 y wrl   r   )r6  opr  s     r/   r7  zHparse_reqparts_from_string.<locals>._parse_req_string.<locals>.<genexpr>
  s      2(*m#2s   z,= is not a valid operator. Did you mean == ?ru   zInvalid requirement: z: )r   rW  rA   r  r   r   ru  r>   r  rc  	operators)r  r   r  spec_strr_   r`   add_msgs   `      r/   _parse_req_stringz5parse_reqparts_from_string.<locals>._parse_req_string
  s    	1]+B&  1t9$$S)>xjKC+C00	1
 	/ " 	)ww{{m+1%c 2.72 / I )'"QC8C#C((	)s   A 	B1AB,,B1)ro  r   rZ   r   r  rw  r  r  r  r  r   r  r>   r)  Wheelr"   r   rg  r  r  rA   r   r  )r9  
marker_sepmarker_as_stringrK  requirement_string_no_markerr  r>   r7  extras_as_stringpr  wheelrM  r  r]   s                  r/   parse_reqparts_from_stringr  
  s   
  !

''/A/G/G
TU/V,,+113F,-F#5#;#;#= M'DD*+01'(DE+D1 $@A9D ;;& RYYx%B		?D==$--(E$zzl"U]]O<M !--M
 5,-F  :  %6}%ECvv66r1   c                    t        |       }t        |j                  ||j                  |j                  |r|j                  dg       ng |r|j                  dg       ng |r|j                  dg       ng ||j                  |xs i 
      S )a   Create an InstallRequirement from a requirement_string, which might be a
    requirement, directory containing 'setup.py', filename, or URL.

    :param requirement_line: An optional RequirementLine describing where the
        line is from, for logging purposes in case of an error.
    )r9  r  r  r  )
r]   rP   r7  rK  r  r  rL  rN   rM  rX   )r  r$   r  r7  rK  r   rM  )r9  rP   r%   rX   rN   r  s         r/   build_install_reqr  
  s     ':LME)ZZ||>E$5r:2<Cw{{#3R829W[[2.r#||'-2 r1   
parsed_reqc                     | j                   }| j                  }| j                  }| j                  }| j                  }| j
                  rt        |||||      S t        |||||      S )N)r  rP   r%   rN   rX   )r9  rP   r%   rN   rX   )r9  r%   rX   rP   rN   r:  r  r  )r  r9  r%   rX   rP   rN   s         r/   rW   rW     s     $66  G 00O!22,,M!+-'+
 	
 -)#' r1   c                       e Zd ZdZ ej
                  dej                        ZdeddfdZ	de
e   fdZde
e   defd	Zde
e   d
eeef   defdZdee   defdZy)r  zA wheel filez^(?P<namever>(?P<name>.+?)-(?P<ver>.*?))
        ((-(?P<build>\d[^-]*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
        \.whl|\.dist-info)$r"   r+   Nc                    | j                   j                  |      }|st        | d      || _        |j	                  d      j                  dd      | _        |j	                  d      j                  dd      | _        |j	                  d      | _        |j	                  d      j                  d      | _
        |j	                  d	      j                  d      | _        |j	                  d
      j                  d      | _        | j                  D ch c]1  }| j                  D ]   }| j                  D ]  }t        |||       " 3 c}}}| _        yc c}}}w )zX
        :raises InvalidWheelFilename: when the filename is invalid for a wheel
        z is not a valid wheel filename.r   r  r  verbuildpyverrs  abiplatN)wheel_file_rer  r   r"   r  replacer   rg  	build_tagr   
pyversionsabisplatsr   	file_tags)r.   r"   
wheel_infoxyzs         r/   r0   zWheel.__init__D  s;    ''--h7
&(3R'STT $$V,44S#>	 "''.66sC@#))'2$**7399#>$$U+11#6	%%f-33C8
 #'//
 
499
67djj
IJC1aL


 
s   6Ec                 :    t        d | j                  D              S )z4Return the wheel's tags as a sorted list of strings.c              3   2   K   | ]  }t        |        y wrl   )rA   )r6  tags     r/   r7  z0Wheel.get_formatted_file_tags.<locals>.<genexpr>\  s     93c#h9s   )rw   r  r   s    r/   get_formatted_file_tagszWheel.get_formatted_file_tagsZ  s    9$..999r1   tagsc                 @    t        fd| j                  D              S )a  Return the lowest index that one of the wheel's file_tag combinations
        achieves in the given list of supported tags.

        For example, if there are 8 supported tags and one of the file tags
        is first in the list, then return 0.

        :param tags: the PEP 425 tags to check the wheel against, in order
            with most preferred first.

        :raises ValueError: If none of the wheel's file tags match one of
            the supported tags.
        c              3   J   K   | ]  }|v sj                  |        y wrl   )index)r6  r  r  s     r/   r7  z*Wheel.support_index_min.<locals>.<genexpr>k  s     Lst4::c?Ls   	##minr  r.   r  s    `r/   support_index_minzWheel.support_index_min^  s     LdnnLLLr1   tag_to_priorityc                 @    t        fd| j                  D              S )a  Return the priority of the most preferred tag that one of the wheel's file
        tag combinations achieves in the given list of supported tags using the given
        tag_to_priority mapping, where lower priorities are more-preferred.

        This is used in place of support_index_min in some cases in order to avoid
        an expensive linear scan of a large list of tags.

        :param tags: the PEP 425 tags to check the wheel against.
        :param tag_to_priority: a mapping from tag to priority of that tag, where
            lower is more preferred.

        :raises ValueError: If none of the wheel's file tags match one of
            the supported tags.
        c              3   2   K   | ]  }|v s|     y wrl   r   )r6  r  r  s     r/   r7  z0Wheel.find_most_preferred_tag.<locals>.<genexpr>~  s"      
%(c_>TOC 
s   	
r  )r.   r  r  s     `r/   find_most_preferred_tagzWheel.find_most_preferred_tagm  s#    "  
,0NN
 
 	
r1   c                 :    | j                   j                  |       S )zReturn whether the wheel is compatible with one of the given tags.

        :param tags: the PEP 425 tags to check the wheel against.
        )r  
isdisjointr  s     r/   	supportedzWheel.supported  s    
 >>,,T222r1   )r   r   r   r   r  r/  VERBOSEr  rA   r0   r   r  r   r   r  r   r  r   r   r  r   r1   r/   r  r  :  s    BJJ	 	

	M
 
 
,:c :Md3i MC M
I
04S#X
	
*3hsm 3 3r1   r  r   )FTr   rl   )NNNF)codecsr   	functoolsiologgingr  r  ru  r  r  r  rG   r  r   rB   urllib.parsers  urllib.requestr   r   r   typingr   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   packaging.markersr   packaging.requirementsr   r   packaging.specifiersr   r   packaging.tagsr   packaging.versionr   r   packaging_legacy_versionr   r!   r   r   r/  
IGNORECASEr  r   rA   r   r   r*   r   r&   rY   r(   rU   platformr   r   r  BOM_UTF8	BOM_UTF16BOM_UTF16_BEBOM_UTF16_LE	BOM_UTF32BOM_UTF32_BEBOM_UTF32_LEr   bytesr/  r   r   r7   r   r   r   r   r   r   r   r   r  r  r
  r#   r  r  r  r  r  r  r  r  r  r"  r#  r&  r(  r)  r*  r+  r   rS   r-  r2  r   ReqFileLinesr~  Irr  r  r3  ra  rO  TOP_LEVEL_OPTIONS_DESTr4  r]  rT   get_opt_stringrV   r>  r   rR   rU  r[  r_  rf  rH  rG  rF  r  r  r  r  r  rQ  rR  rz  r  r  r  r  r  r1  r  r4  rD  	lru_cacherI  r$   r  r  rj  r+  r  ro  NetlocTupleDEFAULT_BUFFER_SIZEr  r  r  r(  r  r  r  r  r  rl  	getLoggerr   r>  
_operatorskeysr  r  r  r  r  r  r  r  rt  r  r  rw  r  r  r  rW   r  )rf   s   0r/   <module>r?     s  6    	    	  	    
          & % 5 . * -  # % 24p=@V Vr &Q Q rzz0MM % ( (k <_  	!"H2%{ 2@ "F61; 6>	)5 	)& <<""5) 7LLE!5bggo  __gx +&+&x +&+&!d5  bjj34e  0y 0 0O!2 OB8 B", " $+
	
$	8CK   
 
 #*
		L#(3;
 F "	f 	
V 
f $&  6 "V  (/
		C(xV$  *1
	
4*#v+&  )0
	
6)f%  %

&Xc6k   )0
	
-	)f% 	V  -4
	- HS&[)  & 
 '.
	'hsF{#  '.
	'hsF{#  8Xc8??234  /==s1388}= z 
*  eCHoxCDEseU3;//0
BJJ-rtt4	RZZ()
 ; 4hoo!567 " 2CCA#achh-C 36IIJ  ? tHS(//%9:;  6KKc!#((mK "%::^K  !	 K!!## / /$( (@  ### # e 	#L	# 	# 	#.
.
.
bV  ,'
Z '
e%z3IIJK'
TB BJ	 	-S -U38_ -" 
h++ :5< 5L 5>C| C C4s s .( ( ($S $S $Z= =P +S1	Pc 	Po 	P$ L C* C*L: @d | 4 T"4D 4 4$ 4 #4AAH

sM7:; 

='!"
E E$s) E5, 5v 1H H H< Cx}hsm;<<= -/,B,B h c xPU 3 5c? 3 ; F "6c3h 6"uS#X  $*?";c3h ;"=c3h =#n4~EU # $ 0 
		8	$  %%'		" 	"c8C=&8 9 	">8C= >SX >7$ 7$x}c3s8/K)L 7$t
 
(s 7G 0 37(,04/ d38n% d38n-	
  0 N+113 4 *
 
!( !( !(H9s 9t 9S   .Y73 Y7;K Y7| 37(,04/ d38n% d38n-	
  :!DM3 M3[9 >P D Ls   ``	`)`