o
     JAfu                     @   sN  	 d dl Zd dl mZm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gZejZejdd ZG dd deZi Zee	ZdZdZd	ZG d
d dejZed ddfed ddfddfZdd Zdd Zdd Zdd ZdZda dd Z!dd Z"dd Z#d d! Z$ee$j%Z&d"d# Z'd$d% Z(d&d' Z)d(d) Z*d*d+ Z+d,d- Z,dS ).    N)_unpack_uint16_unpack_uint32ZipImportErrorzipimporter   c                   @   s   e Zd ZdS )r   N)__name__
__module____qualname__ r
   r
    /usr/lib/python3.10/zipimport.pyr   "   s       s   PKi  c                   @   s|   e Zd Z	 dd ZdddZdddZddd	Zd
d Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd ZdS )r   c              	   C   s$  t |tsdd l}||}|std|dtr|tt}g }	 zt	|}W n# t
tfyK   t|\}}||krBtd|d|}|| Y nw |jd@ dkrYtd|dnq!zt| }W n tyr   t|}|t|< Y nw || _|| _tj|d d d  | _| jr|  jt7  _d S d S )	Nr   zarchive path is emptypathTznot a Zip filei   i   )
isinstancestrosfsdecoder   alt_path_sepreplacepath_sep_bootstrap_external
_path_statOSError
ValueError_path_splitappendst_mode_zip_directory_cacheKeyError_read_directory_filesarchive
_path_joinprefix)selfr   r   r$   stdirnamebasenamefilesr
   r
   r   __init__@   sD   


zzipimporter.__init__Nc                 C   s\   	 t dt t| |}|d ur| g fS t| |}t| |r*d | j t | gfS d g fS )Nzfzipimporter.find_loader() is deprecated and slated for removal in Python 3.12; use find_spec() instead)	_warningswarnDeprecationWarning_get_module_info_get_module_path_is_dirr"   r   )r%   fullnamer   mimodpathr
   r
   r   find_loadern   s   


zzipimporter.find_loaderc                 C   s   	 t dt | ||d S )Nzfzipimporter.find_module() is deprecated and slated for removal in Python 3.12; use find_spec() insteadr   )r+   r,   r-   r4   )r%   r1   r   r
   r
   r   find_module   s
   
zzipimporter.find_modulec                 C   sn   	 t | |}|d urtj|| |dS t| |}t| |r5| j t | }tj|d dd}|j	| |S d S )N)
is_packageT)nameloaderr6   )
r.   
_bootstrapspec_from_loaderr/   r0   r"   r   
ModuleSpecsubmodule_search_locationsr   )r%   r1   targetmodule_infor3   r   specr
   r
   r   	find_spec   s   


zzipimporter.find_specc                 C   s   	 t | |\}}}|S N_get_module_coder%   r1   code	ispackager3   r
   r
   r   get_code   s   zzipimporter.get_codec                 C   sr   	 t r	|t t}|}|| jt r|t| jt d  }z| j| }W n ty2   tdd|w t	| j|S )Nr    )
r   r   r   
startswithr"   lenr!   r   r   	_get_data)r%   pathnamekey	toc_entryr
   r
   r   get_data   s   zzipimporter.get_datac                 C   s   	 t | |\}}}|S rA   rB   rD   r
   r
   r   get_filename   s   zzipimporter.get_filenamec                 C   s   	 t | |}|d u rtd||dt| |}|r!t|d}n| d}z| j| }W n
 ty7   Y d S w t| j|	 S )Ncan't find module r7   __init__.py.py)
r.   r   r/   r   r#   r!   r   rK   r"   decode)r%   r1   r2   r   fullpathrN   r
   r
   r   
get_source   s   


zzipimporter.get_sourcec                 C   s*   	 t | |}|d u rtd||d|S )NrQ   rR   )r.   r   )r%   r1   r2   r
   r
   r   r6     s
   
zzipimporter.is_packagec           	      C   s   	 d}t |t t| |\}}}tj|}|d u s t|ts)t|}|tj|< | |_	z*|r?t
| |}t| j|}|g|_t|dsGt|_t|j|| t||j W n   tj|=  ztj| }W n tyu   td|dw td|| |S )Nzrzipimport.zipimporter.load_module() is deprecated and slated for removal in Python 3.12; use exec_module() instead__builtins__zLoaded module z not found in sys.moduleszimport {} # loaded from Zip {})r+   r,   r-   rC   sysmodulesgetr   _module_type
__loader__r/   r   r#   r"   __path__hasattrrX   _fix_up_module__dict__execr   ImportErrorr9   _verbose_message)	r%   r1   msgrE   rF   r3   modr   rV   r
   r
   r   load_module  s8   


zzipimporter.load_modulec                 C   sB   	 z
|  |s
W d S W n
 ty   Y d S w ddlm} || |S )Nr   )	ZipReader)r6   r   importlib.readersrh   )r%   r1   rh   r
   r
   r   get_resource_reader;  s   

zzipimporter.get_resource_readerc                 C   sJ   	 zt | j| _| jt| j< W d S  ty$   t| jd  i | _Y d S w rA   )r    r"   r!   r   r   popr%   r
   r
   r   invalidate_cachesJ  s   zzipimporter.invalidate_cachesc                 C   s   d| j  t | j dS )Nz<zipimporter object "z">)r"   r   r$   rl   r
   r
   r   __repr__T  s   zzipimporter.__repr__rA   )r   r   r	   r*   r4   r5   r@   rG   rO   rP   rW   r6   rg   rj   rm   rn   r
   r
   r
   r   r   .   s    
.
%

+
z__init__.pycTrS   F)z.pycTF)rT   FFc                 C   s   | j |dd  S )N.   )r$   
rpartition)r%   r1   r
   r
   r   r/   f  s   r/   c                 C   s   |t  }|| jv S rA   )r   r!   )r%   r   dirpathr
   r
   r   r0   j  s   
r0   c                 C   s8   t | |}tD ]\}}}|| }|| jv r|  S qd S rA   )r/   _zip_searchorderr!   )r%   r1   r   suffix
isbytecoderF   rV   r
   r
   r   r.   s  s   

r.   c              	   C   s  zt | }W n ty   td| | dw |A z|t d | }|t}W n ty>   td| | dw t|tkrNtd| | d|d d t	krz|dd | }W n tyr   td| | dw t
|t t d}z|| | }W n ty   td| | dw |t	}|dk rtd| | d|||t  }t|tkrtd| | d|t| | }t|d	d
 }t|d
d }	||k rtd| | d||	k rtd| | d||8 }||	 }
|
dk r	td| | di }d}z|| W n ty%   td| | dw 	 |d}t|dk r7td|d d dkrBnt|dkrMtdt|dd }t|dd	 }t|d	d }t|dd
 }t|d
d }t|dd }t|dd }t|dd }t|dd }t|dd }t|dd }|| | }||	krtd| | d||
7 }z||}W n ty   td| | dw t||krtd| | dzt||| || krtd| | dW n ty   td| | dw |d@ r| }nz|d}W n ty4   |dt}Y nw |d t}t| |}||||||||f}|||< |d!7 }q'W d    n	1 s`w   Y  td"||  |S )#Nzcan't open Zip file: r   rp   can't read Zip file:    r   znot a Zip file: zcorrupt Zip file:          zbad central directory size: zbad central directory offset: z&bad central directory size or offset: T.   EOF read where not expecteds   PK   
                   "   *   zbad local header offset: i   asciilatin1/r   z!zipimport: found {} names in {!r})_io	open_coder   r   seekEND_CENTRAL_DIR_SIZEtellreadrJ   STRING_END_ARCHIVEmaxMAX_COMMENT_LENrfindr   EOFErrorr   rU   UnicodeDecodeError	translatecp437_tabler   r   r   r#   r9   rd   )r"   fpheader_positionbuffer	file_sizemax_comment_startdataposheader_sizeheader_offset
arc_offsetr)   countflagscompresstimedatecrc	data_size	name_size
extra_sizecomment_sizefile_offsetr7   r   tr
   r
   r   r      s   










mr    u   	
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñÑªº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ c                  C   sj   t rtd tdda zzddlm}  W n ty&   td tdw W da nda w td | S )Nzzipimport: zlib UNAVAILABLE)can't decompress data; zlib not availableTr   
decompressFzzipimport: zlib available)_importing_zlibr9   rd   r   zlibr   	Exceptionr   r
   r
   r   _get_decompress_func0  s   


r   c              	   C   sx  |\}}}}}}}}	|dk rt dt| }
z|
| W n ty/   t d| | dw |
d}t|dkr?td|d d dkrPt d	| | dt|d
d }t|dd }d| | }||7 }z|
| W n ty   t d| | dw |
|}t||krtdW d    n1 sw   Y  |dkr|S zt	 }W n t
y   t dw ||dS )Nr   znegative data sizerv   r   r   r|   rw   s   PKzbad local file header:    r   zzipimport: can't read datar   i)r   r   r   r   r   r   rJ   r   r   r   r   )r"   rN   datapathr   r   r   r   r   r   r   r   r   r   r   r   raw_datar   r
   r
   r   rK   E  sH   



rK   c                 C   s   t | | dkS )Nr   )abs)t1t2r
   r
   r   	_eq_mtimes  s   r   c                 C   s   ||d}t |||}|d@ dk}|r?|d@ dk}tjdkr>|s&tjdkr>t| |}	|	d ur>tt j|	}
t ||
|| n(t| |\}}|rgt	t
|dd |r]t
|dd	 |krgtd
| d S t|d	d  }t|ts}td|d|S )N)r7   r   r   r   rp   neveralwaysr}   rx   ry   zbytecode is stale for zcompiled module z is not a code object)r   _classify_pyc_impcheck_hash_based_pycs_get_pyc_sourcesource_hash_RAW_MAGIC_NUMBER_validate_hash_pyc_get_mtime_and_size_of_sourcer   r   r9   rd   marshalloadsr   
_code_type	TypeError)r%   rL   rV   r1   r   exc_detailsr   
hash_basedcheck_sourcesource_bytesr   source_mtimesource_sizerE   r
   r
   r   _unmarshal_code{  sD   



r   c                 C   s   |  dd} |  dd} | S )Ns   
   
   )r   )sourcer
   r
   r   _normalize_line_endings  s   r   c                 C   s   t |}t|| dddS )Nrb   T)dont_inherit)r   compile)rL   r   r
   r
   r   _compile_source  s   r   c                 C   sD   t | d? d | d? d@ | d@ |d? |d? d@ |d@ d d	d	d	f	S )
N	   i              ?   rp   r   )r   mktime)dr   r
   r
   r   _parse_dostime  s   



r   c              
   C   sZ   z|d d }| j | }|d }|d }|d }t|||fW S  tttfy,   Y dS w )Nr   r         )r   r   )r!   r   r   
IndexErrorr   )r%   r   rN   r   r   uncompressed_sizer
   r
   r   r     s   
r   c                 C   s<   |d d }z| j | }W n
 ty   Y d S w t| j|S )Nr   )r!   r   rK   r"   )r%   r   rN   r
   r
   r   r     s   r   c                 C   s  t | |}d }tD ]f\}}}|| }tjd| jt|dd z| j| }W n	 ty-   Y q	w |d }	t| j|}
d }|r[z
t	| |	|||
}W n t
yZ } z|}W Y d }~n
d }~ww t|	|
}|d u req	|d }	|||	f  S |r~d| }t||d|td||d)Nztrying {}{}{}rp   )	verbosityr   zmodule load failed: rR   rQ   )r/   rs   r9   rd   r"   r   r!   r   rK   r   rc   r   r   )r%   r1   r   import_errorrt   ru   rF   rV   rN   r3   r   rE   excre   r
   r
   r   rC     s:   


rC   )-_frozen_importlib_externalr   r   r   _frozen_importlibr9   r   r   r   rY   r   r+   __all__r   path_separatorsr   rc   r   r   typer\   r   r   r   _LoaderBasicsr   rs   r/   r0   r.   r    r   r   r   rK   r   r   __code__r   r   r   r   r   r   rC   r
   r
   r
   r   <module>   sZ      2		~.
(