
     d                     :   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m	Z	m
Z
mZmZmZmZmZ d dlmZ d dlmZmZ d dlmZ d dlmZmZ d dlmZmZmZmZm Z  d dl!m"Z" d d	l#m$Z$ d d
l%m&Z& d dl'm(Z(m)Z) ddl*m+Z+m,Z,  G d dej-        j.                  Z/ G d de          Z.dS )    N)
CollectionDictIterableIteratorMappingOptionalSequencecast)Requirement)NormalizedNamecanonicalize_name)parse)InvalidWheelUnsupportedWheel)BaseDistributionBaseEntryPointDistributionVersionInfoPathWheel)normalize_path
safe_extra)TempDirectory)parse_wheelread_wheel_metadata_file   )BasePathget_dist_namec            	           e Zd ZdZdeej        ef         dej        ddfdZe	de
j        ded	edd fd
            Zdedeej                 fdZdedee         fdZdS )WheelDistributiona  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.
    filesinfo_locationreturnNc                 "    || _         || _        d S N)_filesr"   )selfr!   r"   s      pC:\Users\ChattiNader\Documents\MyHotelMatch\api\dev\Lib\site-packages\pip/_internal/metadata/importlib/_dists.py__init__zWheelDistribution.__init__0   s    
 *    zfnamelocationc                     t          |          \  }fd                                D             }fd|D             }t          j        |          } | ||          S )Nc              3      K   | ]L}|                      d           |t          j        |                    d d          d                   fV  MdS )/r   N)
startswithpathlibPurePosixPathsplit).0r,   info_dirs     r(   	<genexpr>z1WheelDistribution.from_zipfile.<locals>.<genexpr>@   sr       
 
(~~~..
7(C););B)?@@A
 
 
 
 
 
r*   c                 8    i | ]\  }}|t          |          S  )r   )r6   fullpathrelpathr+   s      r(   
<dictcomp>z2WheelDistribution.from_zipfile.<locals>.<dictcomp>E   s:     
 
 
!' -b(;;
 
 
r*   )r   namelistr3   r4   )	clsr+   r,   r-   _pathsr!   r"   r7   s	    `      @r(   from_zipfilezWheelDistribution.from_zipfile8   s     ""d++!
 
 
 

 
 


 
 
 
%*
 
 
  -hAAs5-(((r*   pathc                     t          j        t          |                    | j        v rt	          | j                  S t          |          r%   )r3   r4   strr&   iterFileNotFoundErrorr'   rC   s     r(   iterdirzWheelDistribution.iterdirL   s>     T++t{::$$$%%%r*   filenamec                 
   	 | j         t          j        |                   }n# t          $ r Y d S w xY w	 |                    d          }n9# t
          $ r,}| j        j        }d| d| d| d}t          |          d }~ww xY w|S )Nzutf-8zError decoding metadata for z: z in z file)	r&   r3   r4   KeyErrordecodeUnicodeDecodeErrorr"   parentr   )r'   rJ   datatextewheelerrors          r(   	read_textzWheelDistribution.read_textR   s    	;w4X>>?DD 	 	 	44		*;;w''DD! 	* 	* 	*&-ER5RRARR8RRRE"5)))	* s#   " 
00A
 

B 'A;;B )__name__
__module____qualname____doc__r   r3   r4   bytesr)   classmethodzipfileZipFilerE   rB   r   r   rI   r   rU   r:   r*   r(   r    r    %   s         +w,e34+ ,+ 
	+ + + + )O) ) 	)
 
) ) ) [)&&H &'2G)H & & & &# (3-      r*   r    c            	       8   e Zd Zdej        j        dee         dee         ddfdZe	de
defd            Ze	d	ed
e
de
defd            Ze	dede
defd            Zedee
         fd            Zedee
         fd            Zedee
         fd            Zdee
         fdZedefd            Zedefd            ZdedefdZdee
         fdZdede
fdZde e!         fdZ"de#j$        j%        fdZ&de e
         fdZ'd de(e
         de e)         fdZ*dS )!Distributiondistr"   installed_locationr#   Nc                 0    || _         || _        || _        d S r%   )_dist_info_location_installed_location)r'   r`   r"   ra   s       r(   r)   zDistribution.__init__a   s!     
+#5   r*   	directoryc                     t          j        |          }t          j        j                            |          } | |||j                  S r%   )r3   Path	importlibmetadatar_   atrO   )r?   rf   r"   r`   s       r(   from_directoryzDistribution.from_directoryk   sA    Y//!.11-@@s4(<===r*   metadata_contentsrJ   project_namec                     t          j        t          dd          j                  }|dz  }|                    |           t
          j        j                            |j	                  } | ||j	        d           S )Nrj   T)kindglobally_managedMETADATA)
r3   rh   r   rC   write_bytesri   rj   r_   rk   rO   )r?   rm   rJ   rn   temp_dirmetadata_pathr`   s          r(   from_metadata_file_contentsz(Distribution.from_metadata_file_contentsq   s|     <zDAAAF
 
 !:-!!"3444!.11-2FGGs4-t444r*   rS   r,   c                    	 |                                 5 }t                              |||j                  }d d d            n# 1 swxY w Y   nN# t          j        $ r}t          |j        |          |d }~wt          $ r}t          | d|           d }~ww xY w | ||j        t          j
        |j                            S )Nz has an invalid wheel, )
as_zipfiler    rB   r-   r\   
BadZipFiler   r   r"   r3   r4   )r?   rS   r,   r+   r`   rR   s         r(   
from_wheelzDistribution.from_wheel   s&   	H!!## Pr(55b$OOP P P P P P P P P P P P P P P! 	< 	< 	<u~t44!; 	H 	H 	H"d#F#F1#F#FGGG	Hs4+W-B5>-R-RSSSsE   A "AA AA AA BA55BBBc                 F    | j         d S t          | j         j                  S r%   )rd   rE   rO   r'   s    r(   r-   zDistribution.location   s$    &44&-...r*   c                 <    | j         d S t          | j                   S r%   )rd   rE   r|   s    r(   r"   zDistribution.info_location   s!    &44&'''r*   c                 V    | j         d S t          t          | j                             S r%   )re   r   rE   r|   s    r(   ra   zDistribution.installed_location   s)    #+4c$":;;<<<r*   c                     | j         dS t          j                            | j         j                  \  }}|dvrdS |                    dd          d         S )zrTry to get the name from the metadata directory name.

        This is much faster than reading metadata.
        N)z
.dist-infoz	.egg-info-r   r   )rd   osrC   splitextr,   r5   )r'   stemsuffixs      r(   _get_dist_name_from_locationz)Distribution._get_dist_name_from_location   s[    
 &4w''(;(@AAf4444zz#q!!!$$r*   c                 p    |                                  pt          | j                  }t          |          S r%   )r   r   rc   r   )r'   r,   s     r(   canonical_namezDistribution.canonical_name   s0    0022OmDJ6O6O &&&r*   c                 4    t          | j        j                  S r%   )parse_versionrc   versionr|   s    r(   r   zDistribution.version   s    TZ/000r*   rC   c                 T    | j                             t          |                    d uS r%   )rc   rU   rE   rH   s     r(   is_filezDistribution.is_file   s#    z##CII..d::r*   c              #      K   t          | j        t          j                  sd S | j                            d                                          D ]}|j        V  d S )Nscripts)
isinstancerd   r3   rh   joinpathrI   r,   )r'   childs     r(   iter_distutils_script_namesz(Distribution.iter_distutils_script_names   sk       $-w|<< 	F(11)<<DDFF 	 	E*	 	r*   c                 v    | j                             t          |                    }|t          |          |S r%   )rc   rU   rE   rG   )r'   rC   contents      r(   rU   zDistribution.read_text   s5    *&&s4yy11?#D)))r*   c                     | j         j        S r%   )rc   entry_pointsr|   s    r(   iter_entry_pointszDistribution.iter_entry_points   s    z&&r*   c                 T    t          t          j        j        | j        j                  S r%   )r
   emailmessageMessagerc   rj   r|   s    r(   _metadata_implzDistribution._metadata_impl   s     EM)4:+>???r*   c                 L    d | j                             dg           D             S )Nc              3   4   K   | ]}t          |          V  d S r%   r   )r6   extras     r(   r8   z4Distribution.iter_provided_extras.<locals>.<genexpr>   s;       
 
"'Ju
 
 
 
 
 
r*   zProvides-Extra)rj   get_allr|   s    r(   iter_provided_extrasz!Distribution.iter_provided_extras   s7    
 
+/=+@+@AQSU+V+V
 
 
 	
r*   r:   extrasc              #     K   d |D             }| j                             dg           D ]_}t          |          j        sV  |s!j                            ddi          rV  @t          fd|D                       rV  `d S )Nc                 0    g | ]}d t          |          iS )r   r   )r6   rR   s     r(   
<listcomp>z2Distribution.iter_dependencies.<locals>.<listcomp>   s#    -W-W-W1w
1.F-W-W-Wr*   zRequires-Distr    c              3   L   K   | ]}j                             |          V  d S r%   )markerevaluate)r6   contextreqs     r(   r8   z1Distribution.iter_dependencies.<locals>.<genexpr>   s3      JJgSZ((11JJJJJJr*   )rj   r   r   r   r   any)r'   r   contexts
req_stringr   s       @r(   iter_dependencieszDistribution.iter_dependencies   s      -W-WPV-W-W-W-//DD 	 	Jj))C: 				 
 3 3WbM B B 				JJJJJJJJJ 				 	r*   )r:   )+rV   rW   rX   ri   rj   r_   r   r   r)   r[   rE   r   rl   rZ   rv   r   rz   propertyr-   r"   ra   r   r   r   r   r   r   boolr   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r:   r*   r(   r_   r_   `   s       6 -6  )6 %X.	6
 
6 6 6 6 >s >/? > > > [>
 5 5 5 	5
 
5 5 5 [5  Tu TC T4D T T T [T /(3- / / / X/
 (x} ( ( ( X(
 =HSM = = = X=

%hsm 
% 
% 
% 
% ' ' ' ' X' 1, 1 1 1 X1;H ; ; ; ; ;Xc]    h 3    '8N#; ' ' ' '@ 5 @ @ @ @
hsm 
 
 
 

	 	
3 	+AV 	 	 	 	 	 	r*   r_   )0email.messager   importlib.metadatari   r   r3   r\   typingr   r   r   r   r   r   r	   r
   "pip._vendor.packaging.requirementsr   pip._vendor.packaging.utilsr   r   pip._vendor.packaging.versionr   r   pip._internal.exceptionsr   r   pip._internal.metadata.baser   r   r   r   r   pip._internal.utils.miscr   pip._internal.utils.packagingr   pip._internal.utils.temp_dirr   pip._internal.utils.wheelr   r   _compatr   r   rj   r_   r    r:   r*   r(   <module>r      s           				  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ; : : : : : I I I I I I I I @ @ @ @ @ @ C C C C C C C C              4 3 3 3 3 3 4 4 4 4 4 4 6 6 6 6 6 6 K K K K K K K K , , , , , , , ,8 8 8 8 8	*7 8 8 8v@ @ @ @ @# @ @ @ @ @r*   