
    Mi,                        S r SSKrSSKrSSKrSSKrSSKJr  SSKJrJ	r	J
r
JrJrJrJrJr  SSKJr  SSKJrJr  SSKJrJr  \\\\\4   \\4   rSS	/r " S
 S5      r " S S\\5      r " S S\\5      r " S S	\5      r g)z)Source of information about a wheel file.    N)contextmanager)BinaryIOClassVarIteratorListOptionalTupleTypecast)InstallerError)RecordEntryparse_record_file)canonicalize_nameparse_wheel_filenameWheelSource	WheelFilec                      ^  \ rS rSr% Sr\r\\\	      \
S'   S\S\SS4U 4S jjr\S	 5       r\S
 5       r\S\\   4S j5       rS\S\4S jrSS jrS\\   4S jrSrU =r$ )r      zqRepresents an installable wheel.

This is an abstract class, whose methods have to be implemented by subclasses.
validation_errordistributionversionreturnNc                 :   > [         TU ]  5         Xl        X l        g)zInitialize a WheelSource object.

:param distribution: distribution name (like ``urllib3``)
:param version: version associated with the wheel
N)super__init__r   r   )selfr   r   	__class__s      k/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/installer/sources.pyr   WheelSource.__init__   s     	(    c                 :    U R                    SU R                   S3$ ) Name of the dist-info directory.-
.dist-infor   r   r   s    r   dist_info_dirWheelSource.dist_info_dir&   s"     ##$Adll^:>>r    c                 :    U R                    SU R                   S3$ )zName of the data directory.r#   z.datar%   r&   s    r   data_dirWheelSource.data_dir+   s"     ##$Adll^599r    c                     [         e)zGet names of all files in the dist-info directory.

Sample usage/behaviour::

    >>> wheel_source.dist_info_filenames
    ['METADATA', 'WHEEL']
NotImplementedErrorr&   s    r   dist_info_filenamesWheelSource.dist_info_filenames0   s
     "!r    filenamec                     [         e)zGet contents, from ``filename`` in the dist-info directory.

Sample usage/behaviour::

    >>> wheel_source.read_dist_info("METADATA")
    ...

:param filename: name of the file
r-   )r   r1   s     r   read_dist_infoWheelSource.read_dist_info;   s
     "!r    c                     [         e)zValidate ``RECORD`` of the wheel.

This method should be called before :py:func:`install <installer.install>`
if validation is required.
r-   r&   s    r   validate_recordWheelSource.validate_recordG   s
     "!r    c                     [         e)af  Sequential access to all contents of the wheel (including dist-info files).

This method should return an iterable. Each value from the iterable must be a
tuple containing 3 elements:

- record: 3-value tuple, to pass to
  :py:meth:`RecordEntry.from_elements <installer.records.RecordEntry.from_elements>`.
- stream: An :py:class:`io.BufferedReader` object, providing the contents of the
  file at the location provided by the first element (path).
- is_executable: A boolean, representing whether the item has an executable bit.

All paths must be relative to the root of the wheel.

Sample usage/behaviour::

    >>> iterable = wheel_source.get_contents()
    >>> next(iterable)
    (('pkg/__init__.py', '', '0'), <...>, False)

This method may be called multiple times. Each iterable returned must
provide the same content upon reading from a specific file's stream.
r-   r&   s    r   get_contentsWheelSource.get_contentsO   s
    . "!r    r%   )r   N)__name__
__module____qualname____firstlineno____doc__
ValueErrorr   r   r
   	Exception__annotations__strr   propertyr'   r*   r   r/   r3   r6   r   WheelContentElementr9   __static_attributes____classcell__r   s   @r   r   r      s    
 3=htI/<S 3 4  ? ? : : "T#Y " "
"s 
"s 
"""h':; " "r    c                   L   ^  \ rS rSrSrS\\   SS4U 4S jjrS\4S jrSr	U =r
$ )	_WheelFileValidationErrori   z*Raised when a wheel file fails validation.issuesr   Nc                 B   > [         TU ]  [        U5      5        Xl        g N)r   r   reprrL   )r   rL   r   s     r   r   "_WheelFileValidationError.__init__l   s    f&r    c                 $    SU R                   < S3$ )Nz WheelFileValidationError(issues=)rL   r&   s    r   __repr__"_WheelFileValidationError.__repr__p   s    1$++BBr    rS   )r;   r<   r=   r>   r?   r   rC   r   rT   rF   rG   rH   s   @r   rJ   rJ   i   s1    4tCy T C# C Cr    rJ   c                   T   ^  \ rS rSrSrS\S\\   S\SS4U 4S jjrS\4S	 jrS
r	U =r
$ )_WheelFileBadDistInfot   z8Raised when a wheel file has issues around `.dist-info`.reasonr1   	dist_infor   Nc                H   > [         TU ]  U5        Xl        X l        X0l        g rN   )r   r   rY   r1   rZ   )r   rY   r1   rZ   r   s       r   r   _WheelFileBadDistInfo.__init__w   s      "r    c                 X    U R                    SU R                  < SU R                  < S3$ )Nz (filename=z, dist_info=rR   rY   r1   rZ   r&   s    r   __str___WheelFileBadDistInfo.__str__}   s,    {{m;t}}&7|DNNCUUVW	
r    )rZ   r1   rY   )r;   r<   r=   r>   r?   rC   r   r   r_   rF   rG   rH   s   @r   rW   rW   t   s=    B## ## #3 #SW #
 
 
r    rW   c                      ^  \ rS rSrSr\rS\R                  SS4U 4S jjr	\
\SSS\S    4S	 j5       5       r\S\4S
 j5       r\S\\   4S j5       rS\S\4S jrSS.S\SS4S jjrS\\   4S jrSrU =r$ )r      zImplements `WheelSource`, for an existing file from the filesystem.

Example usage::

    >>> with WheelFile.open("sampleproject-2.0.0-py3-none-any.whl") as source:
    ...     installer.install(source, destination)
fr   Nc                    > Xl         UR                  (       d   e[        R                  R	                  UR                  5      n[        U5      n[        TU ]  UR                  UR                  S9  SU l
        g)zpInitialize a WheelFile object.

:param f: An open zipfile, which will stay open as long as this object is used.
)r   r   N)_zipfiler1   ospathbasenamer   r   r   r   r   _dist_info_dir)r   rc   rh   parsed_namer   s       r   r   WheelFile.__init__   sf    
 zzz77##AJJ/*84''$11 	 	
 .2r    rg   zos.PathLike[str]c              #      #    [         R                  " U5       nU " U5      v   SSS5        g! , (       d  f       g= f7f)z%Create a wheelfile from a given path.N)zipfileZipFile)clsrg   rc   s      r   openWheelFile.open   s)      __T"aa&L #""s   >-	>
;>c           
      ^   U R                   b  U R                   $ U R                  R                  5        Vs1 s H  oR                  SS5      S   iM     nnU Vs/ s H  o3R	                  S5      (       d  M  UPM     nn Uu  nUR                  SS	5      S   n[        U5      n[        U R                  5      nXx:w  a  [        S
U R                  R                  US9eXPl         U$ s  snf s  snf ! [
         a3    [        SU R                  R                  [        [        U5      5      S9Sef = f)r"   N/   r   r$   z6Wheel doesn't contain exactly one .dist-info directoryr^   r#      z7Wheel .dist-info directory doesn't match wheel filename)ri   re   namelistsplitendswithr@   rW   r1   rC   sortedrsplitr   r   )	r   rg   top_level_directoriesname
dist_infosr'   di_dnamenorm_di_dnamenorm_file_dnames	            r   r'   WheelFile.dist_info_dir   s<    *&&& /3mm.D.D.F!
.FdJJsAq!.F 	 !
 3
2TmmL6QD2 	 
	)] !''Q/2)(3+D,=,=>+'P//'  ,;!

  	'O//fZ01 		s   C%C*7C* C/ /=D,c                     U R                   nU R                  R                  5        Vs/ s H<  nUSS S:w  d  M  U[        R                  " X!/5      :X  d  M+  U[        U5      S-   S PM>     sn$ s  snf )z2Get names of all files in the dist-info directory.Nrs   rt   )r'   re   rv   	posixpathcommonprefixlen)r   baser|   s      r   r/   WheelFile.dist_info_filenames   s~     !! ..0
0BCyC " y--tl;; "DTQ!0
 	
 
s   A/A/A/r1   c                     [         R                  " U R                  U5      nU R                  R	                  U5      R                  S5      $ )z;Get contents, from ``filename`` in the dist-info directory.zutf-8)r   joinr'   re   readdecode)r   r1   rg   s      r   r3   WheelFile.read_dist_info   s8    ~~d00(;}}!!$'..w77r    T)validate_contentsr   c                    U R                  S5      R                  5       n[        U5       Vs0 s H  o3S   U_M
     nn/ nU R
                  R                  5        GHB  nUR                  SS S:X  a  M  UR                  UR                  S5      nU R                  [        R                  " U R                  UR                  /5      :X  a]  UR                  R                  S5      S   S;   a;  Ub6  UR                  S	U R
                  R                   S
UR                   S35        M  Uc9  UR                  S	U R
                  R                   SUR                   S35        GM  [        R                  " U6 nUR                  U R                   S3:X  aF  UR                   c  UR"                  b)  UR                  S	U R
                  R                   S35        GM~  UR                   b  UR"                  c6  UR                  S	U R
                  R                   SUR                   S35        U(       d  GM  U R
                  R%                  U5      n	UR'                  U	5      (       a  GM  UR                  S	U R
                  R                   SUR                   S35        GME     U(       a  [	        U5      egs  snf ! [         a-  n[	        SU R
                  R                   SU< 3/5      UeSnAff = f)al  Validate ``RECORD`` of the wheel.

This method should be called before :py:func:`install <installer.install>`
if validation is required.

File names will always be validated against ``RECORD``.

If ``validate_contents`` is true, sizes and hashes of files
will also be validated against ``RECORD``.

:param validate_contents: Whether to validate content integrity.
RECORDr   z!Unable to retrieve `RECORD` from z: Nr   rs   )z
RECORD.p7sz
RECORD.jwszIn z, digital signature file z$ is incorrectly contained in RECORD.z, z is not mentioned in RECORDz/RECORDz/, RECORD file incorrectly contains hash / size.z, hash / size of z is not included in RECORDz didn't match RECORD)r3   
splitlinesr   rA   rJ   re   r1   infolistpopr'   r   r   rw   appendr   from_elementshash_sizer   validate)
r   r   record_linesrecordrecord_mappingexcrL   itemrecord_argsdatas
             r   r6   WheelFile.validate_record   s   	..x8CCEL0A,0O0Ofq	6!0O   MM**,D}}RS!S((,,T]]DAK!!Y%;%;##T]]3& --%%c*2.2NN*MMdmm4455Nt}}o  ^B  C "$--001DMM?B]^  ..<F}}4#5#5"6g >><<+v{{/FMMdmm4455de ||#v{{':$--0011B4==/Qkl ! }}))$/t,,MMdmm4455Ft}}oUijS -Z +F33 o  	+4T]]5K5K4LBsgVW	s'   ,J: J5J: 5J: :
K1(K,,K1c              #   h  #    U R                  S5      R                  5       n[        U5      nU Vs0 s H  o3S   U_M
     nnU R                  R	                  5        H  nUR
                  SS S:X  a  M  UR                  UR
                  UR
                  SS45      nUR                  S-	  n[        U=(       a"    [        R                  " U5      =(       a    US-  5      nU R                  R                  U5       n[        S	U5      n	X9U4v   SSS5        M     gs  snf ! , (       d  f       M  = f7f)
zSequential access to all contents of the wheel (including dist-info files).

This implementation requires that every file that is a part of the wheel
archive has a corresponding entry in RECORD. If they are not, an
:any:`AssertionError` will be raised.
r   r   r   Nrs       I   r   )r3   r   r   re   r   r1   r   external_attrboolstatS_ISREGrp   r   )
r   r   recordsr   r   r   modeis_executablestreamstream_casteds
             r   r9   WheelFile.get_contents#  s	     **84??A#L1:AB')V+'BMM**,D}}RS!S( $''r27NOF %%+D !M$,,t*<!MNM##D)V $Z 8]:: *) - C *)s)   /D2D B;D2;D D2 
D/	*D2)ri   re   )r;   r<   r=   r>   r?   rJ   r   rm   rn   r   classmethodr   r   rp   rD   rC   r'   r   r/   r3   r   r6   rE   r9   rF   rG   rH   s   @r   r   r      s     12'// 2d 2  * x/D   
 "s " "H 
T#Y 
 
8s 8s 8
 <@ G4D G4D G4R;h':; ; ;r    )!r?   rf   r   r   rm   
contextlibr   typingr   r   r   r   r   r	   r
   r   installer.exceptionsr   installer.recordsr   r   installer.utilsr   r   rC   r   rE   __all__r   r@   rJ   rW   r    r    r   <module>r      s    / 	    % R R R / < CE#sC-0(D@A  +
&R" R"jC
N C
J 
z; z;r    