
    iE j                     `   S SK Jr  S SKrS SKrS SKrS SKrS SKJ	r	J
r
JrJrJr  S SKJr  S SKJr  S SKJr  S SKJrJr  S SKJr  S S	KJr  S S
KJrJr  S SKJrJ r J!r!J"r"  S SK#J$r$  S SK%J&r&  S SK'J(r(  S SK)J*r*J+r+  SSK,J-r-J.r.J/r/J0r0   " S S\Rb                  Rd                  5      r3 " S S\5      r2g)    )annotationsN)
CollectionIterableIteratorMappingSequence)PathLike)cast)Requirement)NormalizedNamecanonicalize_name)Version)parse)InvalidWheelUnsupportedWheel)BaseDistributionBaseEntryPointInfoPathWheel)normalize_path)get_requirement)TempDirectory)parse_wheelread_wheel_metadata_file   )BadMetadataBasePathget_dist_canonical_name*parse_name_and_version_from_info_directoryc                  p    \ rS rSrSr      S
S jr\        SS j5       rSS jrSS jr	SS jr
Srg	)WheelDistribution&   a  An ``importlib.metadata.Distribution`` read from a wheel.

Although ``importlib.metadata.PathDistribution`` accepts ``zipfile.Path``,
its implementation is too "lazy" for pip's needs (we can't keep the ZipFile
handle open for the entire lifetime of the distribution object).

This implementation eagerly reads the entire metadata directory into the
memory instead, and operates from that.
c                    Xl         X l        g N_filesinfo_location)selffilesr'   s      Qc:\Py\emelo-reg\venv\Lib\site-packages\pip/_internal/metadata/importlib/_dists.py__init__WheelDistribution.__init__1   s    
 *    c           	        ^
 [        X5      u  m
nU
4S jUR                  5        5       nU VVs0 s H  u  pgU[        X5      _M     nnn[        R                  " UT
5      n	U " X5      $ s  snnf )Nc              3     >#    U  HK  nUR                  T S 35      (       d  M  U[        R                  " UR                  S S5      S   5      4v   MM     g7f)/r   N)
startswithpathlibPurePosixPathsplit).0nameinfo_dirs     r*   	<genexpr>1WheelDistribution.from_zipfile.<locals>.<genexpr>A   sM      
%(1~. BT7((C);B)?@A%s
   A2A)r   namelistr   r3   r4   )clszfr7   location_pathsfullpathrelpathr)   r'   r8   s             @r*   from_zipfileWheelDistribution.from_zipfile9   s|     ""+!

 &+
%*! -b;;%* 	 
  --hA5((
s   A)c                    [         R                  " [        U5      5      U R                  ;   a  [	        U R                  5      $ [        U5      er$   )r3   r4   strr&   iterFileNotFoundErrorr(   paths     r*   iterdirWheelDistribution.iterdirM   s7      T+t{{:$$%%r-   c                    U R                   [        R                  " U5         n UR	                  S5      nU$ ! [         a     g f = f! [
         a2  nU R                  R                  nSU SU SU S3n[        U5      eS nAff = f)Nzutf-8zError decoding metadata for z: z in z file)	r&   r3   r4   KeyErrordecodeUnicodeDecodeErrorr'   parentr   )r(   filenamedatatextewheelerrors          r*   	read_textWheelDistribution.read_textS   s    	;;w44X>?D	*;;w'D
   		 " 	*&&--E25'A3d8*ERE"5))	*s&   #9 A	 
AA	
B-B  Bc                    [         er$   )NotImplementedErrorrI   s     r*   locate_fileWheelDistribution.locate_file`   s
     "!r-   r%   N)r)   z%Mapping[pathlib.PurePosixPath, bytes]r'   zpathlib.PurePosixPathreturnNone)r=   zzipfile.ZipFiler7   rF   r>   rF   r^   r!   )rJ   r   r^   zIterator[pathlib.PurePosixPath])rR   rF   r^   
str | None)rJ   zstr | PathLike[str]r^   zpathlib.Path)__name__
__module____qualname____firstlineno____doc__r+   classmethodrC   rK   rX   r\   __static_attributes__ r-   r*   r!   r!   &   sq    +4+ -+ 
	+ )) ) 	)
 
) )&&"r-   r!   c                  <   \ rS rSr        SS jr\SS j5       r\        SS j5       r\SS j5       r\	SS j5       r
\	SS j5       r\	SS j5       r\	SS	 j5       r\	SS
 j5       r\	SS j5       rSS jrSS jrSS jrS S jrS!S jrS"S jrS#S$S jjrSrg)%Distributionf   c                (    Xl         X l        X0l        g r$   _dist_info_location_installed_location)r(   distr'   installed_locations       r*   r+   Distribution.__init__g   s     
+#5 r-   c                    [         R                  " U5      n[        R                  R                  R                  U5      nU " X2UR                  5      $ r$   )r3   Path	importlibmetadatarj   atrQ   )r<   	directoryr'   rq   s       r*   from_directoryDistribution.from_directoryq   s?    Y/!!..11-@4(<(<==r-   c                
   [         R                  " [        SSS9R                  5      nUS-  nUR	                  U5        [
        R                  R                  R                  UR                  5      nU " XeR                  S 5      $ )Nrw   T)kindglobally_managedMETADATA)
r3   ru   r   rJ   write_bytesrv   rw   rj   rx   rQ   )r<   metadata_contentsrR   project_nametemp_dirmetadata_pathrq   s          r*   from_metadata_file_contents(Distribution.from_metadata_file_contentsw   sr     <<zDAFF
 !:-!!"34!!..11-2F2FG4--t44r-   c                b    UR                  5        n[        R                  X2UR                  5      nS S S 5        U " WUR                  [        R                  " UR                  5      5      $ ! , (       d  f       N@= f! [        R
                   a  n[        UR                  U5      UeS nAff = fr$   )

as_zipfiler!   rC   r>   zipfile
BadZipFiler   r'   r3   r4   )r<   rV   r7   r=   rq   rU   s         r*   
from_wheelDistribution.from_wheel   s    	<!!#r(55bO $ 4++W-B-B5>>-RSS	 $#!! 	<u~~t4!;	<s3   A> !A-A> -
A;7A> ;A> >B.B))B.c                \    U R                   c  g [        U R                   R                  5      $ r$   )ro   rF   rQ   r(   s    r*   r>   Distribution.location   s(    &4&&--..r-   c                H    U R                   c  g [        U R                   5      $ r$   )ro   rF   r   s    r*   r'   Distribution.info_location   s"    &4&&''r-   c                Z    U R                   c  g [        [        U R                   5      5      $ r$   )rp   r   rF   r   s    r*   rr   Distribution.installed_location   s'    ##+c$":":;<<r-   c                ,    [        U R                  5      $ r$   )r   rn   r   s    r*   canonical_nameDistribution.canonical_name   s    &tzz22r-   c                     [        U R                  5      S   =(       d    U R                  R                  n[        U5      $ ! [         a    [        U R                  SS9ef = f)Nr   z invalid metadata entry `version`)reason)r   rn   versionparse_version	TypeErrorr   )r(   r   s     r*   r   Distribution.version   s`    	U:4::FqI &::%%  !)) 	Udjj1STT	Us   ?A A!c                .    U R                   R                  $ r$   )rn   r   r   s    r*   raw_versionDistribution.raw_version   s    zz!!!r-   c                N    U R                   R                  [        U5      5      S L$ r$   )rn   rX   rF   rI   s     r*   is_fileDistribution.is_file   s     zz##CI.d::r-   c              #     #    [        U R                  [        R                  5      (       d  g U R                  R	                  S5      R                  5        H  nUR                  v   M     g 7f)Nscripts)
isinstancero   r3   ru   joinpathrK   r7   )r(   childs     r*   iter_distutils_script_names(Distribution.iter_distutils_script_names   sP      $--w||<<((11)<DDFE** Gs   A*A,c                j    U R                   R                  [        U5      5      nUc  [        U5      eU$ r$   )rn   rX   rF   rH   )r(   rJ   contents      r*   rX   Distribution.read_text   s/    **&&s4y1?#D))r-   c                .    U R                   R                  $ r$   )rn   entry_pointsr   s    r*   iter_entry_pointsDistribution.iter_entry_points   s    zz&&&r-   c                r    [        [        R                  R                  U R                  R
                  5      $ r$   )r
   emailmessageMessagern   rw   r   s    r*   _metadata_implDistribution._metadata_impl   s%     EMM))4::+>+>??r-   c                x    U R                   R                  S/ 5       Vs/ s H  n[        U5      PM     sn$ s  snf )NzProvides-Extra)rw   get_allr   )r(   extras     r*   iter_provided_extras!Distribution.iter_provided_extras   s@     ../?D
D e$D
 	
 
s   7c              #    ^#    U Vs/ s H  nSU0PM	     nnU R                   R                  S/ 5       H  n[        UR                  5       5      mTR                  (       d  Tv   M3  U(       d(  TR                  R                  SS05      (       a  Tv   Mb  [        U4S jU 5       5      (       d  M~  Tv   M     g s  snf 7f)Nr   zRequires-Dist c              3  Z   >#    U  H   nTR                   R                  U5      v   M"     g 7fr$   )markerevaluate)r6   contextreqs     r*   r9   1Distribution.iter_dependencies.<locals>.<genexpr>   s#     JgSZZ((11s   (+)rw   r   r   stripr   r   any)r(   extrasrU   contexts
req_stringr   s        @r*   iter_dependenciesDistribution.iter_dependencies   s     DJ-KFqwlF-K--//DJ "*"2"2"45C::	

 3 3WbM B B	JJJJ	 E .Ls   C B;BC 2C rm   N)rq   zimportlib.metadata.Distributionr'   BasePath | Nonerr   r   r^   r_   )ry   rF   r^   r   )r   bytesrR   rF   r   rF   r^   r   )rV   r   r7   rF   r^   r   )r^   r`   )r^   r   )r^   r   )r^   rF   )rJ   r   r^   bool)r^   zIterator[str])rJ   r   r^   rF   )r^   zIterable[BaseEntryPoint])r^   zemail.message.Message)r^   zIterable[NormalizedName])rh   )r   zCollection[str]r^   zIterable[Requirement])ra   rb   rc   rd   r+   rf   rz   r   r   propertyr>   r'   rr   r   r   r   r   r   rX   r   r   r   r   rg   rh   r-   r*   rj   rj   f   s4   6-6 '6 ,	6
 
6 > >
 5 5 5 	5
 
5 5  T T / /
 ( (
 = =
 3 3 U U " ";'@
 r-   rj   )4
__future__r   email.messager   importlib.metadatarv   r3   r   collections.abcr   r   r   r   r   osr	   typingr
   "pip._vendor.packaging.requirementsr   pip._vendor.packaging.utilsr   r   pip._vendor.packaging.versionr   r   r   pip._internal.exceptionsr   r   pip._internal.metadata.baser   r   r   r   pip._internal.utils.miscr   pip._internal.utils.packagingr   pip._internal.utils.temp_dirr   pip._internal.utils.wheelr   r   _compatr   r   r   r   rw   rj   r!   rh   r-   r*   <module>r      s}    "     M M  ; I 1 @ C  4 9 6 K ="	**77 ="@# r-   