Your IP : 3.146.206.87


Current Path : /lib64/python3.8/__pycache__/
Upload File :
Current File : //lib64/python3.8/__pycache__/zipimport.cpython-38.pyc

U

e5d-x�@sRdZddlZddlmZmZddlZddlZddlZddl	Z	ddl
Z
ddlZddgZej
Z
ejdd�ZGdd�de�ZiZee
�ZdZd	Zd
ZGdd�d�Ze
dd
d
fe
ddd
fddfZdd�Zdd�Zdd�Zdd�ZdZdadd�Z dd�Z!dd �Z"d!d"�Z#ee#j$�Z%d#d$�Z&d%d&�Z'd'd(�Z(d)d*�Z)d+d,�Z*d-d.�Z+Gd/d0�d0�Z,dS)1aPzipimport provides support for importing Python modules from Zip archives.

This module exports three objects:
- zipimporter: a class; its constructor takes a path to a Zip archive.
- ZipImportError: exception raised by zipimporter objects. It's a
  subclass of ImportError, so it can be caught as ImportError, too.
- _zip_directory_cache: a dict, mapping archive paths to zip directory
  info dicts, as used in zipimporter._files.

It is usually not needed to use the zipimport module explicitly; it is
used by the builtin import mechanism for sys.path items that are paths
to Zip archives.
�N)�_unpack_uint16�_unpack_uint32�ZipImportError�zipimporter�c@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�!/usr/lib64/python3.8/zipimport.pyr!s�sPKi��c@sleZdZdZdd�Zddd�Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)ra�zipimporter(archivepath) -> zipimporter object

    Create a new zipimporter instance. 'archivepath' must be a path to
    a zipfile, or to a specific path inside a zipfile. For example, it can be
    '/tmp/myimport.zip', or '/tmp/myimport.zip/mydirectory', if mydirectory is a
    valid directory inside the archive.

    'ZipImportError is raised if 'archivepath' doesn't point to a valid Zip
    archive.

    The 'archive' attribute of zipimporter objects contains the name of the
    zipfile targeted.
    c	Cs$t|t�sddl}|�|�}|s,td|d��tr<|�tt�}g}zt�	|�}WnHt
tfk
r�t�|�\}}||kr�td|d��|}|�
|�Yq@X|jd@dkr�td|d��q�q@zt|}Wn$tk
r�t|�}|t|<YnX||_||_tj|ddd��|_|j�r |jt7_dS)Nrzarchive path is empty��pathznot 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)�selfrrr$�st�dirname�basename�filesr
r
r�__init__?s:

zzipimporter.__init__NcCsNt||�}|dk	r|gfSt||�}t||�rFd|j�t�|��gfSdgfS)a�find_loader(fullname, path=None) -> self, str or None.

        Search for a module specified by 'fullname'. 'fullname' must be the
        fully qualified (dotted) module name. It returns the zipimporter
        instance itself if the module was found, a string containing the
        full path name if it's possibly a portion of a namespace package,
        or None otherwise. The optional 'path' argument is ignored -- it's
        there for compatibility with the importer protocol.
        N)�_get_module_info�_get_module_path�_is_dirr"r)r%�fullnamer�mi�modpathr
r
r�find_loaderms



zzipimporter.find_loadercCs|�||�dS)a�find_module(fullname, path=None) -> self or None.

        Search for a module specified by 'fullname'. 'fullname' must be the
        fully qualified (dotted) module name. It returns the zipimporter
        instance itself if the module was found, or None if it wasn't.
        The optional 'path' argument is ignored -- it's there for compatibility
        with the importer protocol.
        r)r1)r%r.rr
r
r�find_module�s	zzipimporter.find_modulecCst||�\}}}|S)z�get_code(fullname) -> code object.

        Return the code object for the specified module. Raise ZipImportError
        if the module couldn't be found.
        ��_get_module_code�r%r.�code�	ispackager0r
r
r�get_code�szzipimporter.get_codecCsvtr|�tt�}|}|�|jt�r:|t|jt�d�}z|j|}Wn tk
rhtdd|��YnXt	|j|�S)z�get_data(pathname) -> string with file data.

        Return the data associated with 'pathname'. Raise OSError if
        the file wasn't found.
        Nr�)
rrr�
startswithr"�lenr!rr�	_get_data)r%�pathname�key�	toc_entryr
r
r�get_data�szzipimporter.get_datacCst||�\}}}|S)zjget_filename(fullname) -> filename string.

        Return the filename for the specified module.
        r3r5r
r
r�get_filename�szzipimporter.get_filenamecCs�t||�}|dkr$td|��|d��t||�}|r@t�|d�}n
|�d�}z|j|}Wntk
rnYdSXt|j|��	�S)z�get_source(fullname) -> source string.

        Return the source code for the specified module. Raise ZipImportError
        if the module couldn't be found, return None if the archive does
        contain the module, but has no source for it.
        N�can't find module ��name�__init__.py�.py)
r+rr,rr#r!rr<r"�decode)r%r.r/r�fullpathr?r
r
r�
get_source�s


zzipimporter.get_sourcecCs(t||�}|dkr$td|��|d��|S)z�is_package(fullname) -> bool.

        Return True if the module specified by fullname is a package.
        Raise ZipImportError if the module couldn't be found.
        NrBrC)r+r)r%r.r/r
r
r�
is_package�s
zzipimporter.is_packagecCs�t||�\}}}tj�|�}|dks.t|t�s@t|�}|tj|<||_zT|rlt||�}t�	|j
|�}|g|_t|d�s|t
|_
t�|j||�t||j�Wntj|=�YnXztj|}Wn$tk
r�td|�d���YnXt�d||�|S)z�load_module(fullname) -> module.

        Load the module specified by 'fullname'. 'fullname' must be the
        fully qualified (dotted) module name. It returns the imported
        module, or raises ZipImportError if it wasn't found.
        N�__builtins__zLoaded module z not found in sys.moduleszimport {} # loaded from Zip {})r4�sys�modules�getr�_module_type�
__loader__r,rr#r"�__path__�hasattrrK�_fix_up_module�__dict__�execr�ImportError�
_bootstrap�_verbose_message)r%r.r6r7r0�modrrHr
r
r�load_module�s0


zzipimporter.load_modulecCsXz|�|�sWdSWntk
r*YdSXtjsNddlm}|�t�dt_t||�S)z�Return the ResourceReader for a package in a zip file.

        If 'fullname' is a package within the zip file, return the
        'ResourceReader' object for the package.  Otherwise return None.
        Nr)�ResourceReaderT)rJr�_ZipImportResourceReader�_registered�
importlib.abcr[�register)r%r.r[r
r
r�get_resource_readers


zzipimporter.get_resource_readercCsd|j�t�|j�d�S)Nz<zipimporter object "z">)r"rr$)r%r
r
r�__repr__"szzipimporter.__repr__)N)N)rrr	�__doc__r*r1r2r8r@rArIrJrZr`rar
r
r
rr-s.
 


&z__init__.pycTrEF)z.pycTF)rFFFcCs|j|�d�dS)N�.�)r$�
rpartition)r%r.r
r
rr,4sr,cCs|t}||jkS�N)rr!)r%r�dirpathr
r
rr-8sr-cCs8t||�}tD]$\}}}||}||jkr|SqdSrf)r,�_zip_searchorderr!)r%r.r�suffix�
isbytecoder7rHr
r
rr+As


r+c	Cs�zt�|�}Wn&tk
r4td|��|d��YnX|���z$|�td�|��}|�t�}Wn&tk
r�td|��|d��YnXt|�tkr�td|��|d��|dd�t	k�r�z|�dd�|��}Wn&tk
r�td|��|d��YnXt
|ttd�}z|�|�|��}Wn(tk
�rJtd|��|d��YnX|�t	�}|dk�rrtd|��|d��|||t�}t|�tk�r�td|��|d��|t|�|}t
|d	d
��}t
|d
d��}	||k�r�td|��|d��||	k�r
td
|��|d��||8}||	}
|
dk�r6td|��|d��i}d}z|�|�Wn(tk
�rttd|��|d��YnX|�d�}t|�dk�r�td��|dd�dk�r��q�t|�dk�r�td��t|dd��}
t|dd	��}t|d	d��}t|dd
��}t
|d
d��}t
|dd��}t
|dd��}t|dd��}t|dd��}t|dd��}t
|dd��}|||}||	k�r�td|��|d��||
7}z|�|�}Wn(tk
�r�td|��|d��YnXt|�|k�r�td|��|d��z2t|�||��||k�r*td|��|d��Wn(tk
�rTtd|��|d��YnX|
d@�rj|��}n6z|�d�}Wn&tk
�r�|�d��t�}YnX|�dt�}t�||�}||||||||f}|||<|d 7}�qvW5QRXt�d!||�|S)"Nzcan't open Zip file: r
rd�can't read Zip file: �rznot a Zip file: zcorrupt Zip file: ���zbad central directory size: zbad central directory offset: z&bad central directory size or offset: �.�EOF read where not expectedsPK��
����� �"�*zbad local header offset: i�ascii�latin1�/rz!zipimport: found {} names in {!r})�_io�	open_coderr�seek�END_CENTRAL_DIR_SIZE�tell�readr;�STRING_END_ARCHIVE�max�MAX_COMMENT_LEN�rfindr�EOFErrorrrG�UnicodeDecodeError�	translate�cp437_tablerrrr#rWrX)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_offsetrDr�tr
r
rr `s�
���

�


�
�






r u�	

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ cCsltrt�d�td��daz<zddlm}Wn&tk
rRt�d�td��YnXW5daXt�d�|S)Nzzipimport: zlib UNAVAILABLE�)can't decompress data; zlib not availableTFr��
decompresszzipimport: zlib available)�_importing_zlibrWrXr�zlibr��	Exceptionr�r
r
r�_get_decompress_func�s


r�c	Cs�|\}}}}}}}}	|dkr$td��t�|���}
z|
�|�Wn&tk
rftd|��|d��YnX|
�d�}t|�dkr�td��|dd�dkr�td	|��|d��t|d
d��}t|dd��}
d||
}||7}z|
�|�Wn(tk
�rtd|��|d��YnX|
�|�}t|�|k�r4td��W5QRX|dk�rL|Sz
t	�}Wnt
k
�rttd
��YnX||d�S)Nrznegative data sizerkr
rwrqrlsPKzbad local file header: �rvzzipimport: can't read datar�i�)rr~rr�rr�r;r�rr�r�)r"r?�datapathr�r�r�r�r�r�r�r�r�r�r�r��raw_datar�r
r
rr<s>



r<cCst||�dkS)Nr)�abs)�t1�t2r
r
r�	_eq_mtimeAsr�cCs<||d�}zt�|||�}Wntk
r2YdSX|d@dk}|r�|d@dk}tjdkr�|shtjdkr�t||�}	|	dk	r�t�tj|	�}
zt�||
||�Wntk
r�YdSXnTt	||�\}}|�r
t
t|dd��|�r�t|dd	��|k�r
t�
d
|���dSt�|d	d��}
t|
t��s8td|�d���|
S)
N)rDrrrrd�never�alwaysrrrmrnzbytecode is stale for zcompiled module z is not a code object)r�
_classify_pycrV�_imp�check_hash_based_pycs�_get_pyc_source�source_hash�_RAW_MAGIC_NUMBER�_validate_hash_pyc�_get_mtime_and_size_of_sourcer�rrWrX�marshal�loadsr�
_code_type�	TypeError)r%r=rHr.r��exc_detailsr��
hash_based�check_source�source_bytesr��source_mtime�source_sizer6r
r
r�_unmarshal_codeKsX�
��
��
���r�cCs|�dd�}|�dd�}|S)Ns
�
�
)r)�sourcer
r
r�_normalize_line_endings~sr�cCst|�}t||ddd�S)NrUT)�dont_inherit)r��compile)r=r�r
r
r�_compile_source�sr�cCsDt�|d?d|d?d@|d@|d?|d?d@|d@dd	d	d	f	�S)
N�	i������?rdr)r��mktime)�dr�r
r
r�_parse_dostime�s



�r�c
CstzR|dd�dkst�|dd�}|j|}|d}|d}|d}t||�|fWStttfk
rnYdSXdS)Nr��c�or���)rr)�AssertionErrorr!r�r�
IndexErrorr�)r%rr?r�r��uncompressed_sizer
r
rr��s
r�cCsV|dd�dkst�|dd�}z|j|}Wntk
rDYdSXt|j|�SdS)Nrr�)r�r!rr<r")r%rr?r
r
rr��sr�c	Cs�t||�}tD]�\}}}||}tjd|jt|dd�z|j|}Wntk
rXYqX|d}t|j|�}	|r�t	|||||	�}
n
t
||	�}
|
dkr�q|d}|
||fSqtd|��|d��dS)Nz
trying {}{}{}rd)�	verbosityrrBrC)r,rhrWrXr"rr!rr<r�r�r)r%r.rrirjr7rHr?r0r�r6r
r
rr4�s$

r4c@s<eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
S)r\z�Private class used to support ZipImport.get_resource_reader().

    This class is allowed to reference all the innards and private parts of
    the zipimporter.
    FcCs||_||_dSrf)rr.)r%rr.r
r
rr*�sz!_ZipImportResourceReader.__init__cCs\|j�dd�}|�d|��}ddlm}z||j�|��WStk
rVt|��YnXdS)Nrcr}r)�BytesIO)r.r�ior�rr@r�FileNotFoundError)r%�resource�fullname_as_pathrr�r
r
r�
open_resource�sz&_ZipImportResourceReader.open_resourcecCst�dSrf)r�)r%r�r
r
r�
resource_path�sz&_ZipImportResourceReader.resource_pathcCsH|j�dd�}|�d|��}z|j�|�Wntk
rBYdSXdS)Nrcr}FT)r.rrr@r)r%rDr�rr
r
r�is_resource�sz$_ZipImportResourceReader.is_resourcec		cs�ddlm}||j�|j��}|�|jj�}|jdks:t�|j	}t
�}|jjD]f}z||��|�}Wntk
r|YqNYnX|j	j}t
|�dkr�|jVqN||krN|�|�|VqNdS)Nr)�PathrE)�pathlibr�rrAr.�relative_tor"rDr��parent�setr!rr;�add)	r%r��
fullname_path�
relative_path�package_path�subdirs_seen�filename�relative�parent_namer
r
r�contents�s"


z!_ZipImportResourceReader.contentsN)
rrr	rbr]r*r�r�r�r�r
r
r
rr\�s	r\)-rb�_frozen_importlib_externalrrr�_frozen_importlibrWr�r~r�rLr��__all__r�path_separatorsrrVrr�typerOr�r�r�rrhr,r-r+r r�r�r�r<r�r��__code__r�r�r�r�r�r�r4r\r
r
r
r�<module>sX�		~�.
.



?>