ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python311/lib64/python3.11/__pycache__/zipfile.cpython-311.pyc

�

�f�m���dZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZ	ddlZejZn#e$rdZejZYnwxYw	ddlZn
#e$rdZYnwxYw	ddlZn
#e$rdZYnwxYwgd�ZGd�de��ZGd�de��ZexZZdZd	Zd	ZdZd
ZdZ dZ!d
Z"dZ#dZ$dZ%dZ&dZ'dZ(e
j)e'��Z*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2d
Z3dZ4dZ5dZ6e
j)e5��Z7dZ8dZ9dZ:dZ;dZ<dZ=dZ>dZ?d
Z@dZAdZBdZCdZDdZEdZFd ZGd!ZHd"ZId#ZJdZKdZLd
ZMd$ZNd%ZOd&ZPd'ZQd(ZRe
j)eQ��ZSdZTdZUdZVdZWdZXdZYdZZdZ[d
Z\dZ]dZ^dZ_d)Z`d*Zae
j)e`��Zbd+Zcd,Zde
j)ec��ZedZfdZgdZhdZidZjdZkdZldZmd
ZndZod-Zpe
jqd.��Zrd/�Zsd0�Ztd1�Zud2�Zvd3�ZwGd4�d5ex��Zydazd6�Z{d7�Z|Gd8�d9��Z}Gd:�d;��Z~idd<�dd=�dd>�dd>�dd>�dd>�dd?�dd@�d
dA�ddB�dd?�ddC�ddD�d#dE�dFdG�dHdI�dJdK�ZdL�Z�dgdM�Z�dN�Z�GdO�dP��Z�GdQ�dR��Z�GdS�dTej���Z�GdU�dVej���Z�GdW�dX��Z�GdY�dZe���Z�d[�Z�d\�Z�e�j�Z�	d]�Z�Gd^�d_e���Z�Gd`�dae���Z�dgdb�Z�Gdc�dd��Z�dgde�Z�e�dfkre���dSdS)hzP
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��eZdZdS)rN)�__name__�
__module__�__qualname__���./opt/alt/python311/lib64/python3.11/zipfile.pyrr+s�������Drrc��eZdZdZdS)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|��krd||||dz���\}}|dz|z}	||vr'||kr|�|||���|	}d}|	}|dzt|��k�d|s|S|t|��kr|�||d���d�|��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�:�:�
�
��F�5��Q��U��+�,�,�	��T�
��E�D�L���$�;�;��E�z�z��
�
�e�E�A�I�.�/�/�/��E��H�
���a�%�3�u�:�:�
�
�������E�
�
����
�
�e�E�F�F�m�$�$�$��8�8�F���rc�L�	t|��rdSn#t$rYnwxYwdS)NTF)�_EndRecData�OSError��fps r�_check_zipfilerH�sD��
��r�?�?�	��4�	���
�
�
���
�����5s��
!�!c���d}	t|d��rt|���}n7t|d��5}t|��}ddd��n#1swxYwYn#t$rYnwxYw|S)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
�s���
�F�
��8�V�$�$�	,�#�x�0�0�0�F�F��h��%�%�
,��'��+�+��
,�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,����
,�
,�
,�
,����
�
�
���
�����Ms4�1A�A�A�A�A�A�A�
A*�)A*c
��	|�|tz
d��n#t$r|cYSwxYw|�t��}t	|��tkr|Stjt|��\}}}}|tkr|S|dks|dkrtd���|�|tz
tz
d��|�t��}t	|��tkr|Stjt|��\
}}}	}
}}}
}}}|tkr|S||t<||t<||t<|
|t <||t"<||t$<||t&<|S)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�6�6�6�������
�
�
�����
�9�9�,�-�-�D�
�4�y�y�+�+�+��
�!'��/H�$�!O�!O��C����
�'�'�'��
�
��{�{�e�a�i�i��N�O�O�O�	�I�I�f�.�.�1A�A�1�E�E�E��9�9�%�&�&�D�
�4�y�y�$�$�$��
�	�
�(�$�/�/�0�C��^�\�8�X��)�W�i�
� � � ��
�!�F�>��'�F���&�F�?��%-�F�!�"�!*�F����F�9��#�F�;���Ms�!�0�0c��|�dd��|���}	|�td��n#t$rYdSwxYw|���}t|��tkr�|dd�tkr�|dd�dkrrtjt|��}t|��}|�d��|�|tz
��t|t|��St|dz
tz
d��}|�|d��|���}|�t��}|dkr�|||tz�}t|��tkrdSttjt|����}|t}||tz|tz|z�}|�|��|�||z��t|||z|z
|��SdS)	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�O�O��y�y�{�{�H�
��	�	�>�/�1�%�%�%�%�������t�t������9�9�;�;�D��D�	�	�^�#�#��Q�q�S�	�%�%�%��R�S�S�	�[� � ���/��6�6���F�|�|��	�
�
�c�����
�
�h��/�0�0�0��T�N�?�F�;�;�;��(�g�.��?��C�C�O��I�I�o�q�!�!�!��9�9�;�;�D��J�J�'�(�(�E���z�z��u�U�>�1�1�2���w�<�<�>�)�)��4��f�m�$4�g�>�>�?�?���.�/���u�^�+�E�.�,@��,L�L�M���
�
�g�����
�
�o��-�.�.�.��T�?�U�#:�X�#E�#�%�%�	%��4s�A	�	
A�Ac�\�eZdZdZdZdd�Zd�Zdd�Zd	�Zd
�Z	e
ddd�d
���Zd�ZdS)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_offset�NoName��r!r!rrrc�f�||_|�td����}|dkr
|d|�}tjdkr.tj|vr |�tjd��}||_||_|ddkrtd���t|_
d|_d|_d|_
tjdkrd|_nd|_t"|_t"|_d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr�/r�z+ZIP does not support timestamps before 1980r�win32r#)r��find�chr�os�sep�replacerNr��
ValueErrorrr�r�r�r9�sys�platformr��DEFAULT_VERSIONrir�r�r�r�r�r�r�r�r�)�selfrNr��	null_bytes    r�__init__zZipInfo.__init__us*��%����M�M�#�a�&�&�)�)�	���>�>���)��,�H��6�S�=�=�R�V�x�/�/��'�'����4�4�H� ��
�"����Q�<�$����J�K�K�K�(���"��������
��<�7�"�"�!"�D���"#�D��-���.�����
�����������������������rc���d|jj�d|j��g}|jtkr;|�dt�|j|j��z��|jdz	}|jdz}|r*|�dtj
|��z��|r|�d|z��|���}|r|jr|�d|jz��|r|j
r=|jtks|j|j
kr|�d	|j
z��|�d
��d�|��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�/3�/A�C�C�C�
D�
D�
D��
�2�
%��
�
�&�
(��
�	>��M�M�.�4�=��+<�+<�<�=�=�=�
�	5��M�M�.��3�4�4�4����
�
���	<���	<��M�M�/�D�N�:�;�;�;��	D�$�,�	D�
�
�:�
-�
-�
�^�t�1�
1�
1��M�M�-��0B�B�C�C�C��
�
�c�����w�w�v���rNc��|j}|ddz
dz|ddzz|dz}|ddz|d	dzz|ddzz}|jtzrdx}x}}n|j}|j}|j}|j}d}	|�|tkp
|tk}|r=d}
|tj	|
dtj
|
��d	z
||��z}d}d}t}	|jtkrtt|	��}	n%|jt krtt"|	��}	t|	|j��|_t|	|j��|_|���\}}tj	t*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$Nz<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��()�6�?�3�+?�+?��+A�9�m�]�]�]�E�"�I�&�M�'�K����*�*��m�[�9�9�K�K�
�
�8�
+�
+��l�K�8�8�K�"�;��0D�E�E���!�+�t�/B�C�C���"�7�7�9�9���)���-�/?�!�1�4�=�)�!�/��'�3�*�I� ��]�]�C��J�J�	8�8��
�� �5�(�(rc��	|j�d��|jfS#t$r,|j�d��|jtzfcYSwxYw)N�ascii�utf-8)rN�encoder��UnicodeEncodeError�_MASK_UTF_FILENAME�r�s rr�zZipInfo._encodeFilenameFlags�sm��	V��=�'�'��0�0�$�.�@�@��!�	V�	V�	V��=�'�'��0�0�$�.�CU�2U�U�U�U�U�	V���s� #�3A�Ac��|j}tj}t|��dk�r*|d|dd���\}}|dzt|��krt	d||fz���|dkr�|d|dz�}	|jdvr'd}|d|dd���\|_|dd�}|jd	kr'd
}|d|dd���\|_|dd�}|jd	krd}|d|dd���\|_n'#tj$rt	d|�d
���d�wxYw||dzd�}t|��dk��(dSdS)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.)	r9rSr5r6rr�r�r�r)r�r9r5�tp�lnrc�fields       r�_decodeExtrazZipInfo._decodeExtra�s����
������%�j�j�A�o�o��V�E�5��!��9�-�-�F�B���!�t�c�%�j�j� � � �!E��R��!P�Q�Q�Q��V�|�|��Q�r�!�t�V�}��F��~�)M�M�M� +��*0�&��t�B�Q�B�x�*@�*@����#�A�B�B�x���)�[�8�8� /��.4�f�T�4����8�.D�.D�+��*�#�A�B�B�x���)�[�8�8� /��.4�f�T�4����8�.D�.D�+��*����|�F�F�F�$�&;�(-�&;�&;�&;�<�<�AE�F�F�����"�Q�$�%�%�L�E�/�%�j�j�A�o�o�o�o�o�os
�=B
D�$D,T��strict_timestampsc��t|tj��rtj|��}tj|��}t	j|j��}tj|j	��}|dd�}|s|ddkrd}n|s|ddkrd}|�|}tj
�tj
�|��d��}|dtj
tjfvr*|dd�}|dtj
tjfv�*|r|d	z
}|||��}|jd
zdz|_|rd|_|xjdzc_n|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���;r�Nr!r�rr-)�
isinstancer��PathLike�fspathr��S_ISDIR�st_mode�time�	localtime�st_mtime�path�normpath�
splitdriver��altsepr�r��st_size)	�clsrN�arcnamer��str��mtimer��zinfos	         r�	from_filezZipInfo.from_file
sz���h���,�,�	+��y��*�*�H�
�W�X�
�
����R�Z�(�(����r�{�+�+���!�A�#�J�	� �	3�Y�q�\�D�%8�%8�-�I�I�"�	3�y��|�d�':�':�2�I��?��G��'�"�"�2�7�#5�#5�g�#>�#>�q�#A�B�B���a�j�R�V�R�Y�/�/�/��a�b�b�k�G��a�j�R�V�R�Y�/�/�/��	��s�N�G���G�Y�'�'��!�z�F�2�r�9����	)��E�O����4�'���� �j�E�O��rc���|j�d��rdStjjr:|j�tjjtjjf��SdS)z2Return True if this archive member is a directory.r�TF)rN�endswithr�r�r�r�r�s rr�zZipInfo.is_dir0sV���=�!�!�#�&�&�	��4�
�7�>�	I��=�)�)�2�7�;����*G�H�H�H��ur)r�r��N)
rrrr�	__slots__r�r�r�r�r��classmethodr�r�rrrrrZs�������H�H��I�0' �' �' �' �X���,.)�.)�.)�.)�`V�V�V�!�!�!�:�#�D�#�#�#�#��[�#�J
�
�
�
�
rrc�P�td��D]}|dzr	|dz	dz}�|dz}�|S)Nrr!l q[)�range)�crcrAs  r�_gen_crcr�BsC��
�1�X�X������7�	��!�8�z�)�C�C��A�I�C�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>.crc32\s ����q��H�c�B�h�$�%6�7�7�7rc�j���|������dzzdz��dzdzdz���dz	����dS)Nr�r�i�r!�r)�cr��key0�key1�key2s ����r�update_keysz"_ZipDecrypter.<locals>.update_keys`sR����u�Q��~�~����t��$�
�2���y� �1�$�
�2���u�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>.decrypterjso�����������	�	�A��q��A�
�1��!��9��"�d�*�*�A��K��N�N�N��F�1�I�I�I�I��V�}�}�r)�	_crctablerx�mapr�r�)	�pwd�pr	r�r�rrrrs	   @@@@@@r�
_ZipDecrypterrRs����������D��D��D�����X�u�S�z�z�2�2�3�3�	��H�8�8�8�8�8�'�'�'�'�'�'�'�'�������A�����	�	�	�	�	�	��rc�&�eZdZd�Zd�Zd�Zd�ZdS)�LZMACompressorc��d|_dSr�)�_compr�s rr�zLZMACompressor.__init__zs
����
�
�
rc��tjdtji��}tjtjtjtj|��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}ss���.��d�6G�/H�I�I���(����*�4�+<�e�D�D�C
�����
��{�6�1�a��U���4�4�u�<�<rc��|j�/|���|j�|��zS|j�|��Sr�)rr�compress)r�rcs  rrzLZMACompressor.compress�sC���:���:�:�<�<�$�*�"5�"5�d�";�";�;�;��z�"�"�4�(�(�(rc��|j�.|���|j���zS|j���Sr�)rr�flushr�s rr!zLZMACompressor.flush�s?���:���:�:�<�<�$�*�"2�"2�"4�"4�4�4��z���!�!�!rN)rrrr�rrr!rrrrrxsP���������=�=�=�)�)�)�
"�"�"�"�"rrc��eZdZd�Zd�ZdS)�LZMADecompressorc�0�d|_d|_d|_dS)NrF)�_decomp�_unconsumed�eofr�s rr�zLZMADecompressor.__init__�s������������rc
��|j��|xj|z
c_t|j��dkrdStjd|jdd���\}t|j��d|zkrdStjt
jtjt
j	|jdd|z���g���|_|jd|zd�}|`|j�
|��}|jj|_|S)Nr$rz<Hr"r)r%r&r6rSr5rr#rrr�
decompressr')r�rc�psizerOs    rr)zLZMADecompressor.decompress�s���<������$����4�#�$�$��)�)��s��]�4��)9�!�A�#�)>�?�?�F�E��4�#�$�$��E�	�1�1��s��0����.�t�/@�/3�/?��!�e�)��/L�N�N�K����D�L��#�A��I�J�J�/�D�� ���(�(��.�.���<�#����
rN)rrrr�r)rrrr#r#�s2���������
����rr#�store�shrink�reduce�implode�tokenize�deflate�	deflate64�bzip2r�terse��lz77�a�wavpack�b�ppmdc��|tkrdS|tkrtstd���dS|tkrt
std���dS|tkrtstd���dStd���)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_compressionr@�s����j� � ���	��	$�	$��	B��@�B�B�
B�	B�	B�
�	�	!�	!��	A��?�A�A�
A�	A�	A�
��	 �	 ��	B��@�B�B�
B�	B�	B�"�"L�M�M�Mrc�N�|tkrL|� tj|tjd��Stjtjtjd��S|t
kr)|�t
j|��St
j��S|tkrt��SdS)N��)
rr;�compressobj�DEFLATED�Z_DEFAULT_COMPRESSIONrr=�
BZ2Compressorr	r)r��
compresslevels  r�_get_compressorrH�s�����$�$��$��#�M�4�=�#�F�F�F���� :�D�M�3�O�O�O�	�)�	#�	#��$��$�]�3�3�3�� �"�"�"�	�(�	"�	"������trc�l�t|��|tkrdS|tkrtjd��S|t
krt
j��S|tkrt��St�|��}|rtd||fz���td|fz���)NrBzcompression type %d (%s)zcompression type %d)
r@rrr;�
decompressobjrr=�BZ2Decompressorr	r#r�r�r>)r��descrs  r�_get_decompressorrM�s����}�%�%�%��
�"�"��t�	�,�	&�	&��!�#�&�&�&�	�)�	#�	#��"�$�$�$�	�(�	"�	"��!�!�!� �$�$�]�3�3���	P�%�&@�M�SX�CY�&Y�Z�Z�Z�%�&;�}�>N�&N�O�O�Orc�0�eZdZd�Zd�Zd	d�Zd
d�Zd�ZdS)�_SharedFilec�d�||_||_||_||_||_|j|_dSr�)�_file�_pos�_close�_lock�_writing�seekable)r��file�pos�close�lock�writings      rr�z_SharedFile.__init__�s2����
���	������
���
��
��
�
�
rc��|jSr�)rRr�s rrtz_SharedFile.tell�s
���y�rrc�
�|j5|���rtd���|j�||��|j���|_|jcddd��S#1swxYwYdS)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.)rTrUr�rQrQrtrR)r�ra�whences   rrQz_SharedFile.seeks���
�Z�	�	��}�}���
K� �"J�K�K�K�
�J�O�O�F�F�+�+�+��
���)�)�D�I��9�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A#A8�8A<�?A<���c�<�|j5|���rtd���|j�|j��|j�|��}|j���|_|cddd��S#1swxYwYdS)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.)rTrUr�rQrQrRrJrt�r��nrcs   rrJz_SharedFile.read
s���
�Z�	�	��}�}���
K� �"J�K�K�K�
�J�O�O�D�I�&�&�&��:�?�?�1�%�%�D��
���)�)�D�I��	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A<B�B�Bc�^�|j�%|j}d|_|�|��dSdSr�)rQrS)r��fileobjs  rrYz_SharedFile.closes8���:�!��j�G��D�J��K�K�� � � � � �"�!rN�r�r_)rrrr�rtrQrJrYrrrrOrO�si������&�&�&��������	�	�	�	�!�!�!�!�!rrOc�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�	_Tellablec�"�||_d|_dS�Nr)rGra�r�rGs  rr�z_Tellable.__init__s���������rc�Z�|j�|��}|xj|z
c_|Sr�)rG�writera)r�rcrcs   rrnz_Tellable.write!s*���G�M�M�$�������q�����rc��|jSr�)rar�s rrtz_Tellable.tell&s
���{�rc�8�|j���dSr�)rGr!r�s rr!z_Tellable.flush)�����
�
�����rc�8�|j���dSr�)rGrYr�s rrYz_Tellable.close,rqrN)rrrr�rnrtr!rYrrrriris_������������
����������rric���eZdZdZdZdZdZ		dd�Zd�Zd	�Z	dd�Z
dd
�Zd�Zdd�Z
d�Zd�Zd�Zd�Z�fd�Zd�Zdd�Zd�Z�xZS)�
ZipExtFilezZFile-like object for reading an archive member.
       Is returned by ZipFile.open().
    i@iiNFc�&�||_||_||_|j|_|j|_|j|_t|j��|_
d|_d|_d|_
d|_||_|j|_t%|d��r!|j|_t+d��|_nd|_d|_	|���rD|���|_|j|_|j|_|j|_d|_n#t<$rYnwxYwd|_|r[|j tBzr|j"dz	dz}n
|jdz	dz}|�#��}||krtId	|j%z���dSdS)
NFrrr�Trr�r�zBad password for file %r)&�_fileobj�_pwd�_close_fileobjr��_compress_typer��_compress_leftr��_leftrM�
_decompressor�_eof�_readbuffer�_offset�newlines�moderN�namerLr��
_expected_crcr��_running_crc�	_seekablerVrt�_orig_compress_start�_orig_compress_size�_orig_file_size�_orig_start_crc�AttributeError�
_decrypterr�r�r��_init_decrypterr<r�)r�rer��zipinfor�
close_fileobj�
check_byte�hs        rr�zZipExtFile.__init__>s�����
���	�+���%�3���%�3����&��
�.�t�/B�C�C�����	���������
���	��$��	��7�E�"�"�	&�!(��D�� %�c�
�
�D���!%�D�����	����!�!�
&�,3�L�L�N�N��)�+2�+@��(�'.�'8��$�'+�'8��$�!%������	�	�	��D�	��������		W�� �#<�<�
8�%�/�1�4��<�
�
�&�k�R�/�4�7�
��$�$�&�&�A��J���"�#=��@U�#U�V�V�V�		W�		W��s�AD�
D(�'D(c��t|j��|_|j�d��}|xjdzc_|�|��dS)Nrr*)rrwr�rvrJrz)r�r�s  rr�zZipExtFile._init_decrypterqsU��'��	�2�2�����#�#�B�'�'�����r�!������v�&�&�r�*�*rc��d|jj�d|jj��g}|jsq|�d|j�d|j����|jtkr;|�dt�
|j|j��z��n|�d��|�d��d�|��S)	Nr��.z name=z mode=r��	 [closed]r�r�)r�rr�closedr7r�r�ryrr�r�r8�r�rOs  rr�zZipExtFile.__repr__|s����"�n�7�7�7�"�n�9�9�;�<���{�	'��M�M�M��	�	�	�4�9�9�E�F�F�F��"�j�0�0��
�
�1�.�2�2�4�3F�37�3F�H�H�H�I�I�I��
�M�M�+�&�&�&��
�
�c�����w�w�v���rr_c���|dkrF|j�d|j��dz}|dkr|j|j|�}||_|Stj�||��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�sm���1�9�9�� �%�%�e�T�\�:�:�Q�>�A��1�u�u��'���a��8�� ������ �)�)�$��6�6�6rr!c�V�|t|j��|jz
krn|�|��}t|��|jkr$||j|jd�z|_d|_n|xjt|��zc_|j|j|jdz�S)z6Returns buffered bytes without advancing the position.Nri)r6r~rrJ)r�rc�chunks   r�peekzZipExtFile.peek�s����s�4�#�$�$�t�|�3�3�3��I�I�a�L�L�E��5�z�z�D�L�(�(�#(�4�+;�D�L�M�M�+J�#J�� � ��������E�
�
�*�������d�l�S�.@� @�A�Arc�2�|jrtd���dS)N�I/O operation on closed file.T)r�r�r�s r�readablezZipExtFile.readable�s ���;�	>��<�=�=�=��trc��|jrtd���|�|dkrO|j|jd�}d|_d|_|js$||�|j��z
}|j�$|S||jz}|t|j��kr|j|j|�}||_|S|t|j��z
}|j|jd�}d|_d|_|dkro|jsh|�|��}|t|��kr||_||_||d|�z
}n$||z
}|t|��z}|dkr|j�h|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~rr}�_read1�MAX_Nr6)r�rc�buf�endrcs     rrJzZipExtFile.read�sx���;�	7��5�6�6�6��9��A����"�4�<�=�=�1�C�"�D���D�L��i�
/��t�{�{�4�:�.�.�.���i�
/��J��$�,�����T�%�&�&�&�&��"�4�<��#3�4�C��D�L��J��#�d�&�'�'�'����t�|�}�}�-���������!�e�e�D�I�e��;�;�q�>�>�D��3�t�9�9�}�}�#'�� � ����t�B�Q�B�x�����4�K�C�
��T���N�A��!�e�e�D�I�e��
rc��|j�dSt||j��|_|jr'|j|jkrt	d|jz���dSdS)NzBad CRC-32 for file %r)r�r�r�r}rr�)r��newdatas  r�_update_crczZipExtFile._update_crc�sh����%��F�!�'�4�+<�=�=����9�	C��*�d�.@�@�@��5��	�A�B�B�B�	C�	C�@�@rc�n�|�|dkrT|j|jd�}d|_d|_|js)|�|j��}|r||z
}n|j�)|S||jz}|t|j��kr|j|j|�}||_|S|t|j��z
}|j|jd�}d|_d|_|dkrZ|jsS|�|��}|t|��kr||_||_||d|�z
}n|r||z
}n|j�S|S)z7Read up to n bytes with at most one read() system call.Nrr)r~rr}r�r�r6)r�rcr�rcr�s     r�read1zZipExtFile.read1�sk��
�9��A����"�4�<�=�=�1�C�"�D���D�L��i�
��{�{�4�:�.�.�����4�K�C��	�i�
�
�J��$�,�����T�%�&�&�&�&��"�4�<��#3�4�C��D�L��J��#�d�&�'�'�'����t�|�}�}�-���������q�5�5��i�	
��{�{�1�~�~���s�4�y�y�=�=�'+�D�$�#$�D�L��4����8�O�C�����4�K�C���i�	
��
rc�l�|js|dkrdS|jtkrH|jj}|t|��kr(||�|t|��z
��z
}n|�|��}|jtkr|jdk|_n�|jtkr}t||j
��}|j�||��}|jjp|jdko|jj|_|jr||j�
��z
}n6|j�|��}|jjp
|jdk|_|d|j�}|xjt|��zc_|jdkrd|_|�|��|S)NrrT)r}ryrr|�unconsumed_tailr6�_read2rrzry�
MIN_READ_SIZEr)r'r!r{r�rbs   rr�zZipExtFile._read1�s����9�	��Q����3���,�.�.��%�5�D��3�t�9�9�}�}�����A��D�	�	�M�2�2�2����;�;�q�>�>�D���*�,�,��+�q�0�D�I�I�
�
 �L�
0�
0��A�t�)�*�*�A��%�0�0��q�9�9�D��+�/�@��,��1�@�!�/�?�?�
�I��y�
3���*�0�0�2�2�2����%�0�0��6�6�D��*�.�J�$�2E��2J�D�I��K�T�Z�K� ���
�
�c�$�i�i��
�
��:��?�?��D�I���������rc�,�|jdkrdSt||j��}t||j��}|j�|��}|xjt
|��zc_|st�|j�|�|��}|S)Nrr)	rzryr��minrvrJr6�EOFErrorr�rbs   rr�zZipExtFile._read2"s�����!�#�#��3���4�%�&�&����4�&�'�'���}�!�!�!�$�$�����s�4�y�y�(����	��N��?�&��?�?�4�(�(�D��rc����	|jr|j���t�����dS#t�����wxYwr�)rxrvrY�super�r�r�s �rrYzZipExtFile.close2sR���	��"�
&��
�#�#�%�%�%��G�G�M�M�O�O�O�O�O��E�G�G�M�M�O�O�O�O���s� A�"A'c�<�|jrtd���|jS�Nr�)r�r�r�r�s rrVzZipExtFile.seekable9s#���;�	>��<�=�=�=��~�rrc�^�|jrtd���|jstjd���|���}|dkr|}n,|dkr||z}n |dkr|j|z}ntd���||jkr|j}|dkrd}||z
}||jz}|dkr"|t|j	��kr
||_d}n�|dkr�|j
�|j��|j
|_|j|_|j|_d|_	d|_t%|j��|_d|_|}|j�|���|dkr5t1|j|��}|�|��||z}|dk�5|���S)	Nzseek on closed file.�!underlying stream is not seekablerr!r"zCwhence must be os.SEEK_SET (0), os.SEEK_CUR (1), or os.SEEK_END (2)rF)r�r�r�r��UnsupportedOperationrtr�rr6r~rvrQr�r�r�r�rzr{rMryr|r}r�r�r��
MAX_SEEK_READrJ)r�rar^�curr_pos�new_pos�read_offset�buff_offset�read_lens        rrQzZipExtFile.seek>s����;�	5��3�4�4�4��~�	O��)�*M�N�N�N��9�9�;�;���Q�;�;��G�G�
�q�[�[���'�G�G�
�q�[�[��*�V�3�G�G��C�D�D�
D��T�)�)�)��*�G��Q�;�;��G���(��!�D�L�0���!����c�$�2B�.C�.C� C� C�&�D�L��K�K�
�1�_�_��M���t�8�9�9�9� $� 4�D��"&�":�D���-�D�J�"�D���D�L�!2�4�3F�!G�!G�D���D�I�!�K���*��$�$�&�&�&��A�o�o��4�-�{�;�;�H��I�I�h�����8�#�K��A�o�o�
�y�y�{�{�rc��|jrtd���|jstjd���|j|jz
t|j��z
|j	z}|S)Nztell on closed file.r�)
r�r�r�r�r�r�r{r6r~r)r��fileposs  rrtzZipExtFile.tellpsc���;�	5��3�4�4�4��~�	O��)�*M�N�N�N��&���3�c�$�:J�6K�6K�K�d�l�Z���r)NFrg�r!rf)rrrrr�r�r�r�r�r�r�r�r�rJr�r�r�r�rYrVrQrt�
__classcell__�r�s@rrtrt0sX���������

�E��M��M�37�$�0W�0W�0W�0W�f	+�	+�	+����7�7�7�7� B�B�B�B����
!�!�!�!�FC�C�C�#�#�#�J"�"�"�H��� ��������
0�0�0�0�d������rrtc�F��eZdZd�Zed���Zd�Zd�Z�fd�Z�xZ	S)�
_ZipWriteFilec��||_||_||_t|j|j��|_d|_d|_d|_	dSrk)
�_zinfo�_zip64�_zipfilerHr�r��_compressor�
_file_size�_compress_size�_crc)r��zfr�r�s    rr�z_ZipWriteFile.__init__zsP����������
�*�5�+>�+0�+?�A�A�����������	�	�	rc��|jjSr�)r�rGr�s rrvz_ZipWriteFile._fileobj�s
���}��rc��dS)NTrr�s r�writablez_ZipWriteFile.writable�s���trc��|jrtd���t|ttf��rt|��}nt
|��}|j}|xj|z
c_t||j
��|_
|jr7|j�|��}|xj
t|��z
c_
|j�|��|Sr�)r�r�r�rrr6�
memoryview�nbytesr�r�r�r�rr�rvrn)r�rcr�s   rrnz_ZipWriteFile.write�s����;�	>��<�=�=�=��d�U�I�.�/�/�	!���Y�Y�F�F��d�#�#�D��[�F����6�!����$��	�*�*��	���	-��#�,�,�T�2�2�D����3�t�9�9�,����
���D�!�!�!��
rc	�L��|jrdS	t�����|jrb|j���}|xjt
|��z
c_|j�|��|j|j	_
n|j|j	_
|j|j	_
|j|j	_|js>|jt krt#d���|jt krt#d���|j	jt&zr�|jrdnd}|j�t)j|t,|j	j
|j	j
|j	j����|j���|j_n�|j���|j_|j�|j	j��|j�|j	�|j����|j�|jj��|jj�|j	��|j	|jj|j	j <d|j_!dS#d|j_!wxYw)Nz*File size too large, try using force_zip64z0Compressed size too large, try using force_zip64z<LLQQz<LLLLF)"r�r�rYr�r!r�r6rvrnr�r�r�r�r�r�r�r�r<r�r�rSr��
_DD_SIGNATURErtr��	start_dirrQr�r��filelistr7�
NameToInforNrU)r�r�r�r�s   �rrYz_ZipWriteFile.close�sE����;�	��F�(	+��G�G�M�M�O�O�O���
<��&�,�,�.�.���#�#�s�3�x�x�/�#�#��
�#�#�C�(�(�(�,0�,?���)�)�,0�O���)�"�i�D�K�O�$(�O�D�K�!��;�
[��?�[�0�0�&�'S�T�T�T��&��4�4�&�'Y�Z�Z�Z��{�$�'@�@�
<�!%��9�g�g�'���
�#�#�F�K��]�D�K�O��K�-�t�{�/D�%F�%F�G�G�G�*.�-�*<�*<�*>�*>��
�'�'�+/�-�*<�*<�*>�*>��
�'��
�"�"�4�;�#<�=�=�=��
�#�#�D�K�$:�$:�4�;�$G�$G�H�H�H��
�"�"�4�=�#:�;�;�;�
�M�"�)�)�$�+�6�6�6�=A�[�D�M�$�T�[�%9�:�%*�D�M�"�"�"��U�D�M�"�*�*�*�*s�I;J�J#)
rrrr��propertyrvr�rnrYr�r�s@rr�r�ys������������ � ��X� �������&++�++�++�++�++�++�++�++�++rr�c�,�eZdZdZdZdZdeddfddd�d�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d%d
�Zd�Zd�Zd�Zed���Zejd���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$dS)+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|_||_||_
|j
r|dkrtd���t|tj��rtj|��}t|t$��r[d|_||_d	d
ddd
d
dd�}||}			t+j||	��|_n#t0$r|	|vr
||	}	Y�5�wxYwn$d|_||_t3|dd��|_d|_t7j��|_d|_d|_	|dkr|� ��dS|dvr�d|_	|j�!��|_"	|j�#|j"��dS#tHt0f$rd|_YdSwxYw#tHt0f$r+tK|j��|_d|_"d|_YdSwxYw|dkr�	|� ��|j�#|j"��dS#tL$rD|j�#dd��d|_|j�!��|_"YdSwxYwtd���#|j}
d|_|�'|
���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�r@�_allowZip64�
_didModify�debugr�r�r?rGr�r�_comment�_strict_timestampsr�r�r�r�r��str�_filePassedrNr�rMrGrE�getattr�_fileRefCnt�	threading�RLockrTr�rU�_RealGetContentsrtr�rQr�rir�_fpclose)r�rWr�r?�
allowZip64rGr�r��modeDictr�rGs           rr�zZipFile.__init__�ss���+�+�+��J�K�K�K��;�'�'�'�%��������
������
�&���*�����	������
�"3���!2����!�	I�d�c�k�k��G�I�I�
I��d�B�K�(�(�	#��9�T�?�?�D��d�C� � �	8� �D�� �D�M�"��U�%�$�T�$�@�@�H���~�H�
�� �g�d�H�5�5�D�G�G�������8�+�+�#+�H�#5�� ���	����
� �D���D�G�#�D�&�$�7�7�D�M�����_�&�&��
������
�'	��s�{�{��%�%�'�'�'�'�'���#�#�#'���/�%)�W�\�\�^�^�D�N�/�����T�^�4�4�4�4�4��*�G�4�/�/�/�).������/�����'��0�+�+�+�'���0�0�D�G�%&�D�N�%*�D�N�N�N�N�+��������4��)�)�+�+�+��G�L�L���0�0�0�0�0��!�4�4�4��G�L�L��A�&�&�&�'+�D�O�%)�W�\�\�^�^�D�N�N�N�N�4����!�!E�F�F�F��	���B��D�G��M�M�"�������s�8D�D-�+D-�K%�K%�+H
�
G+�+H�K%�H�K%�
8I�K%�I�	K%�3J�A
K�K%�K�K%�%&Lc��|Sr�rr�s r�	__enter__zZipFile.__enter__Gs���rc�.�|���dSr��rY)r��type�value�	tracebacks    r�__exit__zZipFile.__exit__Js���
�
�����rc��d|jj�d|jj��g}|j�g|jr|�d|jz��n$|j�|�d|jz��|�d|jz��n|�d��|�d��d�|��S)	Nr�r�z file=%rz filename=%rz mode=%rr�r�r�)	r�rrrGr�r7rNr�r8r�s  rr�zZipFile.__repr__Ms����"�n�7�7�7�"�n�9�9�;�<���7����
>��
�
�j�4�7�2�3�3�3�3���*��
�
�n�t�}�<�=�=�=��M�M�*�t�y�0�1�1�1�1��M�M�+�&�&�&��
�
�c�����w�w�v���rc��|j}	t|��}n#t$rtd���wxYw|std���|jdkrt|��|t}|t}|t|_	|t|z
|z
}|ttkr|ttzz}|jdkr||z}td|||��||z|_|jdkrtd���|�|jd��|�|��}t%j|��}d}||k�r�|�t(��}	t+|	��t(krtd���t-jt0|	��}	|	t2t4krtd���|jdkrt|	��|�|	t6��}
|	t8}|t:zr|
�d	��}
n|
�|jpd
��}
tA|
��}|�|	tB��|_"|�|	tF��|_$|	tJ|_&|	dd�\|_'|_(|_)|_*|_+|_,}
}|_-|_.|_/|j)t`krtcd|j)d
zz���|	dd�\|_2|_3|_4|
|_5|dz	dz|dz	dz|dz|
dz	|
dz	dz|
dzdzf|_6|�7��|j&|z|_&|j8�9|��||j:|j;<|t(z|	t6z|	tBz|	tFz}|jdkrtd|��||k���|j}ty|j8d�d���D]}||_=|j&}�dS)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�rT)�key�reverseN)>rGrDrErr��printr^r_�_ECD_COMMENTr��
_ECD_LOCATIONrYrXrVrRr�rQrJr��BytesIO�sizeCentralDirr6rSr5�structCentralDir�
_CD_SIGNATURE�stringCentralDir�_CD_FILENAME_LENGTH�
_CD_FLAG_BITSr��decoder�r�_CD_EXTRA_FIELD_LENGTHr9�_CD_COMMENT_LENGTHr��_CD_LOCAL_HEADER_OFFSETr�rir�r�r�r�r�r�r�r��MAX_EXTRACT_VERSIONr>r�r�r�r�r�r�r�r7r�rN�sortedr�)r�rGrb�size_cd�	offset_cd�concat�inferredrcr�centdirrN�flagsr��t�d�
end_offsetr�s                 rr�zZipFile._RealGetContents[sL��
�W��	7� ��_�_�F�F���	7�	7�	7��5�6�6�6�	7�����	7��5�6�6�6��:��>�>��&�M�M�M���#���;�'�	��|�,��
��
�&��0�9�<���.�!�%7�7�7��'�*A�A�B�F��:��>�>��	�)�H��+�Y��&�I�I�I�"�V�+����>�A����?�@�@�@�
������"�"�"��w�w�w����
�Z��
�
�����g�o�o��g�g�n�-�-�G��7�|�|�~�-�-� �!>�?�?�?��m�$4�g�>�>�G��}�%�)9�9�9� �!I�J�J�J��z�A�~�~��g�����w�w�w�':�;�<�<�H��M�*�E��)�)�
N�#�?�?�7�3�3���$�?�?�4�+A�+L�W�M�M����!�!�A��g�g�g�&<�=�>�>�A�G�����(:� ;�<�<�A�I�%�&=�>�A�O�5<�A�b�D�M�
2�Q�
�q���0A�1�:�
�[�!�/�1�a�
�U�A�O�Q�[�� �#6�6�6�)�*A�+,�+<�r�+A�+C�D�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��6�A�O��M� � ��#�#�#�*+�D�O�A�J�'��^�+�g�6I�.J�J��5�6�7��1�2�3�E��z�A�~�~��g�u�%�%�%�[�g�o�o�^�^�
��D�M� A� A�$(�*�*�*�	-�	-�E�!+�E���,�J�J�		-�	-s��3c�$�d�|jD��S)z+Return a list of file names in the archive.c��g|]	}|j��
Sr�rN)�.0rcs  r�
<listcomp>z$ZipFile.namelist.<locals>.<listcomp>�s��8�8�8�$��
�8�8�8r�r�r�s r�namelistzZipFile.namelist�s��8�8�$�-�8�8�8�8rc��|jS)zJReturn a list of class ZipInfo instances for files in the
        archive.r(r�s r�infolistzZipFile.infolist�����}�rc��tddz|���|jD]5}d|jdd�z}td|j||jfz|����6dS)z+Print a table of contents for the zip file.z%-46s %19s %12s)z	File NamezModified    �Size�rWz%d-%02d-%02d %02d:%02d:%02dNr&z
%-46s %s %12d)r
r�r�rNr�)r�rWr��dates    r�printdirzZipFile.printdir�s���
��"G�G��	�	�	�	��]�	�	�E�0�5�?�2�A�2�3F�F�D��/�U�^�T�5�?�$K�K��
�
�
�
�
�	�	rc��d}|jD]z}	|�|jd��5}|�|��r	|�|���ddd��n#1swxYwY�b#t$r|jcYcSwxYwdS)z%Read all the files and check the CRC.ir�N)r�rMrNrJr)r��
chunk_sizer��fs    r�testzipzZipFile.testzip�s����
��]�	&�	&�E�
&��Y�Y�u�~�s�3�3��q��&�&��,�,����&�&��,�,�����������������������
&�
&�
&��~�%�%�%�%�%�
&����	&�	&s4�A,�,A �A,� A$	�$A,�'A$	�(A,�,B�Bc�b�|j�|��}|�td|z���|S)z,Return the instance of ZipInfo given 'name'.Nz(There is no item named %r in the archive)r�r��KeyError)r�r��infos   r�getinfozZipFile.getinfo�s@����"�"�4�(�(���<��:�T�A�C�C�
C��rc��|r9t|t��s$tdt|��jz���|r	||_dSd|_dS)z)Set default password for encrypted files.�pwd: expected bytes, got %sN)r�r�	TypeErrorr�rr)r�rs  r�setpasswordzZipFile.setpassword�sX���	P�z�#�u�-�-�	P��9�D��I�I�<N�N�O�O�O��	��D�H�H�H��D�H�H�Hrc��|jS)z.The comment text associated with the ZIP file.)r�r�s rr�zZipFile.comment�r,rc�(�t|t��s$tdt|��jz���t|��tkr2ddl}|�dtzd���|dt�}||_	d|_
dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesr"��
stacklevelT)r�rr<r�rr6�ZIP_MAX_COMMENT�warnings�warnr�r�)r�r�rCs   rr�zZipFile.comment�s����'�5�)�)�	X��=��W�
�
�@V�V�W�W�W��w�<�<�/�)�)��O�O�O��M�M�O�+�,�89�
�
;�
;�
;��.��.�/�G���
�����rc��|�|d|��5}|���cddd��S#1swxYwYdS)zReturn file bytes for name.r�N�rMrJ)r�r�rrGs    rrJzZipFile.read�s���
�Y�Y�t�S�#�
&�
&�	�"��7�7�9�9�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s
�9�=�=F��force_zip64c���|dvrtd���|r|dkrtd����jstd���t|t��r|}nC|dkr(t|��}�j|_�j|_n��|��}|dkr��	||���S�j
rtd����xjdz
c_t�j|j
�j�j�fd	���}	|�t"��}t%|��t"krt'd
���t)jt,|��}|t.t0krt'd���|�|t2��}|t4r |�|t4��|jt8zrt;d���|jt<zrt;d
���|t>t@zr|�!d��}	n|�!�j"pd��}	|	|j#krt'd|j#�d|�d����|j$�=|�%��|j&z|j$krt'd|j#�d����|jtNz}
|
rY|s�j(}|r9t|tR��s$tUdtW|��j,z���|st[d|z���nd}t]||||d��S#|�/���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 closedrGrar!c����jSr�)rUr�s�rrzZipFile.open.<locals>.<lambda>(s	���$�-�rzTruncated file headerz Bad magic number for file headerz$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)r;z6File %r is encrypted, password required for extractionT)0r�rGr�rr?r�rGr�r9�_open_to_writerUr�rOr�r�rTrJ�sizeFileHeaderr6rrSr5r��
_FH_SIGNATUREr��_FH_FILENAME_LENGTH�_FH_EXTRA_FIELD_LENGTHr��_MASK_COMPRESSED_PATCHr>�_MASK_STRONG_ENCRYPTION�_FH_GENERAL_PURPOSE_FLAG_BITSr�rr�r�r�rtr��_MASK_ENCRYPTEDrrr<r�rr<rtrY)r�r�r�rrHr��zef_file�fheader�fname�	fname_str�is_encrypteds`          rrMzZipFile.open�s���� �z�!�!��>�?�?�?��	H�D�C�K�K��F�G�G�G��w�	F��D�F�F�
F��d�G�$�$�		'��E�E�
�S�[�[��D�M�M�E�"&�"2�E��#'�#5�E� � ��L�L��&�&�E��3�;�;��&�&�u�+�&�F�F�F��=�	G��F�G�G�
G�
	
���A�����t�w��(;�#�}�d�j�:O�:O�:O�:O�Q�Q��4	��m�m�N�3�3�G��7�|�|�~�-�-� �!8�9�9�9��m�$4�g�>�>�G��}�%�)9�9�9� �!C�D�D�D��M�M�'�*=�">�?�?�E��-�.�
?��
�
�g�&<�=�>�>�>���!7�7�
R�)�*P�Q�Q�Q���!8�8�
L�)�*J�K�K�K��4�5�8J�J�
L�!�L�L��1�1�	�	�!�L�L��)?�)J�7�K�K�	��E�/�/�/� �j��*�*�*�E�E�E�3�4�4�4��!�-��
�
���%�"5�5��8I�I�I� �!c��8K�!c�!c�!c�d�d�d�!�?�_�<�L��	
��#��(�C��X�z�#�u�5�5�X�#�$A�D��I�I�DV�$V�W�W�W��I�&�(A�CG�(H�I�I�I�I����h��e�S�$�?�?�?��	��N�N�������s
�H8M�Mc���|r|jstd���|jrtd���d|_d|_d|_|jtkr|xjtzc_|j	s|xjtzc_|jsd|_|p|jdztk}|js|rtd���|j	r|j�|j��|j���|_|�|��d|_|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�rUr�r�r�r�r	�_MASK_COMPRESS_OPTION_1r�r�r�r�r�rrGrQr�rtr��_writecheckr�rnr�r�)r�r�rHr�s    rrKzZipFile._open_to_write_s{���	�t�/�	�� ���
��=�	O��N�O�O�
O�
 �����	������(�*�*��O�O�6�6�O�O��~�	9��O�O�8�8�O�O��"�	.�"-�E���E���$� 6�� D����	J�E�	J��H�I�I�I��>�	)��G�L�L���(�(�(�"�g�l�l�n�n���������������
�
�e�&�&�u�-�-�.�.�.���
��T�5�%�0�0�0rc��|�tj��}ntj|��}|�|||��S)a#Extract 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'.
        )r��getcwdr��_extract_member)r��memberr�rs    r�extractzZipFile.extract�s;���<��9�;�;�D�D��9�T�?�?�D��#�#�F�D�#�6�6�6rc��|�|���}|�tj��}ntj|��}|D]}|�|||���dS)z�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().
        N)r)r�r^r�r_)r�r��membersrr�s     r�
extractallzZipFile.extractall�si���?��m�m�o�o�G��<��9�;�;�D�D��9�T�?�?�D��	5�	5�G�� � ��$��4�4�4�4�	5�	5rc�&�|j}|s4d}t�|dt|��z��}||_|�|��}d�|�|��D��}|�d�|D����}|S)z;Replace bad characters and remove trailing dots from parts.z:<>|"?*�_c3�@K�|]}|�d��V��dS)r�N)�rstrip�r&r�s  r�	<genexpr>z1ZipFile._sanitize_windows_name.<locals>.<genexpr>�s,����A�A�Q�1�8�8�C�=�=�A�A�A�A�A�Arc3�K�|]}|�|V��	dSr�rris  rrjz1ZipFile._sanitize_windows_name.<locals>.<genexpr>�s'����7�7�Q�Q�7�q�7�7�7�7�7�7r)�!_windows_illegal_name_trans_tabler��	maketransr6�	translate�splitr8)r�r��pathsep�table�illegals     r�_sanitize_windows_namezZipFile._sanitize_windows_name�s����5���	:��G��M�M�'�3��W���+=�>�>�E�49�C�1��#�#�E�*�*��A�A�'�-�-��*@�*@�A�A�A���,�,�7�7�'�7�7�7�7�7���rc�r��t|t��s|�|��}|j�dt
jj��}t
jjr4|�t
jjt
jj��}t
j�	|��d}dt
jj
t
jjf�t
jj��fd�|�
t
jj��D����}t
jjdkr%|�|t
jj��}t
j�||��}t
j�|��}t
j�|��}|r3t
j�|��stj|��|���r5t
j�|��stj|��|S|�||���5}t-|d��5}t/j||��ddd��n#1swxYwYddd��n#1swxYwY|S)	zbExtract the ZipInfo object 'member' to a physical
           file on the path targetpath.
        r�r!r�c3�$�K�|]
}|�v�|V��dSr�r)r&r��invalid_path_partss  �rrjz*ZipFile._extract_member.<locals>.<genexpr>�s>�����#C�#C��&'�/A�&A�&A�$%�&A�&A�&A�&A�#C�#Cr�\�rr�N)r�rr9rNr�r�r�r�r�r��curdir�pardirr8rorsr��dirname�exists�makedirsr�r��mkdirrM�shutil�copyfileobj)	r�r`�
targetpathrr��	upperdirs�source�targetrvs	        @rr_zZipFile._extract_member�s�����&�'�*�*�	*��\�\�&�)�)�F��/�)�)�#�r�w�{�;�;��
�7�>�	C��o�o�b�g�n�b�g�k�B�B�G��'�$�$�W�-�-�a�0�� �"�'�.�"�'�.�A���'�+�"�"�#C�#C�#C�#C�g�m�m�B�G�K�.H�.H�#C�#C�#C�C�C��
�7�;�$����1�1�'�2�7�;�G�G�G��W�\�\�*�g�6�6�
��W�%�%�j�1�1�
��G�O�O�J�/�/�	��	#�R�W�^�^�I�6�6�	#��K�	�"�"�"��=�=�?�?�	��7�=�=��,�,�
%����$�$�$���
�Y�Y�v�3�Y�
'�
'�	/�6�
�*�d�
#�
#�	/�'-���v�v�.�.�.�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/��s6�"J,�3J�	J,�J	�J,�J	�J,�,J0�3J0c��|j|jvr#ddl}|�d|jzd���|jdvrtd���|jstd���t|j��|j	s[d}t|j��tkrd	}n%|j
tkrd
}n|jtkrd}|rt!|dz���dSdS)
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�rCrDr�r�rGr@r�r�r6r��ZIP_FILECOUNT_LIMITr�r�r�r)r�r�rC�requires_zip64s    rr\zZipFile._writecheck�s���>�T�_�,�,��O�O�O��M�M�.���?�A�M�N�N�N��9�O�+�+��E�F�F�F��w�	H��F�H�H�
H��5�.�/�/�/���
	F�!�N��4�=�!�!�%8�8�8�!.�����;�.�.�!+����$�{�2�2�!/���
F�"�>�#D�$E�F�F�F�
	F�
	F�
F�
Frc�F�|jstd���|jrtd���t�|||j���}|���r%d|_d|_|�	|��dS|�||_
n|j|_
|�||_n|j
|_t|d��5}|�|d��5}tj||d��ddd��n#1swxYwYddd��dS#1swxYwYdS)	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�rUrr�r�r�r�r�r~r�r?r�rGrMrr�)r�rNr�r�rGr��src�dests        rrnz
ZipFile.write�s����w�	K��I�K�K�
K��=�	��P���
��!�!�(�G�48�4K�"�M�M���<�<�>�>�	6�"#�E���E�I��J�J�u�������(�&3��#�#�&*�&6��#��(�'4��$�$�'+�'9��$��h��%�%�
6��d�i�i��s�.C�.C�
6�t��"�3��f�5�5�5�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6����
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6����
6�
6�
6�
6�
6�
6s6�D�C>�2D�>D	�D�D	�D�D�Dc��t|t��r|�d��}t|t��s�t|t	jt	j����dd����}|j|_|j|_	|j
ddkrd|_|xjdzc_n
d	|_n|}|jstd
���|jrtd���|�||_|�||_	t|��|_|j5|�|d�
��5}|�|��ddd��n#1swxYwYddd��dS#1swxYwYdS)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_r�i�Ar-rZr�z?Can't write to ZIP archive while an open writing handle exists.r�)r�)r�r�r�rr�r�r?r�rGr�rNr�rGr�rUr6r�rTrMrn)r��zinfo_or_arcnamercr�rGr�r�s       r�writestrzZipFile.writestrs���d�C� � �	(��;�;�w�'�'�D��*�G�4�4�	%��%5�&*�n�T�Y�[�[�&A�&A�"�1�"�&E�G�G�G�E�"&�"2�E��#'�#5�E� ��~�b�!�S�(�(�&3��#��#�#�t�+�#�#�#�&1��#�#�$�E��w�	K��I�K�K�
K��=�	��Q���
��$�"/�E���$�#0�E� ��d�)�)���
�Z�	!�	!����5�s��+�+�
!�t��
�
�4� � � �
!�
!�
!�
!�
!�
!�
!�
!�
!�
!�
!����
!�
!�
!�
!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!����	!�	!�	!�	!�	!�	!s6� E2�8E�E2�E	�E2�!E	�"E2�2E6�9E6�c��t|t��r&|}|���std���n�t|t��ra|}|�d��s|dz
}t|��}d|_d|_d|zdzdz|_d|_	|xjdzc_ntd���|j5|jr|j
�|j��|j
���|_|jt&kr|xjt*zc_|�|��d|_|j�|��||j|j<|j
�|�d	����|j
���|_d
d
d
��d
S#1swxYwYd
S)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�r�r�r�r�r�r�r<rTr�rGrQr�rtr�r�r	r�r[r\r�r�r7r�rNrnr�)r��zinfo_or_directory_namer�r��directory_names     rr~z
ZipFile.mkdirAs���-�w�7�7�	<�+�E��<�<�>�>�
T� �!R�S�S�S�
T�
�/��
5�
5�	<�4�N�!�*�*�3�/�/�
&��#�%���N�+�+�E�"#�E���E�I�$+�d�N�f�#<��"C�E���E�O����4�'�����:�;�;�;�
�Z�	,�	,��~�
-�����T�^�,�,�,�"&�'�,�,�.�.�E���"�h�.�.����#:�:������U�#�#�#�"�D�O��M� � ��'�'�'�.3�D�O�E�N�+��G�M�M�%�*�*�5�1�1�2�2�2�!�W�\�\�^�^�D�N�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,�	,�	,s�C:G�G�Gc�.�|���dS)z2Call the "close()" method in case the user forgot.Nr�r�s r�__del__zZipFile.__del__ds���
�
�����rc��|j�dS|jrtd���	|jdvr`|jrY|j5|jr|j�|j��|�	��ddd��n#1swxYwY|j}d|_|�
|��dS#|j}d|_|�
|��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�)rGrUr�r�r�rTr�rQr��_write_end_recordr�rls  rrYz
ZipFile.closehs/���7�?��F��=�	Q��P�Q�Q�
Q�		��y�O�+�+���+��Z�-�-��~�5�����T�^�4�4�4��*�*�,�,�,�-�-�-�-�-�-�-�-�-�-�-����-�-�-�-�
��B��D�G��M�M�"���������B��D�G��M�M�"�������s.�B/�;A?�3B/�?B�B/�B�B/�/%Cc�R	�|jD�]�}|j}|ddz
dz|ddzz|dz}|ddz|d	dzz|ddzz}g}|jtks|jtkr9|�|j��|�|j��d
}d
}n|j}|j}|jtkr|�|j��d
}n|j}|j}	d}
|rQt|	d��}	tj
dd
t|��zzddt|��zg|�R�|	z}	t}
|j
tkrtt |
��}
n%|j
t"krtt$|
��}
t|
|j��}t|
|j��}|���\}
}tj
t,t.||j||j||j
|||j||t|
��t|	��t|j��d|j|j|��}|j�|��|j�|
��|j�|	��|j�|j�����|j� ��}t|j��}||j!z
}|j!}d}|tDkrd}n|tkrd}n
|tkrd}|r�|j#stI|dz���tj
tJtLddddd||||��}|j�|��tj
tNtPd|d��}|j�|��tS|d��}tS|d
��}tS|d
��}tj
tTtVdd||||t|j,���	�	}|j�|��|j�|j,��|j-dkr|j�.��|j�/��dS)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�rrr�r�r�r�r�r�rGrnrtr�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~sw���]�3	)�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�3����U�_�-�-�-����U�0�1�1�1�&�	� *�
�
�!�O�	� %� 3�
��"�[�0�0����U�0�1�1�1� *�
�
� %� 3�
���J��K��
,�)�*�d�;�;�
�#�[��C��E�
�
�N�*��q��U���|�-�&+�-�-�-�/9�:�
�,���"�i�/�/�!�-��=�=����$��0�0�!�,��<�<��!�+�u�/D�E�E�O� ��e�.B�C�C�N�"'�"<�"<�">�">��H�i��k�"2�"2�N�"'�"5����"+�U�-@�'�7�"'�)�]�I�"%�h�-�-��Z���#�e�m�BT�BT�"#�U�%8�%�:M�"/�1�1�G�
�G�M�M�'�"�"�"��G�M�M�(�#�#�#��G�M�M�*�%�%�%��G�M�M�%�-�(�(�(�(��w�|�|�~�~���4�=�)�)���T�^�+����
����-�-�-�*�N�N�
�[�
(�
(�7�N�N�
�;�
&�
&�5�N��	;��#�
F�"�>�#D�$E�F�F�F� �+�"�$6��B��A�q�,���]�,�,�K�
�G�M�M�+�&�&�&� �+�)�)�1�d�A�7�7�K�
�G�M�M�+�&�&�&��|�V�4�4�L��k�:�6�6�K��
�z�:�:�M���-�/?���<��(�-��T�]�9K�9K�M�M��	
��
�
�f������
�
�d�m�$�$�$��9�����G��������
�
�����rc��|jdksJ�|xjdzc_|js|js|���dSdSdS)Nrr!)r�r�rYrls  rr�zZipFile._fpclose�sd����!�#�#�#�#����A������	��(8�	��H�H�J�J�J�J�J�	�	�	�	rr�)r�N)F)NN)NNN)r�)%rrrrrGrlrr�r�rr�r�r)r+r1r5r9r=r�r��setterrJrMrKrardr�rsr_r\rnr�r~r�rYr�r�rrrrr�sx��������,
�B�(,�%�"%�:�$�#�^�:>�RV�^�^�^�^�^�@���������T-�T-�T-�l9�9�9����
����&�&�&�����������X��
�^�
�
��^�
�����
d�E�d�d�d�d�d�L(1�(1�(1�(1�T7�7�7�7�5�5�5�5�"����[��(�(�(�TF�F�F�.'+�04�6�6�6�6�D48�'!�'!�'!�'!�R!,�!,�!,�!,�F������,\�\�\�|����rrc�0�eZdZdZdeddfd�Zd
d�Zd	�ZdS)r
zDClass to create ZIP archives with Python library files and packages.r�Tr_c�R�t�|||||���||_dS)N)r�r?r�)rr��	_optimize)r�rWr�r?r��optimizes      rr�zPyZipFile.__init__�s5������t�$�K�$.�	�	0�	0�	0�!����rr�Nc�`�tj|��}|rL||��sA|jr8tj�|��rdnd}t|�d|�d���dStj�|��\}}tj�|���rtj�|d��}tj�|���r�|r|�d|��}n|}|jrtd|d	|��|�	|d
d�|��\}}	|jrtd|	��|�
||	��ttj|����}
|
�
d��|
D�]5}tj�||��}tj�|��\}
}tj�|��rVtj�tj�|d����r|�|||�
����|dkru|r%||��s|jrtd|z����|�	|d
d�|��\}}	|jrtd|	��|�
||	����7dS|jrtd|��ttj|����D]�}tj�||��}tj�|��\}
}|dkru|r%||��s|jrtd|z���q|�	|d
d�|��\}}	|jrtd|	��|�
||	����dS|dd�dkrt!d���|�	|d
d�|��\}}	|jrtd|	��|�
||	��dS)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�rW� 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�r
ror8�isfile�
_get_codenamernr�listdir�remove�splitext�writepyr<)r��pathname�basenamer��label�dirr��initnamerVr��dirlistrNr��root�exts               rr�zPyZipFile.writepy�s[���9�X�&�&���	�j�j��2�2�	��z�
I�"$�'�-�-��"9�"9�E���v���u�u�u�h�h�h�G�H�H�H��F��G�M�M�(�+�+�	��T�
�7�=�=��"�"�;	'��w�|�|�H�m�<�<�H��w�~�~�h�'�'�1
3��$�*2�(�(�D�D�9�H�H�#�H��:�I��-�x��x�H�H�H�!%�!3�!3�H�Q�r�T�N�H�!M�!M���w��:�-��(�G�,�,�,��
�
�5�'�*�*�*� ���H�!5�!5�6�6�����}�-�-�-� '�3�3�H��7�<�<��(�;�;�D� "�� 0� 0�� :� :�I�D�#��w�}�}�T�*�*�3��7�>�>�"�'�,�,�t�]�*K�*K�L�L�@� �L�L��x�4>�)�@�@�@������%�%�j�j��.>�.>�%�#�z�N� %�&E��&L� M� M� M�$�)-�);�);�D��2��J�<D�*F�*F���w��:�5�!�(�G�4�4�4��
�
�5�'�2�2�2��#3�3�(�:�C��7��B�B�B� &�r�z�(�';�';� <� <�3�3�H��7�<�<��(�;�;�D� "�� 0� 0�� :� :�I�D�#��e�|�|�%�%�j�j��.>�.>�%�#�z�N� %�&E��&L� M� M� M�$�)-�);�);�D��2��J�<D�*F�*F���w��:�5�!�(�G�4�4�4��
�
�5�'�2�2�2��3�3�����}��%�%�"�D�F�F�F�!�/�/���2����I�I�N�E�7��z�
.��m�W�-�-�-��J�J�u�g�&�&�&�&�&rc�8��d
�fd�	}|dz}|dz}tj�|d���}tj�|d���}tj�|d���}�jdk�r�tj�|��r:t	j|��jt	j|��jkr|x}	}
�ntj�|��r:t	j|��jt	j|��jkr|}
|}	�n�tj�|��r:t	j|��jt	j|��jkr|}
|}	�n^tj�|��r:t	j|��jt	j|��jkr|}
|}	�n||��r5tj
jd	kr|}
ntj
jdkr|}
n|}
|}	n�|x}
}	n��jd	kr|}
|}	nG|}	�jdkr|}
n7�jdkr|}
n)d
��j��}t|���tj�|
��r4t	j|
��jt	j|��jks||�j���s|x}
}	tj�|	��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).
        r_c����ddl}�jrtd|��	|�|d|���n,#|j$r}t|j��Yd}~dSd}~wwxYwdS)Nr�	CompilingT)�doraiser�F)�
py_compiler�r
�compile�PyCompileError�msg)rWr�r��errr�s    �r�_compilez)PyZipFile._get_codename.<locals>._compileEs���������z�
)��k�4�(�(�(�
��"�"�4���"�I�I�I�I���,�
�
�
��c�g�����u�u�u�u�u�����
�����4s�7�
A �A�A r�z.pycr�)�optimizationr!r"rz"invalid value for 'optimize': {!r})r�r�rg)�	importlib�util�cache_from_sourcer�r�r�r�r�r�r�rr��formatr�ro)
r�r�r�r��file_py�file_pyc�pycache_opt0�pycache_opt1�pycache_opt2r�rVr��archivenames
`            rr�zPyZipFile._get_codename>s���		�		�		�		�		�		��e�#���f�$�� �~�7�7��b�7�Q�Q�� �~�7�7��a�7�P�P�� �~�7�7��a�7�P�P���>�R�������x�(�(�!
.��'�(�#�#�,����0@�0@�0I�I�I�"*�*��%�%��'�.�.��.�.�
.��'�,�'�'�0�B�G�G�4D�4D�4M�M�M�%��"����'�.�.��.�.�
.��'�,�'�'�0�B�G�G�4D�4D�4M�M�M�%��"����'�.�.��.�.�
.��'�,�'�'�0�B�G�G�4D�4D�4M�M�M�%��"����8�G�$�$�	.��y�)�Q�.�.� ,�����+�q�0�0� ,��� ,��&�G�G�&-�-�E�G�G��~��"�"�$��"���"���>�Q�&�&�(�E�E��^�q�(�(�(�E�E�>�E�E�d�n�U�U�C�$�S�/�/�)��G�N�N�5�)�)�
.��G�E�N�N�+�r�w�w�/?�/?�/H�H�H��x��$�.�A�A�A�.�&-�-�E�G��g�m�m�G�,�,�Q�/���	<�%-�X�X�{�{�;�K��{�#�#r)r�N)rrrrrr�r�r�rrrr
r
�se������N�N�"%�:� �2�"�"�"�"�P'�P'�P'�P'�dP$�P$�P$�P$�P$rr
c�H�tjt|��dd��S)a2
    Given a path with elements separated by
    posixpath.sep, generate all parents of that path.

    >>> list(_parents('b/d'))
    ['b']
    >>> list(_parents('/b/d/'))
    ['/b']
    >>> list(_parents('b/d/f/'))
    ['b/d', 'b']
    >>> list(_parents('b'))
    []
    >>> list(_parents(''))
    []
    r!N)�	itertools�islice�	_ancestry)r�s r�_parentsr��s�� ��I�d�O�O�Q��5�5�5rc#��K�|�tj��}|r?|tjkr3|V�tj|��\}}|r|tjk�-dSdSdSdS)aR
    Given a path with elements separated by
    posixpath.sep, generate all elements of that path

    >>> list(_ancestry('b/d'))
    ['b/d', 'b']
    >>> list(_ancestry('/b/d/'))
    ['/b/d', '/b']
    >>> list(_ancestry('b/d/f/'))
    ['b/d/f', 'b/d', 'b']
    >>> list(_ancestry('b'))
    ['b']
    >>> list(_ancestry(''))
    []
    N)rh�	posixpathr�ro)r��tails  rr�r��s����� �;�;�y�}�%�%�D�
�+�4�9�=�(�(��
�
�
��_�T�*�*�
��d��+�4�9�=�(�(�(�(�+�+�+�+�(�(rc�P�tjt|��j|��S)zZ
    Return items in minuend not in subtrahend, retaining order
    with O(1) lookup.
    )r��filterfalse�set�__contains__)�minuend�
subtrahends  r�_differencer��s ��
� ��Z���!=�w�G�G�Grc�d��eZdZdZed���Z�fd�Zd�Zd�Z�fd�Z	e
d���Z�xZS)�CompleteDirszk
    A ZipFile subclass that ensures that implied directories
    are always included in the namelist.
    c��tj�tt|����}d�|D��}tt
||����S)Nc3�4K�|]}|tjzV��dSr�)r�r�)r&r
s  rrjz-CompleteDirs._implied_dirs.<locals>.<genexpr>�s)����6�6��1�y�}�$�6�6�6�6�6�6r)r��chain�
from_iterablerr��_deduper�)�names�parents�as_dirss   r�
_implied_dirszCompleteDirs._implied_dirs�sL���/�/�/��H�e�0D�0D�E�E��6�6�g�6�6�6���{�7�E�2�2�3�3�3rc���tt|�����}|t|�|����zSr�)r�r�r)rxr�)r�r�r�s  �rr)zCompleteDirs.namelist�s?����l�D�)�)�2�2�4�4���t�D�.�.�u�5�5�6�6�6�6rc�D�t|�����Sr�)r�r)r�s r�	_name_setzCompleteDirs._name_set�s���4�=�=�?�?�#�#�#rc�P�|���}|dz}||vo||v}|r|n|S)zx
        If the name represents a directory, return that name
        as a directory (with the trailing slash).
        r�)r�)r�r�r�r{�	dir_matchs     r�resolve_dirzCompleteDirs.resolve_dir�s?��
��� � ����*����%�:�'�U�*:�	�#�-�w�w��-rc����	t���|��S#t$r?|�d��r||���vr�t|���cYSwxYw)z6
        Supplement getinfo for implied dirs.
        r�r%)r�r9r7r�r�r)r�r�r�s  �rr9zCompleteDirs.getinfo�s{���	*��7�7�?�?�4�(�(�(���	*�	*�	*��=�=��%�%�
��T�^�^�5E�5E�)E�)E���D�)�)�)�)�)�)�	*���s� $�AA-�,A-c��t|t��r|St|t��s||��Sd|jvrt}||_|S)zl
        Given a source (filename or zipfile), return an
        appropriate CompleteDirs subclass.
        r�)r�r�rr�r�)r�r�s  r�makezCompleteDirs.make�s\���f�l�+�+�	��M��&�'�*�*�	��3�v�;�;���f�k�!�!��C�����
r)
rrrr�staticmethodr�r)r�r�r9r�r�r�r�s@rr�r��s����������
�4�4��\�4�
7�7�7�7�7�$�$�$�.�.�.�	*�	*�	*�	*�	*�����[�����rr�c�,��eZdZdZ�fd�Z�fd�Z�xZS)�
FastLookupzV
    ZipFile subclass to ensure implicit
    dirs exist and are resolved rapidly.
    c����tjt��5|jcddd��S#1swxYwYt	t
|�����|_|jSr�)�
contextlib�suppressr��_FastLookup__namesr�r�r)r�s �rr)zFastLookup.namelist	s����
�
 ��
0�
0�	 �	 ��<�	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 ��Z��.�.�7�7�9�9����|���/�3�3c����tjt��5|jcddd��S#1swxYwYt	t
|�����|_|jSr�)r�r�r��_FastLookup__lookupr�r�r�r�s �rr�zFastLookup._name_set	s����
�
 ��
0�
0�	!�	!��=�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!����	!�	!�	!�	!��j�$�/�/�9�9�;�;��
��}�r)rrrrr)r�r�r�s@rr�r�	s[���������
�������������rr�c�2�tj|d��||fS)Nr#)r��
text_encoding)�encoding�args�kwargss   r�_extract_text_encodingr	s��
��H�a�(�(�$��6�6rc��eZdZdZdZdd�Zddd�d�Zd	�Zed
���Z	ed���Z
ed���Zed
���Zed���Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZeZed���ZdS)ru,
    A pathlib-compatible interface for zip files.

    Consider a zip file with this structure::

        .
        ├── a.txt
        └── b
            ├── c.txt
            └── d
                └── e.txt

    >>> data = io.BytesIO()
    >>> zf = ZipFile(data, 'w')
    >>> zf.writestr('a.txt', 'content of a')
    >>> zf.writestr('b/c.txt', 'content of c')
    >>> zf.writestr('b/d/e.txt', 'content of e')
    >>> zf.filename = 'mem/abcde.zip'

    Path accepts the zipfile object itself or a filename

    >>> root = Path(zf)

    From there, several path operations are available.

    Directory iteration (including the zip file itself):

    >>> a, b = root.iterdir()
    >>> a
    Path('mem/abcde.zip', 'a.txt')
    >>> b
    Path('mem/abcde.zip', 'b/')

    name property:

    >>> b.name
    'b'

    join with divide operator:

    >>> c = b / 'c.txt'
    >>> c
    Path('mem/abcde.zip', 'b/c.txt')
    >>> c.name
    'c.txt'

    Read text:

    >>> c.read_text()
    'content of c'

    existence:

    >>> c.exists()
    True
    >>> (b / 'missing.txt').exists()
    False

    Coercion to string:

    >>> import os
    >>> str(c).replace(os.sep, posixpath.sep)
    'mem/abcde.zip/b/c.txt'

    At the root, ``name``, ``filename``, and ``parent``
    resolve to the zipfile. Note these attributes are not
    valid and will raise a ``ValueError`` if the zipfile
    has no filename.

    >>> root.name
    'abcde.zip'
    >>> str(root.filename).replace(os.sep, posixpath.sep)
    'mem/abcde.zip'
    >>> str(root.parent)
    'mem'
    z>{self.__class__.__name__}({self.root.filename!r}, {self.at!r})r�c�R�t�|��|_||_dS)aX
        Construct a Path from a ZipFile or filename.

        Note: When the source is an existing ZipFile object,
        its type (__class__) will be mutated to a
        specialized type. If the caller wishes to retain the
        original type, the caller should either create a
        separate ZipFile object or pass a filename.
        N)r�r�r��at)r�r�rs   rr�z
Path.__init__j	s"���O�O�D�)�)��	�����rr�Nrxc�l�|���rt|���|d}|���s|dkrt|���|j�|j||���}d|vr|s|rtd���|St|i|��\}}}tj
||g|�Ri|��S)z�
        Open this entry as text or binary following the semantics
        of ``pathlib.Path.open()`` by passing arguments through
        to io.TextIOWrapper().
        rr�rx�bz*encoding args invalid for binary operation)r��IsADirectoryErrorr|�FileNotFoundErrorr�rMrr�rr��
TextIOWrapper)r�r�rrr�zip_mode�streamrs        rrMz	Path.openw	s����;�;�=�=�	*�#�D�)�)�)���7���{�{�}�}�	*��S���#�D�)�)�)��������s��;�;���$�;�;��
O�v�
O� �!M�N�N�N��M�!7��!H��!H�!H���$������B�4�B�B�B�6�B�B�Brc�L�tj|jp|jj��Sr�)�pathlib�
PurePosixPathrr�rNr�s r�_basez
Path._base�	s���$�T�W�%B��	�0B�C�C�Crc�4�|���jSr�)rr�r�s rr�z	Path.name�	����z�z�|�|� � rc�4�|���jSr�)r�suffixr�s rrzPath.suffix�	s���z�z�|�|�"�"rc�4�|���jSr�)r�suffixesr�s rrz
Path.suffixes�	s���z�z�|�|�$�$rc�4�|���jSr�)r�stemr�s rrz	Path.stem�	rrc�n�tj|jj���|j��Sr�)rrr�rN�joinpathrr�s rrNz
Path.filename�	s'���|�D�I�.�/�/�8�8���A�A�Arc��t|i|��\}}}|jd|g|�Ri|��5}|���cddd��S#1swxYwYdS)Nr�)rrMrJ)r�rrr�strms     r�	read_textzPath.read_text�	s���!7��!H��!H�!H���$��
�T�Y�s�H�
6�t�
6�
6�
6�v�
6�
6�	�$��9�9�;�;�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A�A�Ac��|�d��5}|���cddd��S#1swxYwYdS)NrKrF)r�r"s  r�
read_byteszPath.read_bytes�	s~��
�Y�Y�t�_�_�	���9�9�;�;�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�7�;�;c��tj|j�d����|j�d��kS�Nr�)r�r{rrh)r�r�s  r�	_is_childzPath._is_child�	s4��� ������!4�!4�5�5������9L�9L�L�Lrc�8�|�|j|��Sr�)r�r�)r�rs  r�_nextz
Path._next�	s���~�~�d�i��,�,�,rc�F�|jp|j�d��Sr')rr�r�s rr�zPath.is_dir�	s!���7�{�3�d�g�.�.�s�3�3�3rc�T�|���o|���Sr�)r|r�r�s r�is_filezPath.is_file�	s ���{�{�}�}�2�T�[�[�]�]�!2�2rc�B�|j|j���vSr�)rr�r�r�s rr|zPath.exists�	s���w�$�)�-�-�/�/�/�/rc���|���std���t|j|j�����}t
|j|��S)NzCan't listdir a file)r�r�rr*r�r)�filterr()r��subss  r�iterdirzPath.iterdir�	sR���{�{�}�}�	5��3�4�4�4��4�:�t�y�1�1�3�3�4�4���d�n�d�+�+�+rc�J�tj|jj|j��Sr�)r�r8r�rNrr�s r�__str__zPath.__str__�	s���~�d�i�0�$�'�:�:�:rc�8�|j�|���S)Nr�)�_Path__reprr�r�s rr�z
Path.__repr__�	s���{�!�!�t�!�,�,�,rc��tj|jg|�R�}|�|j�|����Sr�)r�r8rr*r�r�)r��other�nexts   rr z
Path.joinpath�	s=���~�d�g�.��.�.�.���z�z�$�)�/�/��5�5�6�6�6rc��|js|jjStj|j�d����}|r|dz
}|�|��Sr')rrN�parentr�r{rhr*)r��	parent_ats  rr;zPath.parent�	sY���w�	(��=�'�'��%�d�g�n�n�S�&9�&9�:�:�	��	����I��z�z�)�$�$�$r)r�)r�)rrrrr6r�rMrr�r�rrrrNr#r%r(r*r�r-r|r2r4r�r �__truediv__r;rrrrr	s�������K�K�ZN�F�����C��C�C�C�C�C�(D�D�D��!�!��X�!��#�#��X�#��%�%��X�%��!�!��X�!��B�B��X�B����
���M�M�M�-�-�-�4�4�4�3�3�3�0�0�0�,�,�,�;�;�;�-�-�-�7�7�7��K�
�%�%��X�%�%�%rrc���ddl}d}|�|���}|�d���}|�dddd	�
��|�ddd
dd���|�ddddd���|�dddd�
��|�ddd�
��|�|��}|j}|j�z|j}t|d|���5}|���}ddd��n#1swxYwY|r"td�
|����td��dS|j�H|j}t|d|���5}|���ddd��dS#1swxYwYdS|j
�L|j
\}}	t|d|���5}|�|	��ddd��dS#1swxYwYdS|j��|r/td t j�!��t!jd"��|j�d��}
|j}�fd#��t|
d$��5}|D]�}t(j�|��}
|
s<t(j�t(j�|����}
|
d%t(jt(jfvrd%}
�|||
����	ddd��dS#1swxYwYdSdS)&Nrz3A simple command-line interface for zipfile module.)�descriptionT)�requiredz-lz--list�	<zipfile>zShow listing of a zipfile)�metavar�helpz-ez	--extractr")rAz<output_dir>zExtract zipfile into target dir)�nargsrBrCz-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	����tj�|��r|�||t��dStj�|��r�|r|�||��t
tj|����D]M}�|tj�||��tj�||�����LdSdSr�)	r�r�r�rnrr�rr�r8)r�r��zippath�nm�addToZips    �rrIzmain.<locals>.addToZip
s�����w�~�~�d�#�#�
P�����w��5�5�5�5�5�����t�$�$�
P��,��H�H�T�7�+�+�+� ���D�!1�!1�2�2�P�P�B��H�R��W�\�\�$��3�3�R�W�\�\�'�2�5N�5N�P�P�P�P�	
P�
P�P�Prr�r�)�argparse�ArgumentParser�add_mutually_exclusive_group�add_argument�
parse_argsr��testrr5r
r�rxr1rard�creater��stderr�exit�popr�r�r�r{ryrz)rrJr?�parser�grouprr�r��badfilery�zip_name�filesr�rGrIs              @r�mainrY�	s�����O�O�O�G�K�
�
$�
$��
$�
=�
=�F��/�/��/�>�>�E�	���t�X�{�7��9�9�9�	���t�[��<�=��?�?�?�
���t�Z�s�3�9��;�;�;�
���t�X�{�8��:�:�:�
���-�|�Q��S�S�S����T�"�"�D��%�H��y���i��
�S�#��
:�
:�
:�	#�b��j�j�l�l�G�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#��	T��B�I�I�'�R�R�S�S�S�
�n������	
��	��i��
�S�#��
:�
:�
:�	�b��K�K�M�M�M�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	�
��	!��l���V�
�S�#��
:�
:�
:�	"�b��M�M�&�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�	"�	"�
��	 ��	��C��z�
#�
#�
#�
#��H�Q�K�K�K��;�?�?�1�%�%�����	P�	P�	P�	P�	P��X�s�
#�
#�	,�r��
,�
,���'�*�*�4�0�0���F� �g�.�.�r�w���t�/D�/D�E�E�G��r�2�9�b�i�8�8�8� �G����T�7�+�+�+�+�

,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,�	,�	,�)
!�	 sI�.D�D�D�/F�F�F�G$�$G(�+G(� B
K;�;K?�K?�__main__r�)�r�binascii�importlib.utilr�r�r�r�r�rr�rSr�r�r�r�rr;r��ImportErrorr=r�__all__�	Exceptionrrrrr�r�rBrrrr	r�r�r�r�rrwrvr�rurYrZr[r\r]r^r_r{rrrrrr�_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_SIZErrr�_CD_DISK_NUMBER_START�_CD_INTERNAL_FILE_ATTRIBUTES�_CD_EXTERNAL_FILE_ATTRIBUTESrrSr[r�rPrQr�r�r�rLrM�_FH_EXTRACT_VERSION�_FH_EXTRACT_SYSTEMrR�_FH_COMPRESSION_METHOD�_FH_LAST_MOD_TIME�_FH_LAST_MOD_DATE�_FH_CRC�_FH_COMPRESSED_SIZE�_FH_UNCOMPRESSED_SIZErNrOrTrUrRrWrXrV�_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
rqrD�objectrr
r�rrr#r�r@rHrMrOrir�rtr�rr
r�r��dict�fromkeysr�r�r�r�rrrYrrrr�<module>r�s;����
��������	�	�	�	�����	�	�	�	�����
�
�
�
�����
�
�
�
�
�
�
�
�������������������K�K�K��J�E�E�������D��N�E�E�E�������J�J�J�J������
�C�C�C�������K�K�K�K�������D�D�D���������
	�	�	�	�	��	�	�	������9���� ���
���#�����
����	�
�����
��
������� �� ���!1�2�2������������
�	��������
�$�� �� ���!1�2�2���
����������
�������
��������������!��!������ ��
#�� �� ��
��"�� �� ���!1�2�2���
����� !��������
����������%��)��)�&�/�*C�D�D��"��"��"�6�?�#5�6�6��������������!"���������
�#�f�m�E�*�*�����*������ (�(�(�V:�:�:�z`�`�`�`�`�v�`�`�`�N
�	���� #�#�#�L"�"�"�"�"�"�"�"�.��������8��w���x���x���x�	�
�x���x�
��y���z���y���{���	�������������� �	�!�"��#��(N�N�N�&
�
�
�
� P�P�P�$%!�%!�%!�%!�%!�%!�%!�%!�P��������(F�F�F�F�F��"�F�F�F�R
P+�P+�P+�P+�P+�B�%�P+�P+�P+�hS�S�S�S�S�S�S�S�lk$�k$�k$�k$�k$��k$�k$�k$�\6�6�6�&+�+�+�,�-��/�H�H�H�9�9�9�9�9�7�9�9�9�x���������&7�7�7�7�
y%�y%�y%�y%�y%�y%�y%�y%�xC,�C,�C,�C,�L�z����D�F�F�F�F�F��s5�A�A�A�A"�"A,�+A,�0A5�5A?�>A?

Zerion Mini Shell 1.0