%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.12/zipfile/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.12/zipfile/__pycache__/__init__.cpython-312.pyc

�

���f�V���dZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZ	ddlZejZ
	ddlZ	ddlZgd�ZGd�de�ZGd�de�ZexZZdZd	Zd	ZdZd
ZdZdZd
ZdZdZ dZ!dZ"dZ#dZ$ejJe#�Z&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.d
Z/dZ0dZ1dZ2ejJe1�Z3dZ4dZ5dZ6dZ7dZ8dZ9dZ:dZ;d
Z<dZ=dZ>dZ?dZ@dZAdZBd ZCd!ZDd"ZEd#ZFdZGdZHd
ZId$ZJd%ZKd&ZLd'ZMd(ZNejJeM�ZOdZPdZQdZRdZSdZTdZUdZVdZWd
ZXdZYdZZdZ[d)Z\d*Z]ejJe\�Z^d+Z_d,Z`ejJe_�ZadZbdZcdZddZedZfdZgdZhdZid
ZjdZkd-Zlej�d.�Znd/�Zod0�Zpd1�Zqd2�Zrd3�Zsd4�ZtGd5�d6eu�Zvdawd7�Zxd8�ZyGd9�d:�ZzGd;�d<�Z{idd=�dd>�dd?�dd?�dd?�dd?�dd@�ddA�d
dB�ddC�dd@�ddD�ddE�d#dF�dGdH�dIdJ�dKdL�Z|dM�Z}d^dN�Z~dO�ZGdP�dQ�Z�GdR�dS�Z�GdT�dUe�j�Z�GdV�dWe�j�Z�GdX�dY�Z�GdZ�d[e��Z�d^d\�Z�dd]l�m�Z�m�Z�y#e$rdZejZ
Y��$wxYw#e$rdZY��-wxYw#e$rdZY��6wxYw)_zP
Read and write ZIP files.

XXX references to utf-8 need further investigation.
�N)
�
BadZipFile�
BadZipfile�error�
ZIP_STORED�ZIP_DEFLATED�	ZIP_BZIP2�ZIP_LZMA�
is_zipfile�ZipInfo�ZipFile�	PyZipFile�LargeZipFile�Pathc��eZdZy)rN)�__name__�
__module__�__qualname__���'/usr/lib/python3.12/zipfile/__init__.pyrr's��rrc��eZdZdZy)rzu
    Raised when writing a zipfile, the zipfile requires ZIP64 extensions
    and those extensions are disabled.
    N)rrr�__doc__rrrrr+s��rri���������-�.�?s<4s4H2LHsPK��������	z<4s4B4HL2L5H2LsPK�
��
����� �@iz<4s2B4HL2L2HsPKz<4sLQLsPKz
<4sQ2H2L4QsPKiPK�<HHc�^�tj}d}g}dx}}|dzt|�krN||||dz�\}}|dz|z}	||vr||k7r|j|||�|	}d}|	}|dzt|�kr�N|s|S|t|�k7r|j||d�dj	|�S)NFrr$Tr)�_EXTRA_FIELD_STRUCT�unpack�len�append�join)
�extra�xidsr5�modified�buffer�start�i�xid�xlen�js
          r�_strip_extrarB�s���
 �
'�
'�F��H�
�F��M�E�A�
�a�%�3�u�:�
��5��Q��U�+�,�	��T�
��E�D�L���$�;��E�z��
�
�e�E�A�.�/��E��H�
���a�%�3�u�:�
������E�
���
�
�e�E�F�m�$��8�8�F��rc�>�	t|�ry	y#t$rYywxYw)NTF)�_EndRecData�OSError��fps r�_check_zipfilerH�s2��
��r�?������
���
�s��	�c��d}	t|d�rt|��}|St|d�5}t|�}ddd�|S#1swY|SxYw#t$rY|SwxYw)z�Quickly see if a file is a ZIP file by checking the magic number.

    The filename argument may be a file or file-like object too.
    F�readrF�rbN)�hasattrrH�openrE)�filename�resultrGs   rr
r
�sw��
�F�
��8�V�$�#�x�0�F��M�	�h��%�
,��'��+��
,��M�	
,��M���
���M�
�s2�A
�A
�A�A
�A
�A
�
A
�
	A�Ac
��	|j|tz
d�|jt�}t	|�tk7r|Stjt|�\}}}}|tk7r|S|dk7s|dkDrtd��|j|tz
tz
d�|jt�}t	|�tk7r|Stjt|�\
}}}	}
}}}
}}}|tk7r|S||t<||t<||t<|
|t <||t"<||t$<||t&<|S#t$r|cYSwxYw)zM
    Read the ZIP64 end-of-archive records and use that to update endrec
    r"rr!z3zipfiles that span multiple disks are not supported)�seek�sizeEndCentDir64LocatorrErJr6�structr5�structEndArchive64Locator�stringEndArchive64Locatorr�sizeEndCentDir64�structEndArchive64�stringEndArchive64�_ECD_SIGNATURE�_ECD_DISK_NUMBER�_ECD_DISK_START�_ECD_ENTRIES_THIS_DISK�_ECD_ENTRIES_TOTAL�	_ECD_SIZE�_ECD_OFFSET)�fpin�offset�endrec�data�sig�diskno�reloff�disks�sz�create_version�read_version�disk_num�disk_dir�dircount�	dircount2�dirsize�	diroffsets                 r�
_EndRecData64rq�s^����	�	�&�2�2�A�6��9�9�,�-�D�
�4�y�+�+��
�!'���/H�$�!O��C����
�'�'��
�
��{�e�a�i��N�O�O�	�I�I�f�.�.�1A�A�1�E��9�9�%�&�D�
�4�y�$�$��
�	�
�
�(�$�/�0�C��^�\�8�X��)�W�i�
� � ��
�!�F�>��'�F���&�F�?��%-�F�!�"�!*�F����F�9��#�F�;���M��E���
��s�D=�=E�
Ec��|jdd�|j�}	|jtd�|j	�}t|�tk(rt|ddtk(rh|dddk(r`tjt|�}t|�}|jd�|j|tz
�t|t|�St|dz
tz
d�}|j|d�|j	�}|jt�}|dk\r�|||tz}t|�tk7ryttjt|��}|t}||tz|tz|z}|j|�|j||z�t|||z|z
|�Sy#t$rYywxYw)	z�Return data from the "End of Central Directory" record, or None.

    The data is a list of the nine items in the ZIP "End of central dir"
    record followed by a tenth item, the file seek offset of this record.rr"Nr$���sri)rQ�tell�sizeEndCentDirrErJr6�stringEndArchiverSr5�structEndArchive�listr7rq�max�rfind�_ECD_COMMENT_SIZE)	r`�filesizercrb�maxCommentStartr=�recData�commentSize�comments	         rrDrDs���	�I�I�a��O��y�y�{�H�
��	�	�>�/�1�%��9�9�;�D��D�	�^�#��Q�q�	�%�%��R�S�	�[� ����/��6���F�|��	�
�
�c���
�
�h��/�0��T�N�?�F�;�;��(�g�.��?��C�O��I�I�o�q�!��9�9�;�D��J�J�'�(�E���z��u�U�>�1�2���w�<�>�)���f�m�m�$4�g�>�?���.�/���u�^�+�E�.�,@��,L�M���
�
�g���
�
�o��-�.��T�?�U�#:�X�#E�#�%�	%���W����s�F=�=	G	�G	c��|jtd��}|dk\r|d|}tjdk7r2tj|vr |j	tjd�}tj
rEtj
dk7r2tj
|vr |j	tj
d�}|S)zzTerminate the file name at the first null byte and
    ensure paths always use forward slashes as the directory separator.r�/)�find�chr�os�sep�replace�altsep)rN�	null_bytes  r�_sanitize_filenamer�Us����
�
�c�!�f�%�I��A�~��A�i�(��
�v�v��}����8�+��#�#�B�F�F�C�0��	�y�y�R�Y�Y�#�%�"�)�)�x�*?��#�#�B�I�I�s�3���Orc�T�eZdZdZdZd
d�Zd�Zdd�Zd�Zd�Z	e
dd	d
�d��Zd�Zy)rz>Class with attributes describing each file in the ZIP archive.)�
orig_filenamerN�	date_time�
compress_type�_compresslevelr�r9�
create_systemri�extract_version�reserved�	flag_bits�volume�
internal_attr�
external_attr�
header_offset�CRC�
compress_size�	file_size�	_raw_time�_end_offsetc��||_t|�}||_||_|ddkrt	d��t
|_d|_d|_d|_	tjdk(rd|_nd|_t|_t|_d|_d|_d|_d|_d|_d|_d|_d|_y)Nr�z+ZIP does not support timestamps before 1980r�win32r#)r�r�rNr��
ValueErrorrr�r�r�r9�sys�platformr��DEFAULT_VERSIONrir�r�r�r�r�r�r�r�r�)�selfrNr�s   r�__init__zZipInfo.__init__�s���%���&�h�/�� ��
�"����Q�<�$���J�K�K�(���"��������
��<�<�7�"�!"�D��"#�D��-���.�����
���������������������rc��d|jj�d|j��g}|jtk7r<|jdtj|j|j�z�|jdz	}|jdz}|r'|jdtj|�z�|r|jd|z�|j�}|r|jr|jd|jz�|r|jrJ|jtk7s|j|jk7r|jd	|jz�|jd
�dj|�S)N�<z
 filename=� compress_type=%sr-rz filemode=%rz external_attr=%#xz
 file_size=%rz compress_size=%r�>�)�	__class__rrNr�rr7�compressor_names�getr��stat�filemode�is_dirr�r�r8)r�rO�hi�lo�isdirs     r�__repr__zZipInfo.__repr__�s;��'+�~�~�'>�'>��
�
�N�O������+��M�M�-�*�.�.�t�/A�/A�/3�/A�/A�C�C�
D��
�
�2�
%��
�
�
�&�
(��
��M�M�.�4�=�=��+<�<�=�
��M�M�.��3�4����
�������M�M�/�D�N�N�:�;��$�,�,�
�
�
�:�
-�
�^�^�t�1�1�
1��M�M�-��0B�0B�B�C��
�
�c���w�w�v��rNc��|j}|ddz
dz|ddzz|dz}|ddz|d	dzz|ddzz}|jtzrdx}x}}n$|j}|j}|j
}|j}d}	|�|tkDxs	|tkD}|r>d
}
|tj|
dtj|
�d	z
||�z}d}d}t}	|jtk(rtt|	�}	n#|jt k(rtt"|	�}	t|	|j$�|_t|	|j&�|_|j)�\}}tjt*t,|j$|j.||j|||||t1|�t1|��
}
|
|z|zS)z�Return the per-file header as a bytes object.

        When the optional zip64 arg is None rather than a bool, we will
        decide based upon the file_size and compress_size, if known,
        False otherwise.
        rr�r(r!r%r"r#r*r$z<HHQQ���)r�r��_MASK_USE_DATA_DESCRIPTORr�r�r�r9�ZIP64_LIMITrS�pack�calcsize�
ZIP64_VERSIONr�rry�
BZIP2_VERSIONr	�LZMA_VERSIONr�ri�_encodeFilenameFlags�structFileHeader�stringFileHeaderr�r6)r��zip64�dt�dosdate�dostimer�r�r�r9�min_version�fmtrNr��headers              r�
FileHeaderzZipInfo.FileHeader�s����^�^���a�5�4�<�A�%��1���
�2�R��U�:���Q�%�2�+��1���
�*�b��e�q�j�9���>�>�5�5�./�/�C�/�-�)��(�(�C� �.�.�M����I��
�
�����=���+�J�}�{�/J�E���C��F�K�K��()�6�?�?�3�+?��+A�9�m�]�]�E�"�I�&�M�'�K�����*��m�[�9�K�
�
�
�8�
+��l�K�8�K�"�;��0D�0D�E���!�+�t�/B�/B�C���"�7�7�9���)����-�/?�!�1�1�4�=�=�)�!�/�/��'�3�*�I� ��]�C��J�	8��
�� �5�(�(rc���	|jjd�|jfS#t$r1|jjd�|jtzfcYSwxYw)N�ascii�utf-8)rN�encoder��UnicodeEncodeError�_MASK_UTF_FILENAME�r�s rr�zZipInfo._encodeFilenameFlags�s[��	V��=�=�'�'��0�$�.�.�@�@��!�	V��=�=�'�'��0�$�.�.�CU�2U�U�U�	V�s�&)�7A#�"A#c��|j}tj}t|�dk\�r2|d|dd�\}}|dzt|�kDrt	d||fz��|dk(r|d|dz}	|j
dvrd}|d|dd�\|_|dd}|jd	k(rd
}|d|dd�\|_|dd}|jd	k(rd}|d|dd�\|_ne|dk(r`|d|dz}	|d|dd�\}}	|dk(rC|	|k(r>|ddjd�}
|
rt|
�|_nddl}|jdd��||dzd}t|�dk\r��1yy#tj$rt	d�d
��d�wxYw#tj$r}t	d�|�d}~wt$r}t	d�|�d}~wwxYw)Nr$r2z"Corrupt extra field %04x (size=%d)r!)l����r�z	File sizez<Qrr�z
Compress sizez
Header offsetzCorrupt zip64 extra field. z not found.iupz<BLr%r�rz'Empty unicode path extra field (0x7075)r"��
stacklevelz)Corrupt unicode path extra field (0x7075)z>Corrupt unicode path extra field (0x7075): invalid utf-8 bytes)r9rSr5r6rr�r�r�r�decoder�rN�warnings�warn�UnicodeDecodeError)
r��filename_crcr9r5�tp�lnrc�field�
up_version�up_name_crc�up_unicode_namer��es
             r�_decodeExtrazZipInfo._decodeExtra�s���
�
�������%�j�A�o��E�5��!�9�-�F�B���!�t�c�%�j� � �!E��R��!P�Q�Q��V�|��Q�r�!�t�}��F��~�~�)M�M� +��*0��t�B�Q�x�*@����#�A�B�x���)�)�[�8� /��.4�T�4���8�.D�+��*�#�A�B�x���)�)�[�8� /��.4�T�4���8�.D�+��*���v���Q�r�!�t�}��n�.4�U�D��!�H�.E�+�J��!�Q��;�,�+F�*.�q�r�(�/�/�'�*B��*�,>��,O�D�M�+�$�M�M�*S�`a�M�b��"�Q�$�%�L�E�O�%�j�A�o��&�|�|�F�$�'B�(-�w�k�&;�<�AE�F�F���|�|�Y�$�%P�Q�WX�X��)�n�$�%e�f�lm�m��n�s2�*A5E�.AF�$F�G�F%�%G�1F=�=GT��strict_timestampsc��t|tj�rtj|�}tj|�}t	j
|j�}tj|j�}|dd}|s|ddkrd}n|s
|ddkDrd}|�|}tjjtjj|�d�}|dtjtjfvr+|dd}|dtjtjfvr�+|r|d	z
}|||�}|jd
zdz|_|rd|_|xjdzc_|S|j"|_|S)a_Construct an appropriate ZipInfo for a file on the filesystem.

        filename should be the path to a file or directory on the filesystem.

        arcname is the name which it will have within the archive (by default,
        this will be the same as filename, but without a drive letter and with
        leading path separators removed).
        rr&r��r�r!r!rrr�;)r�r���;r�Nr!r�rr-)�
isinstancer��PathLike�fspathr��S_ISDIR�st_mode�time�	localtime�st_mtime�path�normpath�
splitdriver�r�r�r��st_size)	�clsrN�arcnamer��str��mtimer��zinfos	         r�	from_filezZipInfo.from_file!sV���h����,��y�y��*�H�
�W�W�X�
�����R�Z�Z�(�����r�{�{�+���!�A�J�	� �Y�q�\�D�%8�-�I�"�y��|�d�':�2�I��?��G��'�'�"�"�2�7�7�#5�#5�g�#>�q�#A�B���a�j�R�V�V�R�Y�Y�/�/��a�b�k�G��a�j�R�V�V�R�Y�Y�/�/���s�N�G��G�Y�'��!�z�z�F�2�r�9�����E�O����4�'����!�j�j�E�O��rc�
�|jjd�rytjjrM|jjtjj
tjjf�Sy)z2Return True if this archive member is a directory.r�TF)rN�endswithr�r�r�r�r�s rr�zZipInfo.is_dirGsQ���=�=�!�!�#�&��
�7�7�>�>��=�=�)�)�2�7�7�;�;������*G�H�H�r)�NoNamer��N)
rrrr�	__slots__r�r�r�r�r��classmethodr�r�rrrrrhsJ��H��I�0  �J�,.)�`V�+!�Z�#�D�#��#�J
rrc�L�td�D]}|dzr	|dz	dz}�|dz}�|S)Nrr!l q[)�range)�crcrAs  r�_gen_crcrYs:��
�1�X�����7��!�8�z�)�C��A�I�C�	�
�Jrc��������d�d�d�t�"tttt	d���at��fd������fd��|D]
}�|����fd�}|S)NixV4i�gE#i�xV4�c�&��|dz	�||zdzzS)z(Compute the CRC32 primitive on one byte.r�r)�chr�crctables  �r�crc32z_ZipDecrypter.<locals>.crc32ss ����q��H�c�B�h�$�%6�7�7�7rc�\���|�����dzzdz��dzdzdz���dz	���y)Nrr�i�r!�r)�cr
�key0�key1�key2s ����r�update_keysz"_ZipDecrypter.<locals>.update_keyswsE����Q��~����t��$�
�2���y� �1�$�
�2���T�R�Z��&�rc���t�}|j}|D](}�dz}|||dzzdz	dzz}�|�||��*t|�S)zDecrypt a bytes object.r"r!rr)�	bytearrayr7�bytes)rcrOr7r
�krrs     ��r�	decrypterz _ZipDecrypter.<locals>.decrypter�sa�����������	�A��q��A�
�1��!��9��"�d�*�*�A���N��1�I�		�
�V�}�r)�	_crctablerx�maprr)	�pwd�prr
r	rrrrs	   @@@@@@r�
_ZipDecrypterrisc����D��D��D�����X�u�S�z�2�3�	��H�8�'�����A���	��rc�$�eZdZd�Zd�Zd�Zd�Zy)�LZMACompressorc��d|_yr�)�_compr�s rr�zLZMACompressor.__init__�s	����
rc�.�tjdtji�}tjtjtj
tj|�g��|_tjdddt|��|zS)N�id��filtersz<BBHr(r$)
�lzma�_encode_filter_properties�FILTER_LZMA1r�
FORMAT_RAW�_decode_filter_propertiesrrSr�r6)r��propss  r�_initzLZMACompressor._init�sq���.�.��d�6G�6G�/H�I���(�(�����*�*�4�+<�+<�e�D�C
���
��{�{�6�1�a��U��4�u�<�<rc��|j�,|j�|jj|�zS|jj|�Sr�)rr*�compress�r�rcs  rr,zLZMACompressor.compress�sA���:�:���:�:�<�$�*�*�"5�"5�d�";�;�;��z�z�"�"�4�(�(rc��|j�+|j�|jj�zS|jj�Sr�)rr*�flushr�s rr/zLZMACompressor.flush�s=���:�:���:�:�<�$�*�*�"2�"2�"4�4�4��z�z���!�!rN)rrrr�r*r,r/rrrrr�s���=�)�
"rrc��eZdZd�Zd�Zy)�LZMADecompressorc�.�d|_d|_d|_y)NrF)�_decomp�_unconsumed�eofr�s rr�zLZMADecompressor.__init__�s����������rc
�J�|j��|xj|z
c_t|j�dkrytjd|jdd�\}t|j�d|zkrytjt
jtjt
j|jdd|z�g��|_|jd|zd}|`|jj|�}|jj|_|S)Nr$rz<Hr"r")r3r4r6rSr5r$r1r'r(r&�
decompressr5)r�rc�psizerOs    rr7zLZMADecompressor.decompress�s����<�<������$���4�#�#�$��)���]�]�4��)9�)9�!�A�)>�?�F�E��4�#�#�$��E�	�1���0�0�����.�.�t�/@�/@�/3�/?�/?��!�e�)�/L�N�K��D�L��#�#�A��I�J�/�D�� ����(�(��.���<�<�#�#����
rN)rrrr�r7rrrr1r1�s���
rr1�store�shrink�reduce�implode�tokenize�deflate�	deflate64�bzip2r$�terse��lz77�a�wavpack�b�ppmdc���|tk(ry|tk(rtstd��y|tk(rt
std��y|tk(rtstd��ytd��)Nz.Compression requires the (missing) zlib modulez-Compression requires the (missing) bz2 modulez.Compression requires the (missing) lzma modulez(That compression method is not supported)	rr�zlib�RuntimeErrorr�bz2r	r$�NotImplementedError)�compressions r�_check_compressionrN�s����j� ��	��	$���@�B�
B��
�	�	!���?�A�
A��
��	 ���@�B�
B��"�"L�M�Mrc�X�|tk(rZ|�%tj|tjd�Stjtjtjd�S|t
k(r+|�t
j|�St
j�S|tk(r
t�Sy)N��)
rrI�compressobj�DEFLATED�Z_DEFAULT_COMPRESSIONrrK�
BZ2Compressorr	r)r��
compresslevels  r�_get_compressorrV�s�����$��$��#�#�M�4�=�=�#�F�F����� :� :�D�M�M�3�O�O�	�)�	#��$��$�$�]�3�3�� � �"�"�	�(�	"����rc�4�t|�|tk(ry|tk(rtjd�S|t
k(rt
j�S|tk(r
t�Stj|�}|rtd||fz��td|fz��)NrPzcompression type %d (%s)zcompression type %d)
rNrrrI�
decompressobjrrK�BZ2Decompressorr	r1r�r�rL)r��descrs  r�_get_decompressorr[�s����}�%��
�"��	�,�	&��!�!�#�&�&�	�)�	#��"�"�$�$�	�(�	"��!�!� �$�$�]�3���%�&@�M�SX�CY�&Y�Z�Z�%�&;�}�>N�&N�O�Orc�.�eZdZd�Zd�Zdd�Zdd�Zd�Zy)	�_SharedFilec�l�||_||_||_||_||_|j
|_yr�)�_file�_pos�_close�_lock�_writing�seekable)r��file�pos�close�lock�writings      rr�z_SharedFile.__init__s0����
���	������
���
��
�
��
rc��|jSr�)r`r�s rrtz_SharedFile.tells���y�y�rc�
�|j5|j�rtd��|jj	||�|jj�|_|jcddd�S#1swYyxYw)Nz}Can't reposition in the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)rbrcr�r_rQrtr`)r�ra�whences   rrQz_SharedFile.seeksi��
�Z�Z�	��}�}�� �"J�K�K�
�J�J�O�O�F�F�+��
�
���)�D�I��9�9�	�	�	�s�A"A9�9Bc�>�|j5|j�rtd��|jj	|j
�|jj
|�}|jj�|_|cddd�S#1swYyxYw)N�yCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)rbrcr�r_rQr`rJrt�r��nrcs   rrJz_SharedFile.read!sy��
�Z�Z�	��}�}�� �"J�K�K�
�J�J�O�O�D�I�I�&��:�:�?�?�1�%�D��
�
���)�D�I��	�	�	�s�A<B�Bc�f�|j�%|j}d|_|j|�yyr�)r_ra)r��fileobjs  rrgz_SharedFile.close,s-���:�:�!��j�j�G��D�J��K�K�� �"rN)r����)rrrr�rtrQrJrgrrrr]r]s��&���	�!rr]c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�	_Tellablec� �||_d|_y�Nr)rGra�r�rGs  rr�z_Tellable.__init__4s�������rc�f�|jj|�}|xj|z
c_|Sr�)rG�writera)r�rcrps   rr{z_Tellable.write8s'���G�G�M�M�$������q����rc��|jSr�)rar�s rrtz_Tellable.tell=s���{�{�rc�8�|jj�yr�)rGr/r�s rr/z_Tellable.flush@������
�
�rc�8�|jj�yr�)rGrgr�s rrgz_Tellable.closeCr~rN)rrrr�r{rtr/rgrrrrvrv3s����
��rrvc���eZdZdZdZdZdZ		dd�Zd�Zd�Z	dd�Z
dd	�Zd
�Zdd�Z
d�Zd
�Zd�Zd�Z�fd�Zd�Zej*fd�Zd�Z�xZS)�
ZipExtFilezZFile-like object for reading an archive member.
       Is returned by ZipFile.open().
    i@iic��||_||_||_|j|_|j
|_|j|_t|j�|_
d|_d|_d|_
d|_||_|j |_t%|d�r"|j&|_t+d�|_nd|_d|_	|j1�r`|j3�|_|j
|_|j|_|j,|_|j(|_d|_d|_ |rf|jBtDzr|jFdz	dz}n|j&dz	dz}|jI�}||k7rtKd	|jLz��yy#t>$rY�{wxYw)
NFrrr�TrrrzBad password for file %r)'�_fileobj�_pwd�_close_fileobjr��_compress_typer��_compress_leftr��_leftr[�
_decompressor�_eof�_readbuffer�_offset�newlines�moderN�namerLr��
_expected_crcr
�_running_crc�	_seekablerdrt�_orig_compress_start�_orig_compress_size�_orig_file_size�_orig_start_crc�	_orig_crc�AttributeError�
_decrypterr�r�r��_init_decrypterrJr�)r�rrr��zipinfor�
close_fileobj�
check_byte�hs        rr�zZipExtFile.__init__Us�����
���	�+���%�3�3���%�3�3����&�&��
�.�t�/B�/B�C�����	���������
���	��$�$��	��7�E�"�!(���D�� %�c�
�D��!%�D�����		����!�,3�L�L�N��)�+2�+@�+@��(�'.�'8�'8��$�'+�'8�'8��$�!%�!3�!3���!%�������� � �#<�<�%�/�/�1�4��<�
�&�k�k�R�/�4�7�
��$�$�&�A��J��"�#=��@U�@U�#U�V�V����	�	��	�s�A0F4�4	G�?Gc��t|j�|_|jj	d�}|xj
dzc_|j|�dS)Nrr*)rr�r�r�rJr�)r�r�s  rr�zZipExtFile._init_decrypter�sM��'��	�	�2������#�#�B�'�����r�!�����v�&�r�*�*rc���d|jj�d|jj��g}|js{|j	d|j
�d|j���|jtk7rN|j	dtj|j|j�z�n|j	d�|j	d�dj|�S)	Nr��.z name=z mode=r��	 [closed]r�r�)r�rr�closedr7r�r�r�rr�r�r8�r�rOs  rr�zZipExtFile.__repr__�s���"�n�n�7�7�"�n�n�9�9�;�<���{�{��M�M��	�	�4�9�9�E�F��"�"�j�0��
�
�1�.�2�2�4�3F�3F�37�3F�3F�H�H�I�
�M�M�+�&��
�
�c���w�w�v��rc���|dkrP|jjd|j�dz}|dkDr"|j|j|}||_|Stjj||�S)zrRead and return a line from the stream.

        If limit is specified, at most limit bytes will be read.
        r�
r!)r�r�r��io�BufferedIOBase�readline)r��limitr>�lines    rr�zZipExtFile.readline�sn���1�9�� � �%�%�e�T�\�\�:�Q�>�A��1�u��'�'����a�8�� ������ � �)�)�$��6�6rc�x�|t|j�|jz
kDrp|j|�}t|�|jkDr)||j|jdz|_d|_n|xjt|�zc_|j|j|jdzS)z6Returns buffered bytes without advancing the position.Nri)r6r�r�rJ)r�rp�chunks   r�peekzZipExtFile.peek�s����s�4�#�#�$�t�|�|�3�3��I�I�a�L�E��5�z�D�L�L�(�#(�4�+;�+;�D�L�L�M�+J�#J�� � �������E�
�*��������d�l�l�S�.@�A�Arc�2�|jrtd��y)N�I/O operation on closed file.T)r�r�r�s r�readablezZipExtFile.readable�s���;�;��<�=�=�rc���|jrtd��|�|dkr`|j|jd}d|_d|_|js+||j|j�z
}|js�+|S||jz}|t|j�kr"|j|j|}||_|S|t|j�z
}|j|jd}d|_d|_|dkDri|js]|j|�}|t|�kr||_||_||d|z
}	|S||z
}|t|�z}|dkDr
|js�]|S)z�Read and return up to n bytes.
        If the argument is omitted, None, or negative, data is read and returned until EOF is reached.
        zread from closed file.Nrr)r�r�r�r�r��_read1�MAX_Nr6)r�rp�buf�endrcs     rrJzZipExtFile.read�sk���;�;��5�6�6��9��A���"�"�4�<�<�=�1�C�"�D���D�L��i�i��t�{�{�4�:�:�.�.���i�i��J��$�,�,�����T�%�%�&�&��"�"�4�<�<��4�C��D�L��J��#�d�&�&�'�'�����t�|�|�}�-���������!�e�D�I�I��;�;�q�>�D��3�t�9�}�#'�� � ����t�B�Q�x�����
�
�4�K�C�
��T��N�A��!�e�D�I�I��
rc���|j�yt||j�|_|jr2|j|jk7rt	d|j
z��yy)NzBad CRC-32 for file %r)r�r
r�r�rr�)r��newdatas  r�_update_crczZipExtFile._update_crc�s]�����%��!�'�4�+<�+<�=����9�9��*�*�d�.@�.@�@��5��	�	�A�B�B�A�9rc��|�|dkrg|j|jd}d|_d|_|js2|j|j�}|r||z
}	|S|js�2|S||jz}|t|j�kr"|j|j|}||_|S|t|j�z
}|j|jd}d|_d|_|dkDr[|jsO|j|�}|t|�kr||_||_||d|z
}	|S|r||z
}	|S|js�O|S)z7Read up to n bytes with at most one read() system call.Nrr)r�r�r�r�r�r6)r�rpr�rcr�s     r�read1zZipExtFile.read1�sb��
�9��A���"�"�4�<�<�=�1�C�"�D���D�L��i�i��{�{�4�:�:�.����4�K�C���J��i�i�
�J��$�,�,�����T�%�%�&�&��"�"�4�<�<��4�C��D�L��J��#�d�&�&�'�'�����t�|�|�}�-���������q�5��i�i��{�{�1�~���s�4�y�=�'+�D�$�#$�D�L��4���8�O�C���
���4�K�C���
��i�i��
rc���|js|dkry|jtk(rE|jj}|t|�kDr2||j
|t|�z
�z
}n|j
|�}|jtk(r|jdk|_n�|jtk(r�t||j�}|jj||�}|jjxs(|jdkxr|jj|_|jre||jj�z
}nG|jj|�}|jjxs|jdk|_|d|j}|xjt|�zc_|jdkrd|_|j|�|S)NrrT)r�r�rr��unconsumed_tailr6�_read2rr�ry�
MIN_READ_SIZEr7r5r/r�r�ros   rr�zZipExtFile._read1s����9�9��Q������,�.��%�%�5�5�D��3�t�9�}�����A��D�	�M�2�2���;�;�q�>�D����*�,��+�+�q�0�D�I�
�
 �
 �L�
0��A�t�)�)�*�A��%�%�0�0��q�9�D��+�+�/�/�@��,�,��1�@�!�/�/�?�?�?�
�I��y�y���*�*�0�0�2�2���%�%�0�0��6�D��*�*�.�.�J�$�2E�2E��2J�D�I��K�T�Z�Z� ���
�
�c�$�i��
��:�:��?��D�I�������rc�:�|jdkryt||j�}t||j�}|jj|�}|xjt
|�zc_|st�|j�|j|�}|S)Nrr)	r�ryr��minr�rJr6�EOFErrorr�ros   rr�zZipExtFile._read2:s������!�#����4�%�%�&����4�&�&�'���}�}�!�!�!�$�����s�4�y�(����N��?�?�&��?�?�4�(�D��rc���	|jr|jj�t�|�	�y#t�|�	�wxYwr�)r�r�rg�super)r�r�s �rrgzZipExtFile.closeJs4���	��"�"��
�
�#�#�%��G�M�O��E�G�M�O�s	�&8�Ac�H�|jrtd��|jS�Nr�)r�r�r�r�s rrdzZipExtFile.seekableQs���;�;��<�=�=��~�~�rc�L�|jrtd��|jstjd��|j�}|tjk(r|}nG|tjk(r||z}n.|tjk(r|j|z}ntd��||jkDr|j}|dkrd}||z
}||jz}|dk\r#|t|j�kr||_d}�n[|jtk(r�|j ��|dkDr|d|_|t|j�|jz
z}|j$j'|tj�|xj(|zc_d}d|_
d|_n�|dkr�|j$j'|j*�|j,|_|j0|_|j2|_|j|_d|_
d|_t7|j�|_d|_|}|j �|j=�|dkDr2t?|j@|�}|jC|�||z}|dkDr�2|j�S)Nzseek on closed file.�!underlying stream is not seekablezCwhence must be os.SEEK_SET (0), os.SEEK_CUR (1), or os.SEEK_END (2)rrF)"r�r�r�r��UnsupportedOperationrtr��SEEK_SET�SEEK_CUR�SEEK_ENDr�r�r6r�r�rr�r�r�rQr�r�r�r�r�r�r�r[r�r�r�r��
MAX_SEEK_READrJ)r�rarl�curr_pos�new_pos�read_offset�buff_offset�read_lens        rrQzZipExtFile.seekVsR���;�;��3�4�4��~�~��)�)�*M�N�N��9�9�;���R�[�[� ��G�
�r�{�{�
"���'�G�
�r�{�{�
"��*�*�V�3�G��C�D�
D��T�)�)�)��*�*�G��Q�;��G���(��!�D�L�L�0���!���c�$�2B�2B�.C� C�&�D�L��K�
�
 �
 �J�
.�4�?�?�3J�{�]^��!%�D���3�t�/�/�0�4�<�<�?�?�K��M�M���{�B�K�K�8��J�J�+�%�J��K�"�D���D�L�
�1�_��M�M���t�8�8�9� $� 4� 4�D��!%���D��"&�":�":�D���-�-�D�J�"�D���D�L�!2�4�3F�3F�!G�D���D�I�!�K����*��$�$�&��A�o��4�-�-�{�;�H��I�I�h���8�#�K��A�o�
�y�y�{�rc���|jrtd��|jstjd��|j
|jz
t|j�z
|jz}|S)Nztell on closed file.r�)
r�r�r�r�r�r�r�r6r�r�)r��fileposs  rrtzZipExtFile.tell�s`���;�;��3�4�4��~�~��)�)�*M�N�N��&�&����3�c�$�:J�:J�6K�K�d�l�l�Z���r)NFrs�r!)rrrrr�r�r�r�r�r�r�r�r�rJr�r�r�r�rgrdr�r�rQrt�
__classcell__�r�s@rr�r�Gs����

�E��M��M�37�$�1W�h	+��7� B��
!�FC�#�J"�H� ��
#%�+�+�=�~rr�c�@��eZdZd�Zed��Zd�Zd�Z�fd�Z�xZ	S)�
_ZipWriteFilec��||_||_||_t|j|j
�|_d|_d|_d|_	yrx)
�_zinfo�_zip64�_zipfilerVr�r��_compressor�
_file_size�_compress_size�_crc)r��zfr�r�s    rr�z_ZipWriteFile.__init__�sL����������
�*�5�+>�+>�+0�+?�+?�A�����������	rc�.�|jjSr�)r�rGr�s rr�z_ZipWriteFile._fileobj�s���}�}���rc��y)NTrr�s r�writablez_ZipWriteFile.writable�s��rc���|jrtd��t|ttf�rt|�}nt
|�}|j}|xj|z
c_t||j�|_
|jr9|jj|�}|xjt|�z
c_
|jj|�|Sr�)r�r�r�rrr6�
memoryview�nbytesr�r
r�r�r,r�r�r{)r�rcr�s   rr{z_ZipWriteFile.write�s����;�;��<�=�=��d�U�I�.�/���Y�F��d�#�D��[�[�F����6�!���$��	�	�*��	�����#�#�,�,�T�2�D����3�t�9�,���
�
���D�!��
rc	���|jry	t�|�	�|jro|jj	�}|xj
t
|�z
c_|jj|�|j
|j_
n|j|j_
|j|j_
|j|j_|js<|jt kDrt#d��|j
t kDrt#d��|jj$t&zr�|jrdnd}|jjt)j*|t,|jj|jj|jj��|jj/�|j0_n�|jj/�|j0_|jj5|jj6�|jj|jj9|j��|jj5|j0j2�|j0j:j=|j�|j|j0j>|jj@<d|j0_!y#d|j0_!wxYw)Nz*File size too large, try using force_zip64z0Compressed size too large, try using force_zip64z<LLQQz<LLLLF)"r�r�rgr�r/r�r6r�r{r�r�r�r�r�r�r�r�rJr�r�rSr��
_DD_SIGNATURErtr��	start_dirrQr�r��filelistr7�
NameToInforNrc)r�r�r�r�s   �rrgz_ZipWriteFile.close�s+����;�;��(	+��G�M�O�����&�&�,�,�.���#�#�s�3�x�/�#��
�
�#�#�C�(�,0�,?�,?����)�,0�O�O����)�"�i�i�D�K�K�O�$(�O�O�D�K�K�!��;�;��?�?�[�0�&�'S�T�T��&�&��4�&�'Y�Z�Z��{�{�$�$�'@�@�!%���g�'���
�
�#�#�F�K�K��]�D�K�K�O�O��K�K�-�-�t�{�{�/D�/D�%F�G�*.�-�-�*<�*<�*>��
�
�'�+/�-�-�*<�*<�*>��
�
�'��
�
�"�"�4�;�;�#<�#<�=��
�
�#�#�D�K�K�$:�$:�4�;�;�$G�H��
�
�"�"�4�=�=�#:�#:�;�
�M�M�"�"�)�)�$�+�+�6�=A�[�[�D�M�M�$�$�T�[�[�%9�%9�:�%*�D�M�M�"��U�D�M�M�"�s�LL8�8M)
rrrr��propertyr�r�r{rgr�r�s@rr�r��s0����� �� ���&++�++rr�c�"�eZdZdZdZdZdeddfddd�d�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d$d
�Zd�Zd�Zd�Zed��Zej(d��Zd$d�Zd%dd�d�Zd&d�Zd'd�Zd(d�Zed��Zd�Zd�Z		d(d�Z	d'd�Zd)d�Z d �Z!d!�Z"d"�Z#d#�Z$y)*rai Class with methods to open, read, write, close, list zip files.

    z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=True,
                compresslevel=None)

    file: Either the path to the file, or a file-like object.
          If it is a path, the file will be opened and closed by ZipFile.
    mode: The mode can be either read 'r', write 'w', exclusive create 'x',
          or append 'a'.
    compression: ZIP_STORED (no compression), ZIP_DEFLATED (requires zlib),
                 ZIP_BZIP2 (requires bz2) or ZIP_LZMA (requires lzma).
    allowZip64: if True ZipFile will create files with ZIP64 extensions when
                needed, otherwise it will raise an exception when this would
                be necessary.
    compresslevel: None (default for the given compression type) or an integer
                   specifying the level to pass to the compressor.
                   When using ZIP_STORED or ZIP_LZMA this keyword has no effect.
                   When using ZIP_DEFLATED integers 0 through 9 are accepted.
                   When using ZIP_BZIP2 integers 1 through 9 are accepted.

    N�rT)r��metadata_encodingc���|dvrtd��t|�||_d|_d|_i|_g|_||_||_||_	d|_
d|_||_||_
|jr|dk7rtd��t|tj �rtj"|�}t|t$�r;d|_||_d	d
ddd
d
dd�}||}			t+j,||	�|_n d|_||_t3|dd�|_d|_t7j8�|_d|_d|_	|dk(r|jA�y|dvrNd|_	|j.jC�|_"	|j.jG|jD�y|dk(r7	|jA�|j.jG|jD�ytd��#t0$r|	|vr||	}	Y��1�wxYw#tHt0f$r
d|_YywxYw#tHt0f$r+tK|j.�|_d|_"d|_YywxYw#tL$rE|j.jGdd�d|_|j.jC�|_"YywxYw#|j.}
d|_|jO|
��xYw)z]Open the ZIP file with mode read 'r', write 'w', exclusive create 'x',
        or append 'a'.)r��w�x�az+ZipFile requires mode 'r', 'w', 'x', or 'a'FrNrr�z5metadata_encoding is only supported for reading filesrK�w+b�x+b�r+b�wb�xb)r�r�r�r�r�r�r�Tr!r�)r�r�r�r"z"Mode must be 'r', 'w', 'x', or 'a')(r�rN�_allowZip64�
_didModify�debugr�r�rMrUr�r�_comment�_strict_timestampsr�r�r�r�r��str�_filePassedrNr�rMrGrE�getattr�_fileRefCnt�	threading�RLockrbr�rc�_RealGetContentsrtr�rQr�rvr�_fpclose)r�rer�rM�
allowZip64rUr�r��modeDictr�rGs           rr�zZipFile.__init__s����+�+��J�K�K��;�'�%��������
������
�&���*�����	������
�"3���!2����!�!�d�c�k��G�I�
I��d�B�K�K�(��9�9�T�?�D��d�C� � �D�� �D�M�"��U�%�$�T�$�@�H���~�H��� �g�g�d�H�5�D�G�� �D���D�G�#�D�&�$�7�D�M�����_�_�&��
������
�'	��s�{��%�%�'���#�#'���/�%)�W�W�\�\�^�D�N�/������T�^�^�4����4��)�)�+��G�G�L�L����0�!�!E�F�F��c���8�+�#+�H�#5�� ��	��@+�G�4�/�).���/��'��0�+�'����0�D�G�%&�D�N�%*�D�N�+�� "�4��G�G�L�L��A�&�'+�D�O�%)�W�W�\�\�^�D�N�4��	����B��D�G��M�M�"���s��)H�K�*K�6H9�%H�<K�5I6�8K�H�H�H6�3K�5H6�6K�97I3�0K�2I3�3K�6AK�K�K�K�'K.c��|Sr�rr�s r�	__enter__zZipFile.__enter__ls���rc�$�|j�yr��rg)r��type�value�	tracebacks    r�__exit__zZipFile.__exit__os���
�
�rc���d|jj�d|jj��g}|j�t|jr|jd|jz�n*|j�|jd|jz�|jd|jz�n|jd�|jd�dj|�S)	Nr�r�z file=%rz filename=%rz mode=%rr�r�r�)	r�rrrGrr7rNr�r8r�s  rr�zZipFile.__repr__rs���"�n�n�7�7�"�n�n�9�9�;�<���7�7������
�
�j�4�7�7�2�3����*��
�
�n�t�}�}�<�=��M�M�*�t�y�y�0�1��M�M�+�&��
�
�c���w�w�v��rc��|j}	t|�}|std��|jdkDrt|�|t}|t}|t|_	|t|z
|z
}|ttk(r|ttzz}|jdkDr||z}td|||�||z|_|jdkrtd��|j!|jd�|j#|�}t%j&|�}d}||k�r�|j#t(�}	t+|	�t(k7rtd��t-j.t0|	�}	|	t2t4k7rtd��|jdkDrt|	�|j#|	t6�}
t9|
�}|	t:}|t<zr|
j?d	�}
n|
j?|j@xsd
�}
tC|
�}
|j#|	tD�|
_#|j#|	tH�|
_%|	tL|
_'|	dd\|
_(|
_)|
_*|
_+|
_,|
_-}}|
_.|
_/|
_0|
jTtbkDrted|
jTd
zz��|	dd\|
_3|
_4|
_5||
_6|dz	dz|dz	dz|dz|dz	|dz	dz|dzdzf|
_7|
jq|�|
jN|z|
_'|jrju|
�|
|jv|
jx<|t(z|	t6z|	tDz|	tHz}|jdkDrtd|�||kr���|j}t{|jrd�d��D]}||_>|jN}�y#t$rtd��wxYw)z/Read in the table of contents for the ZIP file.zFile is not a zip filer!r"zgiven, inferred, offsetrz Bad offset for central directoryzTruncated central directoryz&Bad magic number for central directoryr��cp437rzzip file version %.1fr)r,r/r(r�r%r�r*r �totalc��|jSr�)r�)r�s r�<lambda>z*ZipFile._RealGetContents.<locals>.<lambda>�s��e�.A�.A�rT)�key�reverseN)?rGrDrErr��printr^r_�_ECD_COMMENTr��
_ECD_LOCATIONrYrXrVrRr�rQrJr��BytesIO�sizeCentralDirr6rSr5�structCentralDir�
_CD_SIGNATURE�stringCentralDir�_CD_FILENAME_LENGTHr
�
_CD_FLAG_BITSr�r�r�r�_CD_EXTRA_FIELD_LENGTHr9�_CD_COMMENT_LENGTHr��_CD_LOCAL_HEADER_OFFSETr�rir�r�r�r�r�r�r�r��MAX_EXTRACT_VERSIONrLr�r�r�r�r�r�r�r7r�rN�sortedr�)r�rGrb�size_cd�	offset_cd�concat�inferredrcr�centdirrN�orig_filename_crc�flagsr��t�d�
end_offsetr�s                  rrzZipFile._RealGetContents�s���
�W�W��	7� ��_�F���5�6�6��:�:��>��&�M���#���;�'�	��|�,��
��
�&��0�9�<���.�!�%7�7��'�*A�A�B�F��:�:��>��	�)�H��+�Y��&�I�"�V�+����>�>�A���?�@�@�
�������"��w�w�w���
�Z�Z��
�����g�o��g�g�n�-�G��7�|�~�-� �!>�?�?��m�m�$4�g�>�G��}�%�)9�9� �!I�J�J��z�z�A�~��g���w�w�w�':�;�<�H� %�h����M�*�E��)�)�#�?�?�7�3��$�?�?�4�+A�+A�+L�W�M����!�A��g�g�g�&<�=�>�A�G�����(:� ;�<�A�I�%�&=�>�A�O�5<�A�b�M�
2�Q�
�q���0A�1�:�
�[�!�/�1�a�
�U�A�O�Q�[�� � �#6�6�)�*A�+,�+<�+<�r�+A�+C�D�D�9@��B��6�A�H�a�o�q���A�K���T�4�K�!�Q�$���Q�t�V��r�E�A�q�D�$�;��4��1��?�A�K�
�N�N�,�-��o�o��6�A�O��M�M� � ��#�*+�D�O�O�A�J�J�'��^�+�g�6I�.J�J��5�6�7��1�2�3�E��z�z�A�~��g�u�%�[�g�o�^�^�^�
��D�M�M� A�$(�*�	-�E�!+�E���,�,�J�		-��W�	7��5�6�6�	7�s�O/�/Pc�T�|jD�cgc]}|j��c}Scc}w)z+Return a list of file names in the archive.)r�rNr-s  r�namelistzZipFile.namelist�s��*.�-�-�8�$��
�
�8�8��8s�%c��|jS)zJReturn a list of class ZipInfo instances for files in the
        archive.)r�r�s r�infolistzZipFile.infolist�����}�}�rc��tddz|��|jD];}d|jddz}td|j||jfz|���=y)z+Print a table of contents for the zip file.z%-46s %19s %12s)z	File NamezModified    �Size�rez%d-%02d-%02d %02d:%02d:%02dNr&z
%-46s %s %12d)rr�r�rNr�)r�rer��dates    r�printdirzZipFile.printdir�s_��
��"G�G��	��]�]�	�E�0�5�?�?�2�A�3F�F�D��/�U�^�^�T�5�?�?�$K�K��
�	rc��d}|jD]L}	|j|jd�5}|j|�r	|j|�r�ddd��Ny#1swY�xYw#t$r|jcYcSwxYw)z�Read all the files and check the CRC.

        Return None if all files could be read successfully, or the name
        of the offending file otherwise.ir�N)r�rMrNrJr)r��
chunk_sizer��fs    r�testzipzZipFile.testzip�s���
�
��]�]�	&�E�
&��Y�Y�u�~�~�s�3��q��&�&��,���&�&��,���		&�����
&��~�~�%�
&�s(�A+�$A�A+�A(	�$A+�+B�Bc�\�|jj|�}|�td|z��|S)z,Return the instance of ZipInfo given 'name'.z(There is no item named %r in the archive)r�r��KeyError)r�r��infos   r�getinfozZipFile.getinfo�s9�����"�"�4�(���<��:�T�A�C�
C��rc��|r1t|t�s!tdt|�jz��|r||_yd|_y)z)Set default password for encrypted files.�pwd: expected bytes, got %sN)r�r�	TypeErrorrrr)r�rs  r�setpasswordzZipFile.setpasswords:���z�#�u�-��9�D��I�<N�<N�N�O�O���D�H��D�Hrc��|jS)z.The comment text associated with the ZIP file.)r�r�s rr�zZipFile.comment
r7rc���t|t�s!tdt|�jz��t|�tkDr'ddl}|jdtzd��|dt}||_	d|_
y)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesr"r�T)r�rrGrrr6�ZIP_MAX_COMMENTr�r�r�r�)r�r�r�s   rr�zZipFile.commentsp���'�5�)��=��W�
�@V�@V�V�W�W��w�<�/�)���M�M�O�+�,�89�
�
;��.��/�G���
���rc�t�|j|d|�5}|j�cddd�S#1swYyxYw)zUReturn file bytes for name. 'pwd' is the password to decrypt
        encrypted files.r�N)rMrJ)r�r�rrGs    rrJzZipFile.reads4���Y�Y�t�S�#�
&�	�"��7�7�9�	�	�	�s�.�7F��force_zip64c�l��|dvrtd��|r|dk(rtd���jstd��t|t�r|}nD|dk(r.t|�}�j|_�j|_n�j|�}|dk(r�j||��S�jrtd���xjdz
c_t�j|j�j�j�fd	��}	|j!t"�}t%|�t"k7rt'd
��t)j*t,|�}|t.t0k7rt'd��|j!|t2�}|t4r|j7|t4d��|j8t:zrt=d
��|j8t>zrt=d��|t@tBzr|jEd�}	n|jE�jFxsd�}	|	|jHk7rt'd|jH�d|�d���|jJ�C|jM�|jNz|jJkDrt'd|jH�d���|j8tPz}
|
rQ|s�jR}|r1t|tT�s!tWdtY|�jZz��|st]d|z��d}t_||||d�S#|ja��xYw)auReturn file-like object for 'name'.

        name is a string for the file name within the ZIP file, or a ZipInfo
        object.

        mode should be 'r' to read a file already in the ZIP file, or 'w' to
        write to a file newly added to the archive.

        pwd is the password to decrypt files (only used for reading).

        When writing, if the file size is not known in advance but may exceed
        2 GiB, pass force_zip64 to use the ZIP64 format, which can handle large
        files.  If the size is known in advance, it is best to pass a ZipInfo
        instance for name, with zinfo.file_size set.
        >r�r�zopen() requires mode "r" or "w"r�z'pwd is only supported for reading filesz2Attempt to use ZIP archive that was already closedrMrnr!c����jSr�)rcr�s�rrzZipFile.open.<locals>.<lambda>Qs���$�-�-�rzTruncated file headerz Bad magic number for file header)rlz$compressed patched data (flag bit 5)zstrong encryption (flag bit 6)r�rzFile name in directory z and header z differ.NzOverlapped entries: z (possible zip bomb)rFz6File %r is encrypted, password required for extractionT)1r�rGr�rrMr�rUr�rD�_open_to_writercrr]r�rrbrJ�sizeFileHeaderr6rrSr5r��
_FH_SIGNATUREr��_FH_FILENAME_LENGTH�_FH_EXTRA_FIELD_LENGTHrQr��_MASK_COMPRESSED_PATCHrL�_MASK_STRONG_ENCRYPTION�_FH_GENERAL_PURPOSE_FLAG_BITSr�r�r�r�r�rtr��_MASK_ENCRYPTEDrrrGrrrJr�rg)r�r�r�rrNr��zef_file�fheader�fname�	fname_str�is_encrypteds`          rrMzZipFile.open"s��� �z�!��>�?�?��D�C�K��F�G�G��w�w��D�F�
F��d�G�$��E�
�S�[��D�M�E�"&�"2�"2�E��#'�#5�#5�E� ��L�L��&�E��3�;��&�&�u�+�&�F�F��=�=��F�G�
G�
	
���A����t�w�w��(;�(;�#�}�}�d�j�j�:O�Q��4	��m�m�N�3�G��7�|�~�-� �!8�9�9��m�m�$4�g�>�G��}�%�)9�9� �!C�D�D��M�M�'�*=�">�?�E��-�.��
�
�g�&<�=�a�
�H����!7�7�)�*P�Q�Q����!8�8�)�*J�K�K��4�5�8J�J�!�L�L��1�	�!�L�L��)?�)?�)J�7�K�	��E�/�/�/� ��*�*�E�3�4�4��!�!�-��
�
��%�"5�"5�5��8I�8I�I� �#7��8K�8K�7N�Nb�!c�d�d�!�?�?�_�<�L����(�(�C��z�#�u�5�#�$A�D��I�DV�DV�$V�W�W��&�(A�CG�(H�I�I����h��e�S�$�?�?��	��N�N���s
�HL � L3c��|r|jstd��|jrtd��d|_d|_d|_|jtk(r|xj
tzc_|js|xj
tzc_|jsd|_|xs|jdztkD}|js
|rtd��|jr%|jj!|j"�|jj%�|_|j)|�d|_|jj-|j/|��d|_t1|||�S)NzHforce_zip64 is True, but allowZip64 was False when opening the ZIP file.zzCan't write to the ZIP file while there is another write handle open on it. Close the first handle before opening another.r��g�������?z'Filesize would require ZIP64 extensionsT)r�r�rcr�r�r�r�r	�_MASK_COMPRESS_OPTION_1r�r�r�r�r�rrGrQr�rtr��_writecheckr�r{r�r�)r�r�rNr�s    rrQzZipFile._open_to_write�s=���t�/�/�� ��
��=�=��N�O�
O�
 �����	�������(�*��O�O�6�6�O��~�~��O�O�8�8�O��"�"�"-�E���E����$� 6�� D�����E��H�I�I��>�>��G�G�L�L����(�"�g�g�l�l�n��������������
�
�e�&�&�u�-�.���
��T�5�%�0�0rc��|�tj�}ntj|�}|j|||�S)alExtract a member from the archive to the current working directory,
           using its full name. Its file information is extracted as accurately
           as possible. `member' may be a filename or a ZipInfo object. You can
           specify a different directory using `path'. You can specify the
           password to decrypt the file using 'pwd'.
        )r��getcwdr��_extract_member)r��memberr�rs    r�extractzZipFile.extract�s6���<��9�9�;�D��9�9�T�?�D��#�#�F�D�#�6�6rc��|�|j�}|�tj�}ntj|�}|D]}|j	|||��y)a?Extract all members from the archive to the current working
           directory. `path' specifies a different directory to extract to.
           `members' is optional and must be a subset of the list returned
           by namelist(). You can specify the password to decrypt all files
           using 'pwd'.
        N)r4r�rdr�re)r�r��membersrr�s     r�
extractallzZipFile.extractall�sR���?��m�m�o�G��<��9�9�;�D��9�9�T�?�D��	5�G�� � ��$��4�	5rc��|j}|s+d}tj|dt|�z�}||_|j	|�}d�|j|�D�}|j
d�|D��}|S)z;Replace bad characters and remove trailing dots from parts.z:<>|"?*�_c3�>K�|]}|jd����y�w)z .N)�rstrip��.0r�s  r�	<genexpr>z1ZipFile._sanitize_windows_name.<locals>.<genexpr>�s����B�a�1�8�8�D�>�B�s�c3�&K�|]	}|s�|���y�wr�rros  rrqz1ZipFile._sanitize_windows_name.<locals>.<genexpr>�s����7�Q�Q�q�7�s��)�!_windows_illegal_name_trans_tabler�	maketransr6�	translate�splitr8)r�r��pathsep�table�illegals     r�_sanitize_windows_namezZipFile._sanitize_windows_name�st���5�5����G��M�M�'�3��W��+=�>�E�49�C�1��#�#�E�*��B�7�=�=��+A�B���,�,�7�'�7�7���rc���t|t�s|j|�}|jj	dt
jj�}t
jjrB|j	t
jjt
jj�}t
jj|�d}dt
jjt
jjf�t
jjj�fd�|jt
jj�D��}t
jjdk(r*|j|t
jj�}|s|j�st!d��t
jj||�}t
jj#|�}t
jj%|�}|r4t
jj'|�stj(|�|j�r6t
jj+|�stj,|�|S|j/||��5}t/|d�5}t1j2||�d	d	d	�d	d	d	�|S#1swY�xYw#1swY|SxYw)
zbExtract the ZipInfo object 'member' to a physical
           file on the path targetpath.
        r�r!r�c3�*�K�|]
}|�vr|���y�wr�r)rpr��invalid_path_partss  �rrqz*ZipFile._extract_member.<locals>.<genexpr>�s#�����#C��&'�/A�&A�$%�#C�s��\zEmpty filename.)rr�N)r�rrDrNr�r�r�r�r�r��curdir�pardirr8rvrzr�r�r��dirname�exists�makedirsr��mkdirrM�shutil�copyfileobj)	r�rf�
targetpathrr��	upperdirs�source�targetr}s	        @rrezZipFile._extract_member�s����&�'�*��\�\�&�)�F��/�/�)�)�#�r�w�w�{�{�;��
�7�7�>�>��o�o�b�g�g�n�n�b�g�g�k�k�B�G��'�'�$�$�W�-�a�0�� �"�'�'�.�.�"�'�'�.�.�A���'�'�+�+�"�"�#C�g�m�m�B�G�G�K�K�.H�#C�C��
�7�7�;�;�$���1�1�'�2�7�7�;�;�G�G��v�}�}���.�/�/��W�W�\�\�*�g�6�
��W�W�%�%�j�1�
��G�G�O�O�J�/�	��R�W�W�^�^�I�6��K�K�	�"��=�=�?��7�7�=�=��,�����$���
�Y�Y�v�3�Y�
'�	/�6�
�*�d�
#�	/�'-����v�v�.�	/�	/���		/�	/��	/���s$�4
K6�K*�K6�*K3	�/K6�6Lc���|j|jvr$ddl}|jd|jzd��|jdvrtd��|jstd��t|j�|js]d}t|j�tk\rd	}n+|jtkDrd
}n|jtkDrd}|rt!|dz��yy)
z6Check for errors before writing a file to the archive.rNzDuplicate name: %rr#r��r�r�r�z&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closed�Files count�FilesizezZipfile size� would require ZIP64 extensions)rNr�r�r�r�r�rGrNr�r�r6r��ZIP_FILECOUNT_LIMITr�r�r�r)r�r�r��requires_zip64s    rrbzZipFile._writechecks����>�>�T�_�_�,���M�M�.����?�A�M�N��9�9�O�+��E�F�F��w�w��F�H�
H��5�.�.�/����!�N��4�=�=�!�%8�8�!.�����;�.�!+���$�$�{�2�!/���"�>�#D�$E�F�F�� rc�.�|jstd��|jrtd��tj	|||j
��}|j
�r d|_d|_|j|�y|�||_
n|j|_
|�||_n|j|_t|d�5}|j|d�5}tj ||d�ddd�ddd�y#1swY�xYw#1swYyxYw)	zLPut the bytes from filename into the archive under the name
        arcname.�7Attempt to write to ZIP archive that was already closedz>Can't write to ZIP archive while an open writing handle existsr�rNrKr�i )rGr�rcrr�r�r�r�r�r�r�rMr�rUrMr�r�)r�rNr�r�rUr��src�dests        rr{z
ZipFile.write%s���w�w��I�K�
K��=�=��P��
��!�!�(�G�48�4K�4K�"�M���<�<�>�"#�E���E�I��J�J�u���(�&3��#�&*�&6�&6��#��(�'4��$�'+�'9�'9��$��h��%�
6��d�i�i��s�.C�
6�t��"�"�3��f�5�
6�
6�
6�
6��
6�
6�s$�D�C?�.D�?D	�D�Dc���t|t�r|jd�}t|t�s�t|t	j
t	j��dd��}|j|_|j|_	|jjd�rd|_|xjdzc_n
d|_n|}|jstd	��|jrtd
��|�||_|�||_	t!|�|_|j$5|j'|d��5}|j)|�ddd�ddd�y#1swY�xYw#1swYyxYw)
aWrite a file into the archive.  The contents is 'data', which
        may be either a 'str' or a 'bytes' instance; if it is a 'str',
        it is encoded as UTF-8 first.
        'zinfo_or_arcname' is either a ZipInfo instance or
        the name of the file in the archive.r�Nr&)rNr�r�i�Ar-r`r�z?Can't write to ZIP archive while an open writing handle exists.r�)r�)r�rr�rr�r�rMr�rUr�rNr�r�rGr�rcr6r�rbrMr{)r��zinfo_or_arcnamercr�rUr�r�s       r�writestrzZipFile.writestrFsO���d�C� ��;�;�w�'�D��*�G�4��%5�&*�n�n�T�Y�Y�[�&A�"�1�&E�G�E�"&�"2�"2�E��#'�#5�#5�E� ��~�~�&�&�s�+�&3��#��#�#�t�+�#�&1��#�$�E��w�w��I�K�
K��=�=��Q��
��$�"/�E���$�#0�E� ��d�)���
�Z�Z�	!����5�s��+�
!�t��
�
�4� �
!�	!�	!�
!�
!��	!�	!�s$�'E*�;E�
E*�E'	�#E*�*E3c��t|t�r|}|j�s�td��t|t�r^|}|jd�s|dz
}t|�}d|_d|_d|zdzdz|_d|_	|xjdzc_ntd��|j5|jr%|jj|j�|jj!�|_|j$t&k(r|xj(t*zc_|j-|�d|_|j0j3|�||j4|j6<|jj9|j;d	��|jj!�|_d
d
d
�y
#1swYy
xYw)z+Creates a directory inside the zip archive.z/The given ZipInfo does not describe a directoryr�ri@rr-zExpected type str or ZipInfoTFN)r�rr�r�rr�r�r�r�r�rGrbr�rGrQr�rtr�r�r	r�rarbr�r�r7r�rNr{r�)r��zinfo_or_directory_namer�r��directory_names     rr�z
ZipFile.mkdirosm���-�w�7�+�E��<�<�>� �!R�S�S�
�/��
5�4�N�!�*�*�3�/��#�%���N�+�E�"#�E���E�I�$+�d�N�f�#<��"C�E���E�O����4�'���:�;�;�
�Z�Z�	,��~�~������T�^�^�,�"&�'�'�,�,�.�E���"�"�h�.����#:�:�����U�#�"�D�O��M�M� � ��'�.3�D�O�O�E�N�N�+��G�G�M�M�%�*�*�5�1�2�!�W�W�\�\�^�D�N�	,�	,�	,�s
�3DG�Gc�$�|j�y)z2Call the "close()" method in case the user forgot.Nr
r�s r�__del__zZipFile.__del__�s���
�
�rc���|j�y|jrtd��	|jdvrb|jrV|j
5|jr%|jj|j�|j�ddd�|j}d|_|j|�y#1swY�.xYw#|j}d|_|j|�wxYw)zOClose the file, and for mode 'w', 'x' and 'a' write the ending
        records.NzvCan't close the ZIP file while there is an open writing handle on it. Close the writing handle before closing the zip.r�)rGrcr�r�r�rbr�rQr��_write_end_recordrrys  rrgz
ZipFile.close�s����7�7�?���=�=��P�Q�
Q�		��y�y�O�+�����Z�Z�-��~�~������T�^�^�4��*�*�,�-�
���B��D�G��M�M�"��-�-��
���B��D�G��M�M�"��s$�&C�AB;�C�;C�C�&C-c�	�|jD�]�}|j}|ddz
dz|ddzz|dz}|ddz|d	dzz|ddzz}g}|jtkDs|jtkDr;|j|j�|j|j�d
}d
}n|j}|j}|jtkDr|j|j�d
}n|j}|j}	d}
|rHt|	d�}	tjdd
t|�zzddt|�zg|���|	z}	t}
|jtk(rtt |
�}
n#|jt"k(rtt$|
�}
t|
|j&�}t|
|j(�}|j+�\}
}tjt,t.||j0||j2||j|||j4||t|
�t|	�t|j6�d|j8|j:|�}|j<j?|�|j<j?|
�|j<j?|	�|j<j?|j6����|j<jA�}t|j�}||jBz
}|jB}d}|tDkDrd}n|tkDrd}n|tkDrd}|r�|jFstI|dz��tjtJtLddddd||||�}|j<j?|�tjtNtPd|d�}|j<j?|�tS|d�}tS|d
�}tS|d
�}tjtTtVdd||||t|jX��	}|j<j?|�|j<j?|jX�|jZdk(r|j<j]�|j<j_�y)Nrr�r(r!r%r"r#r*r$r�r�r2�Qrr�zCentral directory offsetzCentral directory sizer��,rrr�)0r�r�r�r�r�r7r�r9rBrSr�r6r�r�rryr�r	r�r�rir�rr!r�r�r�r�r�r�rGr{rtr�r�r�rrWrXrTrUr�rwrvr�r��truncater/)r�r�r�r�r�r9r�r�r��
extra_datar�r�rirNr�r-�pos2�centDirCount�centDirSize�
centDirOffsetr��zip64endrec�zip64locrecrbs                        rr�zZipFile._write_end_record�s
���]�]�3	)�E����B��!�u�t�|��)�B�q�E�Q�J�6��A��>�G���e�r�k�B�q�E�Q�J�.�"�Q�%�1�*�=�G��E�����,��%�%��3����U�_�_�-����U�0�0�1�&�	� *�
�!�O�O�	� %� 3� 3�
��"�"�[�0����U�0�0�1� *�
� %� 3� 3�
����J��K��)�*�d�;�
�#�[�[��C��E�
�N�*��q��U��|�-�&+�-�/9�:�
�,���"�"�i�/�!�-��=���$�$��0�!�,��<��!�+�u�/D�/D�E�O� ��e�.B�.B�C�N�"'�"<�"<�">��H�i��k�k�"2�"2�N�"'�"5�"5�����"+�U�-@�-@�'�7�"'�)�)�]�I�"%�h�-��Z��#�e�m�m�BT�"#�U�%8�%8�%�:M�:M�"/�1�G�
�G�G�M�M�'�"��G�G�M�M�(�#��G�G�M�M�*�%��G�G�M�M�%�-�-�(�g3	)�j�w�w�|�|�~���4�=�=�)���T�^�^�+�����
����-�-�*�N�
�[�
(�7�N�
�;�
&�5�N���#�#�"�>�#D�$E�F�F� �+�+�"�$6��B��A�q�,���]�,�K�
�G�G�M�M�+�&� �+�+�)�)�1�d�A�7�K�
�G�G�M�M�+�&��|�V�4�L��k�:�6�K��
�z�:�M����-�/?���<��(�-��T�]�]�9K�M��	
���
�
�f�����
�
�d�m�m�$��9�9����G�G�������
�
�rc��|jdkDsJ�|xjdzc_|js|js|j�yyy)Nrr!)rrrgrys  rrzZipFile._fpclose
sI�����!�#�#�#����A�������(8�(8��H�H�J�)9�rr�)r�N)F)NN)NNN)i�)%rrrrrGrsrr�rrr�rr4r6r<r@rDrHr�r��setterrJrMrQrgrjr�rzrerbr{r�r�r�rgr�rrrrrr�s
���,
�B�(,�%�"%�:�$�#�^�:>�RV�^�@���T-�l9��
�&� ������
�^�^�
��
��d�E�d�L(1�T7�5�$����+�ZF�.'+�04�6�D48�'!�R!,�F��,\�|rrc�.�eZdZdZdeddfd�Zd	d�Zd�Zy)
r
zDClass to create ZIP archives with Python library files and packages.r�Trtc�F�tj|||||��||_y)N)r�rMr)rr��	_optimize)r�rer�rMr�optimizes      rr�zPyZipFile.__init__s'������t�$�K�$.�	�	0�!��rNc���tj|�}|rI||�sA|jr4tjj	|�rdnd}t|�d|�d��ytjj
|�\}}tjj	|��r�tjj|d�}tjj|��r�|r|�d|��}n|}|jrtd|d	|�|j|d
d|�\}}	|jrtd|	�|j||	�ttj|��}
|
jd�|
D�]$}tjj||�}tjj|�\}
}tjj	|�rStjjtjj|d��s��|j|||�
���|dk(s��|r#||�s|jrtd|z���|j|d
d|�\}}	|jrtd|	�|j||	���'y|jrtd|�ttj|��D]�}tjj||�}tjj|�\}
}|dk(s�K|r#||�s|jrtd|z��p|j|d
d|�\}}	|jrtd|	�|j||	���y|dddk7rt!d��|j|d
d|�\}}	|jrtd|	�|j||	�y)a�Add all files from "pathname" to the ZIP archive.

        If pathname is a package directory, search the directory and
        all package subdirectories recursively for all *.py and enter
        the modules into the archive.  If pathname is a plain
        directory, listdir *.py and enter all modules.  Else, pathname
        must be a Python *.py file and the module will be put into the
        archive.  Added modules are always module.pyc.
        This method will compile the module.py into module.pyc if
        necessary.
        If filterfunc(pathname) is given, it is called with every argument.
        When it is False, the file or directory is skipped.
        r�re� z skipped by filterfuncNz__init__.pyr�zAdding package in�asr����Adding)�
filterfunc�.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"zAdding file)r�r�r�r�r�rrvr8�isfile�
_get_codenamer{r(�listdir�remove�splitext�writepyrJ)r��pathname�basenamer��label�dirr��initnamer\r��dirlistrNr��root�exts               rr�zPyZipFile.writepys"���9�9�X�&���j��2��z�z�"$�'�'�-�-��"9��v���u�h�G�H���G�G�M�M�(�+�	��T�
�7�7�=�=��"��w�w�|�|�H�m�<�H��w�w�~�~�h�'��*2�D�9�H�#�H��:�:��-�x��x�H�!%�!3�!3�H�Q�r�N�H�!M���w��:�:��(�G�,��
�
�5�'�*� ����H�!5�6�����}�-� '�3�H��7�7�<�<��(�;�D� "��� 0� 0�� :�I�D�#��w�w�}�}�T�*��7�7�>�>�"�'�'�,�,�t�]�*K�L� �L�L��x�4>�)�@����%�j��.>�#�z�z� %�&E��&L� M�$�)-�);�);�D��2�J�<D�*F���w��:�:�!�(�G�4��
�
�5�'�2�#3�(�:�:��7��B� &�r�z�z�(�';� <�3�H��7�7�<�<��(�;�D� "��� 0� 0�� :�I�D�#��e�|�%�j��.>�#�z�z� %�&E��&L� M�$�)-�);�);�D��2�J�<D�*F���w��:�:�!�(�G�4��
�
�5�'�2�3����}��%�"�D�F�F�!�/�/���2���I�N�E�7��z�z��m�W�-��J�J�u�g�&rc����d
�fd�	}|dz}|dz}tjj|d��}tjj|d��}tjj|d��}�jdk(�r�tj
j
|�rEt	j|�jt	j|�jk\r|x}	}
�nTtj
j
|�rEt	j|�jt	j|�jk\r|}
|}	�n�tj
j
|�rEt	j|�jt	j|�jk\r|}
|}	�n�tj
j
|�rEt	j|�jt	j|�jk\r|}
|}	�n(||�rEtjjd	k(r|}
n"tjjdk(r|}
n|}
|}	n�|x}
}	n։jd	k(r|}
|}	nL|}	�jdk(r|}
n8�jdk(r|}
n&d
j�j�}t|��tj
j
|
�r?t	j|
�jt	j|�jk\s||�j��s|x}
}	tj
j|	�d}|r|�d|��}|
|fS)aReturn (filename, archivename) for the path.

        Given a module name path, return the correct file path and
        archive name, compiling if necessary.  For example, given
        /python/lib/string, return (/python/lib/string.pyc, string).
        rtc����ddl}�jrtd|�	|j|d|��y#|j$r}t|j
�Yd}~yd}~wwxYw)Nr�	CompilingT)�doraiser�F)�
py_compiler�r�compile�PyCompileError�msg)rer�r��errr�s    �r�_compilez)PyZipFile._get_codename.<locals>._compiless\�����z�z��k�4�(�
��"�"�4���"�I����,�,�
��c�g�g����
�s�4�A"�A�A"r�z.pycr�)�optimizationr!r"rz"invalid value for 'optimize': {!r})r�r�rs)�	importlib�util�cache_from_sourcer�r�r�r�r�r�r�r/r��formatr�rv)
r�r�r�r��file_py�file_pyc�pycache_opt0�pycache_opt1�pycache_opt2r�r\r��archivenames
`            rr�zPyZipFile._get_codenamels����		��e�#���f�$�� �~�~�7�7��b�7�Q�� �~�~�7�7��a�7�P�� �~�~�7�7��a�7�P���>�>�R�������x�(��'�'�(�#�,�,�����0@�0I�0I�I�"*�*��%��'�'�.�.��.��'�'�,�'�0�0�B�G�G�G�4D�4M�4M�M�%��"���'�'�.�.��.��'�'�,�'�0�0�B�G�G�G�4D�4M�4M�M�%��"���'�'�.�.��.��'�'�,�'�0�0�B�G�G�G�4D�4M�4M�M�%��"���G�$��y�y�)�)�Q�.� ,�����+�+�q�0� ,�� ,��&�G�&-�-�E�G��~�~��"�$��"��"���>�>�Q�&�(�E��^�^�q�(�(�E�>�E�E�d�n�n�U�C�$�S�/�)��G�G�N�N�5�)��G�G�E�N�+�+�r�w�w�w�/?�/H�/H�H���$�.�.�A�&-�-�E�G��g�g�m�m�G�,�Q�/���%-�{�;�K��{�#�#r)r�N)rrrrrr�r�r�rrrr
r
s!��N�"%�:� �2�"�P'�dP$rr
c����ddl}d}|j|��}|jd��}|jdddd	�
�|jddd
dd��|jddddd��|jdddd�
�|jddd�
�|j	|�}|j
}|j�[|j}t|d|��5}|j�}ddd�rtdj|��td�y|j�4|j}t|d|��5}|j�ddd�y|j�8|j\}}	t|d|��5}|j|	�ddd�y|j��|r0td t j"�!�t!j$d"�|jj'd�}
|j}�fd#��t|
d$�5}|D]�}t(j*j-|�}
|
s<t(j*j-t(j*j/|��}
|
d%t(j0t(j2fvrd%}
�|||
���	ddd�yy#1swY���xYw#1swYyxYw#1swYyxYw#1swYyxYw)&Nrz3A simple command-line interface for zipfile module.)�descriptionT)�requiredz-lz--list�	<zipfile>zShow listing of a zipfile)�metavar�helpz-ez	--extractr")r�z<output_dir>zExtract zipfile into target dir)�nargsr�r�z-cz--create�+)z<name>z<file>zCreate zipfile from sourcesz-tz--testzTest if a zipfile is validz--metadata-encodingz
<encoding>z2Specify encoding of member names for -l, -e and -tr�)r�z.The following enclosed file is corrupted: {!r}zDone testingz/Non-conforming encodings not supported with -c.r:r!c	���tjj|�r|j||t�ytjj|�r~|r|j||�t
tj|��D]H}�|tjj||�tjj||���Jyyr�)	r�r�r�r{rr�r(r�r8)r�r��zippath�nm�addToZips    �rr�zmain.<locals>.addToZip�s�����w�w�~�~�d�#�����w��5������t�$���H�H�T�7�+� ����D�!1�2�P�B��R��W�W�\�\�$��3�R�W�W�\�\�'�2�5N�P�P�%rr�r�)�argparse�ArgumentParser�add_mutually_exclusive_group�add_argument�
parse_argsr��testrr@rr�rxr<rgrj�creater��stderr�exit�popr�r�r�r�rr�)�argsr�r��parser�group�encodingr�r��badfiler�zip_name�filesr�r�r�s              @r�mainr��s�����G�K�
�
$�
$��
$�
=�F��/�/��/�>�E�	���t�X�{�7��9�	���t�[��<�=��?�
���t�Z�s�3�9��;�
���t�X�{�8��:�
���-�|�Q��S����T�"�D��%�%�H��y�y���i�i��
�S�#��
:�	#�b��j�j�l�G�	#���B�I�I�'�R�S�
�n��	
���	��i�i��
�S�#��
:�	�b��K�K�M�	�	�
���	!��l�l���V�
�S�#��
:�	"�b��M�M�&�!�	"�	"�
���	 ���C��z�z�
#��H�H�Q�K��;�;�?�?�1�%������	P��X�s�
#�	,�r��
,���'�'�*�*�4�0��� �g�g�.�.�r�w�w���t�/D�E�G��r�2�9�9�b�i�i�8�8� �G���T�7�+�

,�	,�	,�)
!�!	#�	#��	�	��
	"�	"��.	,�	,�s1�J4�K�K
�BK�4J>�K
�
K�K")r�CompleteDirsr�)�r�binascii�importlib.utilr�r�r�r�r�rSr�rr�rIr
�ImportErrorrKr$�__all__�	Exceptionrrrrr�r�rKrrrr	r�r�r�r�r'rwrvr�rurYrZr[r\r]r^r_r{rrrr!rr �_CD_CREATE_VERSION�_CD_CREATE_SYSTEM�_CD_EXTRACT_VERSION�_CD_EXTRACT_SYSTEMr#�_CD_COMPRESS_TYPE�_CD_TIME�_CD_DATE�_CD_CRC�_CD_COMPRESSED_SIZE�_CD_UNCOMPRESSED_SIZEr"r$r%�_CD_DISK_NUMBER_START�_CD_INTERNAL_FILE_ATTRIBUTES�_CD_EXTERNAL_FILE_ATTRIBUTESr&rYrar�rVrWr�r�r�rRrS�_FH_EXTRACT_VERSION�_FH_EXTRACT_SYSTEMrX�_FH_COMPRESSION_METHOD�_FH_LAST_MOD_TIME�_FH_LAST_MOD_DATE�_FH_CRC�_FH_COMPRESSED_SIZE�_FH_UNCOMPRESSED_SIZErTrUrTrUrRrWrXrV�_CD64_SIGNATURE�_CD64_DIRECTORY_RECSIZE�_CD64_CREATE_VERSION�_CD64_EXTRACT_VERSION�_CD64_DISK_NUMBER�_CD64_DISK_NUMBER_START�_CD64_NUMBER_ENTRIES_THIS_DISK�_CD64_NUMBER_ENTRIES_TOTAL�_CD64_DIRECTORY_SIZE�_CD64_OFFSET_START_CENTDIRr��Structr4rBrHr
rqrDr��objectrrrrrr1r�rNrVr[r]rvr�r�r�rr
r��_pathrr�rrr�<module>r!s����
��	�	�
��
�
������J�J�E�
������
	��	��9�� ���
���#�����
����	�
�����
��
������� �� ����!1�2������������
�	��������
�$�� �� ����!1�2���
����������
�������
��������������!��!������ ��
#�� �� ��
��"�� �� ����!1�2���
����� !��������
����������%��)��)�&�/�/�*C�D��"��"��"�6�?�?�#5�6��������������!"���������
�#�f�m�m�E�*���*�� (�V:�x�&i�v�i�`
�	�� #�L"�"�.��8��w���x���x���x�	�
�x���x�
��y���z���y���{���	�������������� �	�!�"��#��(N�&
� P�$%!�%!�P��(T��"�"�T�n
P+�B�%�%�P+�h\�\�~k$��k$�\C,�L���cG���D��N�N�E�����
�C���
���D��s4�I
�I$�I2�
I!� I!�$I/�.I/�2I=�<I=

Zerion Mini Shell 1.0