AlkantarClanX12

Your IP : 3.142.133.210


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/tarfile.cpython-312.opt-2.pyc

�

�Q�f֧����	dZdZdZddlmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZ	ddlZ	ddlZeeefZgd�ZdZdZed	zZd
ZdZdZdZd
ZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1e1Z2e e!e"e#e&e'e(e$e%e)e*e+fZ3e e!e(e+fZ4e)e*e+fZ5dZ6hd�Z7e8e8e8e9e9e9d �Z:ejvd!k(rd"Z<nejz�Z<d#�Z>d$�Z?d%�Z@d&e2fd'�ZAd(�ZBdedfd)�ZCd*�ZDGd+�d,eE�ZFGd-�d.eF�ZGGd/�d0eF�ZHGd1�d2eF�ZIGd3�d4eF�ZJGd5�d6eF�ZKGd7�d8eK�ZLGd9�d:eK�ZMGd;�d<eK�ZNGd=�d>eK�ZOGd?�d@eK�ZPGdA�dB�ZQGdC�dD�ZRGdE�dFeS�ZTGdG�dHeS�ZUGdI�dJej��ZWGdK�dLeF�ZXGdM�dNeX�ZYGdO�dPeX�ZZGdQ�dReX�Z[GdS�dTeX�Z\GdU�dVeX�Z]dddW�Z^dX�Z_dY�Z`dZ�Zae_e`ead[�ZbeS�Zcej�d\�ZeGd]�d^eS�ZfGd_�d`eS�Zgda�ZhegjZdb�Ziejdck(rei�yy#e$rdZY��wxYw#e$rdZY��wxYw)ez0.9.0u"Lars Gustäbel (lars@gustaebel.de)u4Gustavo Niemeyer, Niels Gustäbel, Richard Townsend.�)�openN)�TarFile�TarInfo�
is_tarfile�TarError�	ReadError�CompressionError�StreamError�ExtractError�HeaderError�ENCODING�USTAR_FORMAT�
GNU_FORMAT�
PAX_FORMAT�DEFAULT_FORMATr�fully_trusted_filter�data_filter�
tar_filter�FilterError�AbsoluteLinkError�OutsideDestinationError�SpecialFileError�AbsolutePathError�LinkOutsideDestinationError�i�sustar  sustar00�d��0�1�2�3�4�5�6�7�L�K�S�x�g�X��)�path�linkpath�size�mtime�uid�gid�uname�gname>r/r6r5r0)�atime�ctimer2r3r4r1�nt�utf-8c�x�	|�td��|j||�}|d||t|�z
tzzS)Nzmetadata cannot contain None)�
ValueError�encode�len�NUL)�s�length�encoding�errorss    �./opt/alt/python312/lib64/python3.12/tarfile.py�stnrE�sF����y��7�8�8�	����6�"�A��W�f�:��#�a�&��C�/�/�/�c�^�	|jd�}|dk7r|d|}|j||�S)Nr���)�find�decode)r@rBrC�ps    rD�ntsrL�s7���	���u�
�A��B�w�
�b�q�E���8�8�H�f�%�%rFc�8�	|ddvrMd}tt|�dz
�D]}|dz}|||dzz
}�|ddk(rdt|�dz
z|z
}|S	t|dd�}t|j	�xsd	d�}|S#t
$rt
d
��wxYw)Nr)��r-�rO��ascii�strict�0�invalid header)�ranger>rL�int�stripr<�InvalidHeaderError)r@�n�is   rD�ntir\�s����	��t�~��
���s�1�v��z�"�A�
�!�G�A�
��1�q�5��M�A�#�
�Q�4�5�=��#�a�&�1�*�%��)�*�A�
�H�	7��A�w��)�A��A�G�G�I�$��a�(�A�
�H���	7�$�%5�6�6�	7�s�+B�BrPc��	|}t|�}d|cxkrd|dz
zkr nntd|dz
|fzd�tz}|S|tk(rzd|dz
z|cxkrd|dz
zkrbntd	��|dk\r
t	dg�}nt	dg�}d|z|z}t|dz
�D]}|j
d|dz�|dz}�|Std	��)
NrrPr-z%0*orRrQrNrOzoverflow in number field)rW�bytesr?r�	bytearrayrV�insertr<)rZ�digits�format�
original_nr@r[s      rD�itnrd�s�����J��A��A��A�!��f�q�j�!�!��&�F�Q�J��?�*�G�4�s�:��
�H�
�:�	�3�6�A�:�#6�"6�!�"Q�c�f�q�j�>Q�"Q��3�4�4�
��6��5�'�"�A��5�'�"�A��v�
��!�A��v��z�"�A�
�H�H�Q��E�	�"�
�!�G�A�#�
�H��3�4�4rFc��	dttjd|��z}dttjd|��z}||fS)NrQ�
148B8x356B�
148b8x356b)�sum�struct�unpack_from)�buf�unsigned_chksum�
signed_chksums   rD�calc_chksumsrn�sL����C�� 2� 2�<�� E�F�F�O��#�f�0�0��s�C�D�D�M��M�)�)rFc�z�	|xsd}|dk(ry|�tj|||�yt||�\}}t|�D]:}|j	|�}t|�|kr|d��|j
|��<|dk7r8|j	|�}t|�|kr|d��|j
|�y)Ni@r�unexpected end of data)�shutil�copyfileobj�divmodrV�readr>�write)	�src�dstrA�	exception�bufsize�blocks�	remainder�brks	         rDrrrr�s�����"��G�
��{��
�~����3��W�-���v�w�/��F�I�
�6�]���h�h�w����s�8�g���4�5�5��	�	�#��	��A�~��h�h�y�!���s�8�i���4�5�5��	�	�#��
rFc��ttjdd�}|�!|j|d�j	|�}t|d��y)NrB�backslashreplace� )�end)�getattr�sys�stdoutr=rJ�print)r@rBs  rD�_safe_printr�s@���s�z�z�:�t�4�H���
�H�H�X�1�2�9�9�(�C��	�!��rFc��eZdZ	y)rN��__name__�
__module__�__qualname__�rFrDrrs���rFrc��eZdZ	y)rNr�r�rFrDrrs��/�rFrc��eZdZ	y)rNr�r�rFrDrrs��0�rFrc��eZdZ	y)r	Nr�r�rFrDr	r	s��8�rFr	c��eZdZ	y)r
Nr�r�rFrDr
r
s��G�rFr
c��eZdZ	y)rNr�r�rFrDrrs��+�rFrc��eZdZ	y)�EmptyHeaderErrorNr�r�rFrDr�r� s��&�rFr�c��eZdZ	y)�TruncatedHeaderErrorNr�r�rFrDr�r�#s��*�rFr�c��eZdZ	y)�EOFHeaderErrorNr�r�rFrDr�r�&s��,�rFr�c��eZdZ	y)rYNr�r�rFrDrYrY)s��(�rFrYc��eZdZ	y)�SubsequentHeaderErrorNr�r�rFrDr�r�,s��=�rFr�c�&�eZdZ	d�Zd�Zd�Zd�Zy)�
_LowLevelFilec��tjtjtjztjzd�|}ttd�r|tjz}tj||d�|_y)N��r�w�O_BINARYi�)	�os�O_RDONLY�O_WRONLY�O_CREAT�O_TRUNC�hasattrr�r�fd)�self�name�modes   rD�__init__z_LowLevelFile.__init__9sa��������r�z�z�)�B�J�J�6�
�����2�z�"��B�K�K��D��'�'�$��e�,��rFc�B�tj|j�y�N)r��closer��r�s rDr�z_LowLevelFile.closeBs��
������rFc�B�tj|j|�Sr�)r�rtr��r�r1s  rDrtz_LowLevelFile.readEs���w�w�t�w�w��%�%rFc�D�tj|j|�yr�)r�rur��r�r@s  rDruz_LowLevelFile.writeHs��
������!�rFN)r�r�r�r�r�rtrur�rFrDr�r�3s���
-��&�rFr�c�X�eZdZ	d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
dd	�Zd
�Zd�Z
d�Zy
)�_Streamc��	d|_|�t||�}d|_|dk(rt|�}|j�}|xsd|_||_||_||_||_d|_	d|_
d|_	|dk(r[	ddl}||_|jd�|_|d	k(r"|j"|_|j'�y|j)|�y|d
k(rI	ddl}|d	k(r(d|_|j/�|_t2|_y|j5|�|_y|dk(rN	ddl}	|d	k(r.d|_|	j9�|_|	j:|_y|	j=�|_y|dk7rtd|z��y#t$r
td�d�wxYw#t$r
td�d�wxYw#t$r
td
�d�wxYw#|js|jj?�d|_�xYw)NTF�*�rFr�gzzzlib module is not availabler��bz2�bz2 module is not available�xz�lzma module is not available�tar�unknown compression type %r) �_extfileobjr��_StreamProxy�getcomptyper�r��comptype�fileobjryrk�pos�closed�zlib�ImportErrorr	�crc32�crc�errorrx�
_init_read_gz�_init_write_gzr��dbuf�BZ2Decompressor�cmp�OSError�
BZ2Compressor�lzma�LZMADecompressor�	LZMAError�LZMACompressorr�)
r�r�r�r�r�ry�
compresslevelr�r�r�s
          rDr�z_Stream.__init__Ws ��	�����?�#�D�$�/�G�$�D���s�?�#�7�+�G��*�*�,�H��
���	���	� ��
����������������-	��4��U��!��	��:�:�c�?����3�;�%)�Z�Z�D�N��&�&�(��'�'�
�6��U�"�T���3�;� #�D�I�"�2�2�4�D�H�%,�D�N�"�0�0��?�D�H��T�!�U���3�;� #�D�I�#�4�4�6�D�H�%)�^�^�D�N�#�2�2�4�D�H��U�"�&�'D�x�'O�P�P�#��E#�U�*�+I�J�PT�T�U��#�T�*�+H�I�t�S�T��#�U�*�+I�J�PT�T�U��	��#�#����"�"�$��D�K��sy�;G�F�AG�	G�G�!F)�%,G�G�)G�/G�32G�&G�<G�F&�&G�)F?�?G�G�G�0Hc�X�t|d�r|js|j�yyy)Nr�)r�r�r�r�s rD�__del__z_Stream.__del__�s#���4��"�4�;�;��J�J�L�,7�"rFc�v�	|jj||jj|jj|jjd�|_t
jdttj���}|jd|zdz�|jjd�r|jdd|_tjj|j�|_|j|jj!dd�t"z�y)	Nr�<Ls�s��.gz���z
iso-8859-1�replace)r��compressobj�DEFLATED�	MAX_WBITS�
DEF_MEM_LEVELr�ri�packrW�time�_Stream__writer��endswithr�r/�basenamer=r?)r�r��	timestamps   rDr�z_Stream._init_write_gz�s���	��9�9�(�(��)-���);�);�*.�)�)�*=�*=�)=�)-���)@�)@�)*�	,���
�K�K��c�$�)�)�+�&6�7�	����(�9�4�{�B�C��9�9���e�$��	�	�#�2��D�I��G�G�$�$�T�Y�Y�/��	����T�Y�Y�%�%�l�I�>��D�ErFc�,�	|jdk(r+|jj||j�|_|xjt|�z
c_|jdk7r|jj|�}|j|�y)Nr�r�)	r�r�r�r�r�r>r��compressr�r�s  rDruz
_Stream.write�sj��	��=�=�D� ��y�y���q�$�(�(�3�D�H����C��F����=�=�E�!����!�!�!�$�A����Q�rFc�\�	|xj|z
c_t|j�|jkDrt|jj	|jd|j�|j|jd|_t|j�|jkDr�syyr�)rkr>ryr�rur�s  rD�__writez_Stream.__write�sw��	�	
���A�
���$�(�(�m�d�l�l�*��L�L���t�x�x�
����6�7��x�x����
�.�D�H��$�(�(�m�d�l�l�*rFc��	|jryd|_	|jdk(r<|jdk7r-|xj|jj�z
c_|jdk(r�|jr�|jj|j�d|_|jdk(ru|jjtjd|j��|jjtjd|jdz��|js|jj�yy#|js|jj�wwxYw)NTr�r�rFr�r�l��)r�r�r�rkr��flushr�rurir�r�r�r�r�r�s rDr�z
_Stream.close�s��	��;�;�����	%��y�y�C��D�M�M�U�$:����D�H�H�N�N�,�,���y�y�C��D�H�H����"�"�4�8�8�,�����=�=�D�(��L�L�&�&�v�{�{�4����'B�C��L�L�&�&�v�{�{�4����J�9N�'O�P��#�#����"�"�$�$��4�#�#����"�"�$�$�s�DE�)E>c��	|jj|jj�|_d|_|jd�dk7rt
d��|jd�dk7rtd��t|jd��}|jd�|d	zrIt|jd��d
t|jd��zz}|j|�|dzr	|jd�}|r	|tk(rn�|dzr	|jd�}|r	|tk(rn�|dzr|jd�yy)
NrFr.s��not a gzip filer-�zunsupported compression method��rQrP�)r��
decompressobjr�r�r��
_Stream__readrr	�ordrtr?)r��flag�xlenr@s    rDr�z_Stream._init_read_gz�s.��	��9�9�*�*�D�I�I�,?�,?�+?�@�����	��;�;�q�>�[�(��-�.�.��;�;�q�>�W�$�"�#C�D�D��4�;�;�q�>�"�����A���!�8��t�{�{�1�~�&��s�4�;�;�q�>�/B�)B�B�D��I�I�d�O��!�8���K�K��N���A��H����"�9���K�K��N���A��H����!�8��K�K��N�rFc��	|jSr�)r�r�s rD�tellz_Stream.tell�s��	��x�x�rFc��	||jz
dk\rnt||jz
|j�\}}t|�D]}|j	|j��|j	|�|jStd��)Nrz seeking backwards is not allowed)r�rsryrVrtr
)r�r�rzr{r[s     rD�seekz_Stream.seeksy��	�����>�Q�� &�s�T�X�X�~�t�|�|� D��F�I��6�]���	�	�$�,�,�'�#��I�I�i� ��x�x���@�A�ArFc�f�	|j|�}|xjt|�z
c_|Sr�)�_readr�r>)r�r1rks   rDrtz_Stream.read
s*��C��j�j�������C��H����
rFc�*�	|jdk(r|j|�St|j�}|jg}||kr�|jr|j}d|_n(|j
j
|j�}|snA	|jj|�}|j|�|t|�z
}||kr��dj|�}||d|_|d|S#|j$r}td�|�d}~wwxYw)Nr�rFzinvalid compressed data)r�r�r>r�rkr�rtryr��
decompressrxr�append�join)r�r1�c�trk�es      rDr�z
_Stream._reads��	��=�=�E�!��;�;�t�$�$���	�	�N��
�Y�Y�K���$�h��x�x��h�h������l�l�'�'����5����
B��h�h�)�)�#�.��
�H�H�S�M�
��S��M�A��$�h�
�H�H�Q�K���d�e�H��	���$�x���
�>�>�
B�� 9�:��A��
B�s�C2�2D�D
�
Dc�,�	t|j�}|jg}||krM|jj|j�}|sn%|j|�|t|�z
}||kr�Mdj
|�}||d|_|d|S)NrF)r>rkr�rtryrr)r�r1rrrks     rD�__readz_Stream.__read/s���	�
����M��
�X�X�J���$�h��,�,�#�#�D�L�L�1�C���
�H�H�S�M�
��S��M�A��$�h�
�H�H�Q�K���T�U�8�����$�x�rFN)r)r�r�r�r�r�r�rur�r�r�r�r�rtr�r�r�rFrDr�r�KsF��	�E�N�F�"�/�%�,�>�
���6rFr�c�&�eZdZ	d�Zd�Zd�Zd�Zy)r�c�Z�||_|jjt�|_yr�)r�rt�	BLOCKSIZErk)r�r�s  rDr�z_StreamProxy.__init__Es������<�<�$�$�Y�/��rFc�P�|jj|_|jSr�)r�rtrkr�s  rDrtz_StreamProxy.readIs���L�L�%�%��	��x�x�rFc��|jjd�ry|jdddk(r|jdddk(ry	|jjd
�ryy)
Ns�r�r�sBZhr��
s1AY&SYr�)s]�s�7zXZr�r�)rk�
startswithr�s rDr�z_StreamProxy.getcomptypeMsV���8�8����/��
�X�X�a��]�f�
$����!�B��9�)D��
�X�X�
 �
 �!C�
D��rFc�8�|jj�yr�)r�r�r�s rDr�z_StreamProxy.closeWs�������rFN)r�r�r�r�rtr�r�r�rFrDr�r�@s���0���rFr�c�f�eZdZ	dd�Zd�Zd�Zd�Zd�Zd�Ze	jfd�Zdd	�Zd
�Z
d�Zy)
�_FileInFileNc���||_||_||_d|_||_d|_|�d|fg}d|_g|_d}|j}|D]U\}}||kDr|jjd||df�|jjd|||z|f�||z
}||z}�W||jkr*|jjd||jdf�yy)NrFT)	r��offsetr1�positionr�r��	map_index�mapr)r�r�rr1r��	blockinfo�lastpos�realposs        rDr�z_FileInFile.__init__ds�����������	���
���	�������T���I����������+�+��%�L�F�D������������� >�?��H�H�O�O�T�6�6�D�=�'�B�C��t�O�G��t�m�G�&��T�Y�Y���H�H�O�O�U�G�T�Y�Y��=�>�rFc��yr�r�r�s rDr�z_FileInFile.flush}s��rFc��y�NTr�r�s rD�readablez_FileInFile.readable�s��rFc��y�NFr�r�s rD�writablez_FileInFile.writable�s��rFc�6�|jj�Sr�)r��seekabler�s rDr$z_FileInFile.seekable�s���|�|�$�$�&�&rFc��	|jSr�)rr�s rDr�z_FileInFile.tell�s��	��}�}�rFc�0�	|tjk(r1tt|d�|j�|_|j
S|tjk(rc|dkr*t|j
|zd�|_|j
St|j
|z|j�|_|j
S|tjk(r>tt|j|z|j�d�|_|j
Std��)NrzInvalid argument)	�io�SEEK_SET�min�maxr1r�SEEK_CUR�SEEK_ENDr<)r�r�whences   rDr�z_FileInFile.seek�s���	��R�[�[� ���H�a� 0�$�)�)�<�D�M��}�}���r�{�{�
"��!�|� #�D�M�M�H�$<�a� @��
��}�}��!$�D�M�M�H�$<�d�i�i� H��
�
�}�}��	�r�{�{�
"���D�I�I��$8�$�)�)� D�a�H�D�M��}�}���/�0�0rFc���	|�|j|jz
}n#t||j|jz
�}d}|dkD�r$	|j|j\}}}}||jcxkr|krnnn?|xjdz
c_|jt|j�k(rd|_�vt|||jz
�}|re|jj||j|z
z�|jj|�}t|�|k7rtd��||z
}n|t|zz
}||z}|xj|z
c_|dkDr��$|S)NrFrr-rp)r1rr)rrr>r�r�rtrr?)	r�r1rk�data�start�stoprrAr|s	         rDrtz_FileInFile.read�sG��	��<��9�9�t�}�}�,�D��t�T�Y�Y����6�7�D����Q�h��,0�H�H�T�^�^�,D�)��e�T�6��D�M�M�0�D�0���N�N�a�'�N��~�~��T�X�X��6�)*������t�d�m�m�3�4�F�����!�!�&�D�M�M�E�,A�"B�C��L�L�%�%�f�-���q�6�V�#�#�$<�=�=��q����s�V�|�#���F�N�D��M�M�V�#�M�'�Q�h�(�
rFc�h�|jt|��}||dt|�t|�Sr�)rtr>)r�r|rks   rD�readintoz_FileInFile.readinto�s,���i�i��A������)�3�s�8���3�x�rFc��d|_yr)r�r�s rDr�z_FileInFile.close�s	����rFr�)r�r�r�r�r�rr"r$r�r'r(r�rtr3r�r�rFrDrr^sB���
?�2
���'��
%'�K�K�� �>�
rFrc���eZdZ�fd�Z�xZS)�ExFileObjectc���t|j|j|j|j|j
�}t�|�|�yr�)rr��offset_datar1r��sparse�superr�)r��tarfile�tarinfor��	__class__s    �rDr�zExFileObject.__init__�s;����g�o�o�w�/B�/B����g�l�l�G�N�N�<��
����!rF�r�r�r�r��
__classcell__�r=s@rDr6r6�s
���"�"rFr6c��eZdZy)rNr�r�rFrDrr�s��rFrc���eZdZ�fd�Z�xZS)rc�N��||_t�|�	d|j�d��y)Nzmember z has an absolute path�r<r:r�r��r�r<r=s  �rDr�zAbsolutePathError.__init__�s&������
���7�7�<�<�"2�2G�H�IrFr>r@s@rDrr�s���J�JrFrc���eZdZ�fd�Z�xZS)rc�f��||_||_t�|�
|j�d|�d�dz�y)Nz would be extracted to �, � which is outside the destination�r<�_pathr:r�r��r�r<r/r=s   �rDr�z OutsideDestinationError.__init__�s;��������
�
���G�L�L�+�+B�4�(�"�M�=�>�	?rFr>r@s@rDrr��
���?�?rFrc���eZdZ�fd�Z�xZS)rc�L��||_t�|�	|j�d��y)Nz is a special filerDrEs  �rDr�zSpecialFileError.__init__�s$������
���G�L�L�+�+=�>�?rFr>r@s@rDrr�s���@�@rFrc���eZdZ�fd�Z�xZS)rc�L��||_t�|�	|j�d��y)Nz is a link to an absolute pathrDrEs  �rDr�zAbsoluteLinkError.__init__�s$������
���G�L�L�+�+I�J�KrFr>r@s@rDrr�s���L�LrFrc���eZdZ�fd�Z�xZS)rc�f��||_||_t�|�
|j�d|�d�dz�y)Nz would link to rHrIrJrLs   �rDr�z$LinkOutsideDestinationError.__init__�s:��������
�
���G�L�L�+�?�4�(�"�E�=�>�	?rFr>r@s@rDrr�rMrFrc��i}|j}tjj|�}|j	dtj
f�r1|jj
dtj
z�x}|d<tjj|�rt|��tjjtjj||��}tjj||g�|k7rt||��|j}|�y|dz}|r^|j�s|j�r|dzs|dz}|dz}n.|j�s|j!�rd}nt#|��||jk7r||d<|�rk|j$�d|d<|j&�d|d	<|j(�d|d
<|j*�d|d<|j�s|j!��rtjj|j,�rt/|��|j!�rItjj|tjj1|�|j,�}n*tjj||j,�}tjj|�}tjj||g�|k7rt3||��|S)N�/r�i��@i�����r�r3r4r5r6)r�r�r/�realpathr�sep�lstrip�isabsrr�
commonpathrr��isreg�islnk�isdir�issymrr3r4r5r6�linknamer�dirnamer)�member�	dest_path�for_data�	new_attrsr��target_pathr�s       rD�_get_filtered_attrsrh�s^���I��;�;�D���� � ��+�I�����R�V�V�}�%�#)�;�;�#5�#5�c�B�F�F�l�#C�C��y�� �	�w�w�}�}�T�� ��'�'��'�'�"�"�2�7�7�<�<�	�4�#@�A�K�	�w�w���;�	�2�3�y�@�%�f�k�:�:��;�;�D����e�|����|�|�~������e�|��F�N�D���
������6�<�<�>���'�v�.�.��6�;�;�� $�I�f����:�:�!�#�I�e���:�:�!�#�I�e���<�<�#�!%�I�g���<�<�#�!%�I�g���<�<�>�V�\�\�^��w�w�}�}�V�_�_�-�'��/�/��|�|�~� �g�g�l�l�9�+-�7�7�?�?�4�+@�+1�?�?�<��!�g�g�l�l�9�+1�?�?�<���'�'�*�*�;�7�K��w�w�!�!�;�	�":�;�y�H�1�&�+�F�F��rFc��|Sr�r�)rcrds  rDrr2s���MrFc�P�t||d�}|r|jdi|�ddi��S|S)NF�deepr��rhr��rcrdrfs   rDrr5s1��#�F�I�u�=�I���v�~�~�6�	�6��6�6��MrFc�P�t||d�}|r|jdi|�ddi��S|S)NTrkFr�rlrms   rDrr;s1��#�F�I�t�<�I���v�~�~�6�	�6��6�6��MrF)�
fully_trustedr�r/s([0-9]{1,20}) c�@�eZdZ	edSidd�dd�dd�dd�d	d
�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�d#d$�d%d$�d&d$��ZdTd'�Zed(��Zejd)��Zed*��Z	e	jd+��Z	d,�Z
eeeeeeeed-ed.�
d/�Zd0�Z
eed1fd2�Zd3�Zd4�Zd5�Zed6��Zd7�Zed8��Zed9��Zed:��Zed;��Zed<��Zed=��Zd>�Zd?�Zd@�Z dA�Z!dB�Z"dC�Z#dD�Z$dE�Z%dF�Z&dG�Z'dH�Z(dI�Z)dJ�Z*dK�Z+dL�Z,dM�Z-dN�Z.dO�Z/dP�Z0dQ�Z1dR�Z2y$)Urr�zName of the archive member.r�zPermission bits.r3z6User ID of the user who originally stored this member.r4z7Group ID of the user who originally stored this member.r1zSize in bytes.r2zTime of last modification.�chksumzHeader checksum.�typez�File type. type is usually one of these constants: REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE.razcName of the target file name, which is only present in TarInfo objects of type LNKTYPE and SYMTYPE.r5z
User name.r6zGroup name.�devmajorzDevice major number.�devminorzDevice minor number.rzThe tar header starts here.r8zThe file's data starts here.�pax_headerszMA dictionary containing key-value pairs of an associated pax extended header.r9zSparse member information.r;N�_sparse_structs�_link_targetc��	||_d|_d|_d|_d|_d|_d|_t|_d|_	d|_
d|_d|_d|_
d|_d|_d|_i|_y)Ni�rr�)r�r�r3r4r1r2rq�REGTYPErrrar5r6rsrtrr8r9ru�r�r�s  rDr�zTarInfo.__init__ts���	���	���	���������	���
������	���
���
���
���
���
������������rFc��	|jSr��r�r�s rDr/zTarInfo.path�s��2��y�y�rFc��||_yr�r|rzs  rDr/zTarInfo.path�s	����	rFc��	|jSr��rar�s rDr0zTarInfo.linkpath�s��:��}�}�rFc��||_yr�r)r�ras  rDr0zTarInfo.linkpath�s	�� ��
rFc�`�d|jj|jt|�fzS)Nz<%s %r at %#x>)r=r�r��idr�s rD�__repr__zTarInfo.__repr__�s&���4�>�>�#:�#:�4�9�9�R��X�"N�N�NrFT)
r�r2r�rar3r4r5r6rk�_KEEPc
��	|	rtj|�}ntj|�}||
ur||_||
ur||_||
ur||_||
ur||_||
ur||_||
ur||_||
ur||_||
ur||_	|Sr�)
�copy�deepcopyr�r2r�rar3r4r5r6)r�r�r2r�rar3r4r5r6rkr��results            rDr�zTarInfo.replace�s���	���]�]�4�(�F��Y�Y�t�_�F��u���F�K���� �F�L��u���F�K��5� �&�F�O��e���F�J��e���F�J���� �F�L���� �F�L��
rFc��	|j�d}n|jdz}|j||j|j|j|j
|j|j|j|j|j|j|jd�
}|dtk(r!|djd�s
|dxxdz
cc<|S)N�)
r�r�r3r4r1r2rqrrrar5r6rsrtrrr�rU)r�r�r3r4r1r2rqrrrar5r6rsrt�DIRTYPEr�)r�r��infos   rD�get_infozTarInfo.get_info�s���	��9�9���D��9�9�v�%�D��	�	���������	�	��
�
�����	�	��
�
��
�
��
�
��
�
��
�
�
�� ��<�7�"�4��<�+@�+@��+E���L�C��L��rF�surrogateescapec�0�	|j�}|j�D]\}}|��	td|z��|tk(r|j	|||�S|t
k(r|j
|||�S|tk(r|j||�Std��)Nz%s may not be Nonezinvalid format)	r��itemsr<r�create_ustar_headerr�create_gnu_headerr�create_pax_header)r�rbrBrCr�r��values       rD�tobufz
TarInfo.tobuf�s���	��}�}����:�:�<�K�D�%��}� �!5��!<�=�=�(��\�!��+�+�D�(�F�C�C�
�z�
!��)�)�$��&�A�A�
�z�
!��)�)�$��9�9��-�.�.rFc�.�	t|d<t|dj||��tkDrt	d��t|dj||��t
kDr|j
|d||�\|d<|d<|j|t||�S)N�magicrazlinkname is too longr��prefix)	�POSIX_MAGICr>r=�LENGTH_LINKr<�LENGTH_NAME�_posix_split_name�_create_headerr)r�r�rBrCs    rDr�zTarInfo.create_ustar_header�s���	�#��W�
��t�J��&�&�x��8�9�K�G��3�4�4��t�F�|�"�"�8�V�4�5��C�+/�+A�+A�$�v�,�PX�Z`�+a�(�D��N�D��L��"�"�4��x��H�HrFc�\�	t|d<d}t|dj||��tkDr||j	|dt
||�z
}t|dj||��tkDr||j	|dt||�z
}||j|t||�zS)Nr�rFrar�)
�	GNU_MAGICr>r=r��_create_gnu_long_header�GNUTYPE_LONGLINKr��GNUTYPE_LONGNAMEr�r)r�r�rBrCrks     rDr�zTarInfo.create_gnu_header�s���	�!��W�
����t�J��&�&�x��8�9�K�G��4�/�/��Z�0@�BR�T\�^d�e�e�C��t�F�|�"�"�8�V�4�5��C��4�/�/��V��>N�PX�Z`�a�a�C��T�(�(��z�8�V�L�L�LrFc�^�	t|d<|jj�}ddtfddtfddfD];\}}}||vr�	||jdd	�t||�|kDs�4||||<�=d
D]e\}}d}||}	t|	t�}
|
rt|	�n|	}d|cxkrd
|dz
zks
nd||<d}n	|
r|||<d}|s�S||vs�Xt|	�||<�g|r|j|t|�}nd}||j|tdd�zS#t$r||||<Y��wxYw)Nr�r�r/rar0)r5r5� )r6r6r�rRrS))r3rP)r4rP)r1�)r2r�FrrPr-TrFr�)r�rur�r�r�r=�UnicodeEncodeErrorr>�
isinstance�float�round�str�_create_pax_generic_header�XHDTYPEr�r)
r�r�rBrur��hnamerAra�	needs_pax�val�val_is_float�val_intrks
             rDr�zTarInfo.create_pax_headers���	�$��W�
��&�&�+�+�-��
���-�
�J��/T�&�(>�$@��D�%����#��
��T�
�!�!�'�8�4�
�4��:���'�%)�$�Z��E�"�!$@�(R�L�D�&��I��t�*�C�%�c�5�1�L�$0�e�C�j�c�G���3�!���
�"3�3���T�
� �	��%��T�
� �	��T��4�$'��H��D�!�%R�*��1�1�+�w��Q�C��C��T�(�(��|�W�i�P�P�P��G&�
�%)�$�Z��E�"��
�s�D�D,�+D,c�2�	|j|td�S)Nr:)r��XGLTYPE)�clsrus  rD�create_pax_global_headerz TarInfo.create_pax_global_header?s��	��-�-�k�7�G�L�LrFc�T�	|jd�}tdt|��D]t}dj|d|�}dj||d�}t|j	||��t
ks�Nt|j	||��tks�q||fStd��)NrUr-zname is too long)�splitrVr>rr=�
LENGTH_PREFIXr�r<)r�r�rBrC�
componentsr[r�s       rDr�zTarInfo._posix_split_nameEs���	��Z�Z��_�
��q�#�j�/�*�A��X�X�j��!�n�-�F��8�8�J�q�r�N�+�D��6�=�=��6�2�3�}�D�����H�f�5�6�+�E���t�|��+��/�0�0rFc�j�	|jd�ttfv}|r;t|jdd�d|�}t|jdd�d|�}nt	dd||�}t	dd||�}|jdt
�}|�t
d��t	|jdd�d	||�t|jd
d�dzd|�t|jdd�d|�t|jd
d�d|�t|jdd�d|�t|jdd�d|�d|t	|jdd�d	||�|jdt�t	|jdd�d||�t	|jdd�d||�||t	|jdd�d||�g}tjdtzdj|��}	t|	td�d}
|	ddtd|
zd�z|	ddz}	|	S)NrrrsrrPrtr�zTarInfo.type must not be Noner�rr�r�r3r4r1r�r2s        rar�r5r�r6r�rz%dsrFi����z%06orRi����)�get�CHRTYPE�BLKTYPErdrEryr<r�rir�rrrnr^)r�rbrBrC�has_device_fieldsrsrt�filetype�partsrkrqs           rDr�zTarInfo._create_headerUs��	�!�H�H�V�,��'�0B�B����4�8�8�J��2�A�v�>�H��4�8�8�J��2�A�v�>�H��2�q�(�F�3�H��2�q�(�F�3�H��8�8�F�G�,�����<�=�=�
������$�c�8�V�<�������#�f�,�a��8�������"�A�v�.�������"�A�v�.�������#�R��0������!�$�b�&�1��������R�(�#�x��@��H�H�W�k�*������"�%�r�8�V�<������"�%�r�8�V�<��������2�&��X�v�>�
��$�k�k�%�)�+�S�X�X�e�_�=���c�9�*�+�.�/��2���%�4�j�5��F�!2�G�<�<�s�4�5�z�I���
rFc�p�	tt|�t�\}}|dkDr|t|z
tzz
}|S)Nr)rsr>rr?)�payloadrzr{s   rD�_create_payloadzTarInfo._create_payloads>��	�#�3�w�<��;���	��q�=��	�I�-��4�4�G��rFc���	|j||�tz}i}d|d<||d<t|�|d<t|d<|j	|t
||�|j
|�zS)Nz
././@LongLinkr�rrr1r�)r=r?r>r�r�rr�)r�r�rrrBrCr�s      rDr�zTarInfo._create_gnu_long_header�sy��	��{�{�8�V�,�s�2����&��V����V���4�y��V��!��W�
��!�!�$��h��G��#�#�D�)�*�	*rFc��	d}|j�D]\}}	|jdd��d}|r|dz
}|j�D]�\}}|jd�}|r|j|d�}n|jd�}t|�t|�zdz}d	x}	}
	|tt	|
��z}	|	|
k(rn|	}
� |tt	|
�d
�dz|zdz|zd
zz
}��i}d|d<||d<t|�|d<t|d<|j|td
d�|j|�zS#t$rd}Y��wxYw)NFr:rSTrFs21 hdrcharset=BINARY
r�rrrR� �=�
z././@PaxHeaderr�rrr1r�r�)
r�r=r�r>r�r^r�r�rr�)r�rurrrB�binary�keywordr��records�lrZrKr�s            rDr�z"TarInfo._create_pax_generic_header�s���	���)�/�/�1�N�G�U�
����W�h�/�2�����0�0�G�)�/�/�1�N�G�U��n�n�W�-�G�����X�/@�A�����W�-���G��s�5�z�)�A�-�A��I�A�����C��F��O����6����	�

�u�S��V�W�-��4�w�>��E��M�PU�U�U�G�!2�(��'��V����V���7�|��V��#��W�
��!�!�$��g�y�I��#�#�G�,�-�	-��I&�
����
�s�D:�:E
�	E
c�n�	t|�dk(rtd��t|�tk7rtd��|j	t
�tk(rt
d��t|dd�}|t|�vrtd��|�}t|dd||�|_t|dd	�|_t|d	d
�|_
t|d
d�|_t|dd�|_t|dd�|_||_|dd
|_t|d
d||�|_t|dd||�|_t|dd||�|_t|dd�|_t|dd�|_t|dd||�}|j$t0k(r&|jj3d�rt4|_|j$t6k(rxd}g}t9d�D]@}		t|||dz�}
t||dz|dz�}|j=|
|f�|dz
}�Bt?|d�}t|dd�}
|||
f|_ |jC�r |jjEd�|_|r)|j$tFvr|dz|jz|_|S#t:$rY��wxYw)Nrzempty headerztruncated headerzend of file header��zbad checksumr�l�t�|��ii	i)iIiQiYi�rUi�r�r��i�i�i�)$r>r�rr��countr?r�r\rnrYrLr�r�r3r4r1r2rqrrrar5r6rsrt�AREGTYPEr�r��GNUTYPE_SPARSErVr<r�boolrvr_�rstrip�	GNU_TYPES)r�rkrBrCrq�objr�r��structsr[r�numbytes�
isextended�origsizes              rD�frombufzTarInfo.frombuf�s���	��s�8�q�=�"�>�2�2��s�8�y� �&�'9�:�:��9�9�S�>�Y�&� �!5�6�6��S��S�\�"����c�*�*�$�^�4�4��e���s�1�S�z�8�V�4����s�3�s�|�$����c�#�c�l�#����c�#�c�l�#����s�3�s�|�$�����C���%��	���
��s�3�<����3�s�3�<��6�:�����C���h��7��	���C���h��7��	��3�s�3�<�(����3�s�3�<�(����S��S�\�8�V�4���8�8�x��C�H�H�$5�$5�c�$:��C�H�
�8�8�~�%��C��G��1�X��� ��S��r��!2�3�F�"�3�s�R�x��b��#9�:�H������1�2��r�	����c�#�h��J��3�s�3�<�(�H�#*�J��"A�C���9�9�;��x�x���s�+�C�H��c�h�h�i�/���|�c�h�h�.�C�H��
��"����s�%%J'�'	J4�3J4c��	|jjt�}|j||j|j
�}|jj
�tz
|_|j|�Sr�)	r�rtrr�rBrCr�r�_proc_member)r�r;rkr�s    rD�fromtarfilezTarInfo.fromtarfilesc��	��o�o�"�"�9�-���k�k�#�w�/�/����@���_�_�)�)�+�i�7��
�����(�(rFc��	|jttfvr|j|�S|jtk(r|j|�S|jtttfvr|j|�S|j|�Sr�)rrr�r��
_proc_gnulongr��_proc_sparser�r��SOLARIS_XHDTYPE�	_proc_pax�
_proc_builtin)r�r;s  rDr�zTarInfo._proc_member!s}��	��9�9�)�+;�<�<��%�%�g�.�.�
�Y�Y�.�
(��$�$�W�-�-�
�Y�Y�7�G�_�=�
=��>�>�'�*�*��%�%�g�.�.rFc��	|jj�|_|j}|j�s|jt
vr||j
|j�z
}||_|j|j|j|j�|j�r |jjd�|_|S�NrU)r�r�r8r]rr�SUPPORTED_TYPES�_blockr1r�_apply_pax_inforurBrCr_r�r�)r�r;rs   rDr�zTarInfo._proc_builtin.s���	�#�?�?�/�/�1����!�!���:�:�<�4�9�9�O�;��d�k�k�$�)�)�,�,�F����	
���W�0�0�'�2B�2B�G�N�N�S��:�:�<��	�	�(�(��-�D�I��rFc�H�	|jj|j|j��}	|j	|�}|j|_|jtk(r't||j|j�|_n9|jtk(r&t||j|j�|_|j#�r |jj%d�|_|S#t
$r}t
t|��d�d}~wwxYwr�)r�rtr�r1r�rr�r�rrrr�rLrBrCr�r�rar_�removesuffix)r�r;rk�nextrs     rDr�zTarInfo._proc_gnulongDs���	��o�o�"�"�4�;�;�t�y�y�#9�:��	:��#�#�G�,�D��k�k����9�9�(�(��C��!1�!1�7�>�>�B�D�I�
�Y�Y�*�
*���W�%5�%5�w�~�~�F�D�M��:�:�<��	�	�.�.�s�3�D�I����!�	:�'��A��/�T�9��	:�s�C>�>	D!�D�D!c��	|j\}}}|`|r�|jjt�}d}t	d�D]D}	t|||dz�}t||dz|dz�}	|r|	r|j||	f�|dz
}�Ft|d�}|r��||_	|jj�|_|j|j|j�z|_||_
|S#t$rY�ywxYw)Nr�r�r�i�)rvr�rtrrVr\r<rr�r9r�r8r�r1r)
r�r;r�r�r�rkr�r[rr�s
          rDr�zTarInfo._proc_sparse_s��	�)-�(<�(<�%���X�� ���/�/�&�&�y�1�C��C��2�Y��� ��S��r��!2�3�F�"�3�s�R�x��b��#9�:�H��h��N�N�F�H�#5�6��r�	����c�#�h��J�����"�?�?�/�/�1����)�)�D�K�K��	�	�,B�B�����	����"����s�%C6�6	D�Dc��	|jj|j|j��}|jt
k(r
|j}n|jj�}d}d}g}t|�|kD�r||dk7�rtj||�x}std��	t|jd��}|dkrtd��||zt|�kDrtd��|jd�|zdz
}	||j!d�dz|	}
|
j#d�\}}}
|r
|dk7s||	dk7rtd��|j%|||
f�|dk(r|�|
dk(r
|j&}nd	}||z
}t|�|kDr
||dk7r��|�d	}|D]x\}}}
|j)|d	d	|j*�}|t,vr)|j)|
||j&|j*�}n|j)|
d	d	|j*�}|||<�z	|j/|�}d
|vr|j7||�nRd|vr|j9||�n;|j;d�d
k(r'|j;d�dk(r|j=|||�|jt>t@fvr�|jC||j&|j*�|jD|_"d|vrS|jF}|jI�s|jtJvr||j|j�z
}||_"|S#t$rtd��wxYw#t0$r}t3t5|��d�d}~wwxYw)NrrUr-�r�rs
hdrcharsetsBINARYr:�GNU.sparse.map�GNU.sparse.sizezGNU.sparse.major�1zGNU.sparse.minorrTr1)&r�rtr�r1rrr�rur�r>�_header_length_prefix_re�matchrYrW�groupr<r0r��	partitionrrB�_decode_pax_fieldrC�PAX_NAME_FIELDSr�rr�r��_proc_gnusparse_01�_proc_gnusparse_00r��_proc_gnusparse_10r�r�r�rr8r]r�)r�r;rkrur�rB�raw_headersr�rA�header_value_end_offset�keyword_and_value�raw_keyword�equals�	raw_valuer�r�r�rrs                   rDr�zTarInfo._proc_pax{s���	��o�o�"�"�4�;�;�t�y�y�#9�:��
�9�9���!�-�-�K�!�-�-�2�2�4�K��������#�h��n��S��T�!1�5�;�;�C��E�E�E�E�(�)9�:�:�
;��U�[�[��^�,��
��z�(�)9�:�:��V�|�c�#�h�&�(�)9�:�:�&+�k�k�!�n�v�&=��&A�#� #�E�I�I�a�L�1�$4�5L� M��->�-H�-H��-N�*�K����&�D�.�C�8O�4P�TX�4X�(�)9�:�:������Y�?�@��m�+��0@��	�)�&�/�/�H�&�H��6�M�C�M�#�h��n��S��T�!1�R���H�/:�*�F�K���,�,�[�'�7��N�N�$�G��/�)��.�.�y�(�G�DT�DT����(���.�.�y�'�7����(��$)�K�� �#/:�(	:��#�#�G�,�D�
�{�*��#�#�D�+�6�
�+�
-��#�#�D�+�6�
�_�_�/�
0�C�
7�K�O�O�L^�<_�cf�<f��#�#�D�+�w�?��9�9��/�2�2�� � ��g�.>�.>����O��+�+�D�K���$��)�)���:�:�<�4�9�9�O�#C��d�k�k�$�)�)�4�4�F�!'������y�
;�(�)9�:�:�
;��|�	:�'��A��/�T�9��	:�s$�2M�#M�M�	N�'M<�<Nc�t�	g}g}|D]d\}}}|dk(r*	|jt|j����6|dk(s�<	|jt|j����ftt
||��|_y#t$rt	d��wxYw#t$rt	d��wxYw)NsGNU.sparse.offsetrUsGNU.sparse.numbytes)rrWrJr<rY�list�zipr9)r�r�r�offsetsr��_r�r�s        rDrzTarInfo._proc_gnusparse_00�s���	�����!,��A�w���.�.�?��N�N�3�u�|�|�~�#6�7��2�2�?��O�O�C�����$7�8�"-��3�w��1�2����"�?�,�-=�>�>�?��"�?�,�-=�>�>�?�s�(B
�(B"�
B�"B7c	��	|djd�D�cgc]
}t|���}}tt|ddd�|ddd���|_ycc}w)Nr��,r.r-)r�rWr
rr9)r�r�ru�xr9s     rDrzTarInfo._proc_gnusparse_01s]��	�"-�.>�"?�"E�"E�c�"J�K�"J�Q�#�a�&�"J��K��3�v�c��c�{�F�1�4�a�4�L�9�:����Ls�Ac	��	d}g}|jjt�}|jdd�\}}t	|�}t|�|dzkrgd|vr"||jjt�z
}|jdd�\}}|j
t	|��t|�|dzkr�g|jj�|_tt|ddd�|ddd���|_y)Nr�r-r.)r�rtrr�rWr>rr�r8r
rr9)r�r�rur;�fieldsr9rk�numbers        rDrzTarInfo._proc_gnusparse_10s���	������o�o�"�"�9�-���i�i��q�)�����V����&�k�F�Q�J�&��C���w���+�+�I�6�6���)�)�E�1�-�K�F�C��M�M�#�f�+�&�	�&�k�F�Q�J�&�
#�?�?�/�/�1����3�v�c��c�{�F�1�4�a�4�L�9�:��rFc��	|j�D]�\}}|dk(rt|d|��|dk(rt|dt|���5|dk(rt|dt|���Q|tvs�Z|tvr	t	||�}|dk(r|j
d�}t|||���|j�|_y#t
$rd}Y�HwxYw)NzGNU.sparse.namer/r�r1zGNU.sparse.realsizerrU)	r��setattrrW�
PAX_FIELDS�PAX_NUMBER_FIELDSr<r�r�ru)r�rurBrCr�r�s      rDr�zTarInfo._apply_pax_infos���	�*�/�/�1�N�G�U��+�+���f�e�,��-�-���f�c�%�j�1��1�1���f�c�%�j�1��J�&��/�/�"� 1�'� :�5� A���f�$�!�L�L��-�E���g�u�-�2�"'�+�+�-����
&�"� !��"�s�5B>�>C�Cc�l�		|j|d�S#t$r|j||�cYSwxYw)NrS)rJ�UnicodeDecodeError)r�r�rB�fallback_encoding�fallback_errorss     rDr�zTarInfo._decode_pax_field5sA��	�	D��<�<��(�3�3��!�	D��<�<� 1�?�C�C�	D�s��3�3c�J�	t|t�\}}|r|dz
}|tzS)Nr-)rsr)r�r�rzr{s    rDr�zTarInfo._block=s1��	�#�5�)�4���	���a�K�F��	�!�!rFc�(�	|jtvSr�)rr�
REGULAR_TYPESr�s rDr]z
TarInfo.isregFs��>��y�y�M�)�)rFc�$�	|j�Sr�)r]r�s rD�isfilezTarInfo.isfileJs��>��z�z�|�rFc�*�	|jtk(Sr�)rrr�r�s rDr_z
TarInfo.isdirN���+��y�y�G�#�#rFc�*�	|jtk(Sr�)rr�SYMTYPEr�s rDr`z
TarInfo.issymRs��/��y�y�G�#�#rFc�*�	|jtk(Sr�)rr�LNKTYPEr�s rDr^z
TarInfo.islnkVr"rFc�*�	|jtk(Sr�)rrr�r�s rD�ischrz
TarInfo.ischrZs��2��y�y�G�#�#rFc�*�	|jtk(Sr�)rrr�r�s rD�isblkz
TarInfo.isblk^s��.��y�y�G�#�#rFc�*�	|jtk(Sr�)rr�FIFOTYPEr�s rD�isfifozTarInfo.isfifobs��&��y�y�H�$�$rFc��|jduSr�)r9r�s rD�issparsezTarInfo.issparsefs���{�{�$�&�&rFc�>�	|jtttfvSr�)rrr�r�r,r�s rD�isdevz
TarInfo.isdevis��M��y�y�W�g�x�8�8�8rFr�)r�)3r�r�r��dict�	__slots__r��propertyr/�setterr0r�r�r�r�rr
r�r�r�r��classmethodr�r��staticmethodr�r�r�r�r�r�r�r�r�r�r�rrrr�r�r�r]r r_r`r^r(r*r-r/r1r�rFrDrrQs�����
�,�
�!�
�G�
�H�	
�
 �
�-�

�$�
�>�
�F�
��
��
�*�
� *�!
�"/�#
�$5�%
�&9�'
�*.�+
�,�-
�.�/
�0�1
�I�6�0����
�[�[���������_�_�!��!�O��%�e�e��u�E�����8�8*�H�EV�/�"I�M�8Q�t�M��M�
� �'��'�R�����*��*� �0-��0-�d�<��<�|�)��)�(/��,�6�8w�r3�(;�;� .�.D�"�*��$�$�$�$�$�%�'�9rFrc��eZdZ	dZdZdZdZeZe	Z
dZeZ
eZdZ				d7d�Zedddefd��Zed8d��Zed9d	��Zed9d
��Zed:d��Zdd
ddd�Zd�Zd�Zd�Zd�Zd;d�Zd<dd�d�Zd=dd�d�Z d>d�Z!d�Z"d?ddd�d�Z#d@ddd�d�Z$d�Z%d �Z&d!�Z'd"�Z(d#�Z)		dAd$�Z*d%�Z+d&�Z,d'�Z-d(�Z.d)�Z/d*�Z0d+�Z1d,�Z2d-�Z3d.�Z4dBd/�Z5d0�Z6d>d1�Z7d2�Z8d3�Z9d4�Z:d5�Z;d6�Z<y)CrrFr-Nr�c���	ddddd�}||vrtd��||_|||_|sZ|jdk(r-tjj|�sd|_d|_t
||j�}d	|_n^|�8t|d
�r,t|jttf�r|j}t|d�r|j|_d|_|rtjj|�nd|_
||_|�||_|�||_|�||_|�||_|�||_|	|_|
�|jt*k(r|
|_ni|_|�||_|�||_|
|_d	|_g|_d	|_|jj;�|_i|_	|jd
k(rd|_ |jC�|_ |jdk(r^	|jjE|j<�	|j jG|�}|j6jI|��]|jdvr�d|_|j,rm|j jQ|j,jS��}|jjU|�|xj<tW|�z
c_yyy#tJ$r(|jjE|j<�Y��tL$r}tOt|��d�d}~wwxYw#|js|jjY�d|_�xYw)N�rbzr+b�wb�xb�r��ar�r�!mode must be 'r', 'a', 'w' or 'x'r>r�Fr�r�Tr��r>r�r)-r<r��_moder�r/�exists�	bltn_openr�r�r�r�r�r^�abspathr�rbr<�dereference�ignore_zerosrBrCrru�debug�
errorlevel�copybufsizer��members�_loadedr�r�inodes�firstmemberr�r�r�rr�rrr�r�rur>r�)r�r�r�r�rbr<rErFrBrCrurGrHrI�modesrrks                 rDr�zTarFile.__init__�s��	���T��=���u���@�A�A���	��4�[��
���y�y�C�������t�(<���	�!��
���d�j�j�1�G�$�D������&�!9��7�<�<�#�u��6��|�|���w��'�$�\�\��
�#�D��-1�B�G�G�O�O�D�)�t��	������ �D�K���"�D�L��"�*�D���#� ,�D����$�D�M�����"�t�{�{�j�'@�*�D��!�D�����D�J��!�(�D�O�'�������������l�l�'�'�)������	��y�y�C��#'�� �#'�9�9�;�� ��y�y�C����L�L�%�%�d�k�k�2�:�"&�,�,�":�":�4�"@�����+�+�G�4�	��y�y�O�+�#����#�#��,�,�?�?��@P�@P�@U�@U�@W�X�C��L�L�&�&�s�+��K�K�3�s�8�+�K�$�,��
*�����)�)�$�+�+�6��&�:�'��A��/�T�9��:��	��#�#����"�"�$��D�K��s>�?A L<� 6K'�BL<�'.L9�L<�L9�L4�4L9�9L<�<0M,c����	|s
|std��|dvrz�fd�}g}t�j|��D]:}t��j|�}	|�|j	�}
	|	|d|fi|��cSdj|�}td	|����d
|vrb|jd
d�\}
}|
xsd}
|xsd}|�jvrt��j|�}	nt
d
|z��|	||
|fi|��Sd|vrg|jdd�\}
}|
xsd}
|xsd}|
dvrtd��|jdd�}t||
||||�}	�||
|fi|��}d|_|S|dvr�j|||fi|��Std��#t
tf$r5}|jd|�d|���|�|j
�Yd}~���d}~wwxYw#|j��xYw)Nznothing to open)r��r:*c�(���j|dk(S)N�taropen)�	OPEN_METH)r�r�s �rD�not_compressedz$TarFile.open.<locals>.not_compressed#s����}�}�X�.�)�;�;rF)�keyr�z	- method z: �
z'file could not be opened successfully:
�:r-r�r��|r�zmode must be 'r' or 'w'r��	Fr@zundiscernible mode)r<�sortedrSr�r�rr	rr�rr��popr�r�r�rR)r�r�r�r�ry�kwargsrT�
error_msgsr��func�	saved_posr�error_msgs_summary�filemoder��streamrs`                rDrzTarFile.open�s:���!	�F�G��.�/�/��<��
<��J�"�3�=�=�n�E���s�C�M�M�(�$;�<���&� '����I����c�7�=�f�=�=�F�"&���:�!6���F�GY�FZ�[�\�\�
�D�[�!%���C��!3��H�h���3�H��(�5�H��3�=�=�(��s�C�M�M�(�$;�<��&�'D�x�'O�P�P���h��:�6�:�:�
�D�[�!%���C��!3��H�h���3�H��(�5�H��z�)� �!:�;�;�"�J�J���:�M��T�8�X�w��*�,�F�
���h��9�&�9��"�A�M��H�
�_�
$��3�;�;�t�T�7�=�f�=�=��-�.�.��W"�#3�4���%�%�	�(��2�a�U�&C�D��*����Y�/���	��D
������s$�#
F�
G�G	�*G�G	�Gc�8�	|dvrtd��||||fi|��S)Nr=r?)r<)r�r�r�r�r\s     rDrRzTarFile.taropenYs0��	��+�+��@�A�A��4��w�1�&�1�1rFc��	|dvrtd��	ddlm}	|||dz||�}	|j|||fi|��}d	|_	|S#t$r
t	d�d�wxYw#t
$r}|�|dk(rt
d�|��d}~wwxYw#t
$r'}|j�|dk(rt
d�|��d}~w|j��xYw)
N�r�r�r�mode must be 'r', 'w' or 'x'r)�GzipFilezgzip module is not availabler|r�r�F)
r<�gziprgr�r	r�rrRr�r�)	r�r�r�r�r�r\rgrrs	         rD�gzopenzTarFile.gzopenas���	���&��;�<�<�	M�%�	��t�T�C�Z���H�G�		�����D�$��:�6�:�A���
����+�	M�"�#A�B��L�	M��
�	��"�t�s�{�� 1�2��9���	���	��M�M�O��s�{�� 1�2��9���	��M�M�O��s9�A�A�B�A�	B�(A<�<B�	C�
"B/�/Cc�R�	|dvrtd��	ddlm}||xs|||��}	|j
|||fi|��}d	|_
|S#t$r
t	d�d�wxYw#ttf$r'}|j�|dk(rtd�|��d}~w|j��xYw)
Nrerfr)�BZ2Filer�)r�r�znot a bzip2 fileF)r<r�rkr�r	rRr��EOFErrorr�rr�)	r�r�r�r�r�r\rkrrs	         rD�bz2openzTarFile.bz2open�s���	���&��;�<�<�	L�#��'�/�T�4�}�M��		�����D�$��:�6�:�A���
����!�	L�"�#@�A�t�K�	L����"�	��M�M�O��s�{�� 2�3��:���	��M�M�O��s"�A�A�A�B&�."B�B&c�N�	|dvrtd��	ddlm}m}||xs|||��}	|j|||fi|��}d	|_
|S#t$r
td�d�wxYw#|tf$r'}	|j�|dk(rtd�|	��d}	~	w|j��xYw)
Nrerfr)�LZMAFiler�r�)�presetr�znot an lzma fileF)r<r�ror�r�r	rRrlr�rr�)
r�r�r�r�rpr\ror�rrs
          rD�xzopenzTarFile.xzopen�s���	���&��;�<�<�	M�0��7�?�d�D��@��		�����D�$��:�6�:�A���
����!�	M�"�#A�B��L�	M���8�$�	��M�M�O��s�{�� 2�3��:���	��M�M�O��s"�A�A!�A�!B$�,"B�B$rRrirmrq)r�r�r�r�c��	|jryd|_	|jdvr�|jjtt
dzz�|xjt
dzz
c_t|jt�\}}|dkDr)|jjtt|z
z�|js|jj�yy#|js|jj�wwxYw)NTr@r.r)r�r�r�rur?rrrs�
RECORDSIZEr�r�)r�rzr{s   rDr�z
TarFile.close�s���	��;�;�����	%��y�y�O�+����"�"�3�)�a�-�#8�9����	�A�
�.��%+�4�;�;�
�$C�!��	��q�=��L�L�&�&�s�j�9�.D�'E�F��#�#����"�"�$�$��4�#�#����"�"�$�$�s�BC�)Dc�h�	|j|jd��}|�td|z��|S)NrUzfilename %r not found)�
_getmemberr��KeyError)r�r�r<s   rD�	getmemberzTarFile.getmember�s;��	�
�/�/�$�+�+�c�"2�3���?��2�T�9�:�:��rFc�t�	|j�|js|j�|jSr�)�_checkrK�_loadrJr�s rD�
getmemberszTarFile.getmembers�s,��	�	
���
��|�|��J�J�L��|�|�rFc�^�	|j�D�cgc]}|j��c}Scc}wr�)r{r�)r�r<s  rD�getnameszTarFile.getnames�s.��	�-1�O�O�,=�>�,=�����,=�>�>��>s�*c�0�	|jd�|�|j}|�|}tjj	|�\}}|jtjd�}|jd�}|j�}||_	|�8|jstj|�}n9tj|�}n#tj|j��}d}|j}tj |�r�|j"|j$f}	|jsE|j&dkDr6|	|j(vr(||j(|	k7rt*}
|j(|	}n�t,}
|	dr�||j(|	<n�tj.|�rt0}
n�tj2|�rt4}
njtj6|�rt8}
tj:|�}n9tj<|�rt>}
ntj@|�rtB}
ny||_||_"|jF|_$|jJ|_&|
t,k(r|jN|_(nd|_(|jR|_*|
|_+||_,tZr(	t[j\|jH�d|_/tbr(	tcjd|jL�d|_3|
t>tBfvrhtitd�rXtitd�rHtjj|jl�|_7tjp|jl�|_9|S#t`$rY��wxYw#t`$rY��wxYw)N�awxrUr�r-r�major�minor):ryr�r�r/�
splitdriver�rYrZr<r;rE�lstat�stat�fstat�fileno�st_mode�S_ISREG�st_ino�st_dev�st_nlinkrLr&ry�S_ISDIRr��S_ISFIFOr,�S_ISLNKr$�readlink�S_ISCHRr��S_ISBLKr�r��st_uidr3�st_gidr4�st_sizer1�st_mtimer2rrra�pwd�getpwuidr5rv�grp�getgrgidr6r�r��st_rdevrsr�rt)r�r��arcnamer��drvr<�statresra�stmd�inoderrs           rD�
gettarinfozTarFile.gettarinfo�s���	�	
���E�����<�<�D�
�?��G��w�w�)�)�'�2���W��/�/�"�&�&�#�.���.�.��%���,�,�.������?��#�#��(�(�4�.���'�'�$�-���h�h�w�~�~�/�0�G��������<�<����^�^�W�^�^�4�E��#�#��(8�(8�1�(<��T�[�[�(�W����E�8J�-J����;�;�u�-������8�)0�D�K�K��&�
�\�\�$�
��D�
�]�]�4�
 ��D�
�\�\�$�
��D��{�{�4�(�H�
�\�\�$�
��D�
�\�\�$�
��D���������n�n����n�n����7�?�"�?�?�G�L��G�L��(�(��
����#����
� #���W�[�[� 9�!� <��
��
� #���W�[�[� 9�!� <��
��G�W�%�%��r�7�#���G�(<�#%�8�8�G�O�O�#<�� �#%�8�8�G�O�O�#<�� �����
��
��
�
��
�s$�-'M:�'N	�:	N�N�		N�N)rJc��	|j�|�|}|D�]�}|�r&|j�td�n(ttj|j��t|j
xs|j�d|jxs|j���|j�s|j�r(tdd|j|jfzz�ntd|jz�|j�td�n.tdtj |j�ddz�t|j"|j%�rdnd	z�|rP|j'�rtd
|j(z�|j+�rtd|j(z�t-����y)Nz
??????????rUz%10sz%d,%dz%10dz????-??-?? ??:??:??z%d-%02d-%02d %02d:%02d:%02dr�r�z-> zlink to )ryr�r�r�rar5r3r6r4r(r*rsrtr1r2r��	localtimer�r_r`rar^r�)r��verboserJr<s    rDr
zTarFile.listXsk��	�
	
���
��?��G��G���<�<�'���-���
�
�g�l�l� ;�<��w�}�}�'C����'C�'.�}�}�'C����'C�E�F��=�=�?�g�m�m�o���$��(8�(8�'�:J�:J�'K�K�!M�N� ����� 5�6��=�=�(�� 5�6�� =�"&�.�.����"?���"C�!D�E�
����w�}�}���B�G�H���=�=�?����(8�(8� 8�9��=�=�?��
�W�-=�-=� =�>��G�5rF��filterc�d�	|jd�|�|}|j�Btjj	|�|jk(r|jdd|z�y|jd|�|j
||�}|�|jdd|z�y|� ||�}|�|jdd|z�y|j�r(t|d�5}|j||�ddd�y|j�r�|j|�|ruttj|��D]S}|jtjj||�tjj||�||���Uyy|j|�y#1swYyxYw)	Nrr.ztarfile: Skipped %rr-ztarfile: Unsupported type %r�tarfile: Excluded %rr:r�)ryr�r�r/rD�_dbgr�r]rC�addfiler_rZ�listdir�addr)r�r�r��	recursiver�r<�fs       rDr�zTarFile.add~sv��	�	
���E���?��G��9�9� �R�W�W�_�_�T�%:�d�i�i�%G��I�I�a�.��5�6���	�	�!�T���/�/�$��0���?��I�I�a�7�$�>�?�����W�o�G����	�	�!�3�d�:�;���=�=�?��4��&�!����W�a�(�'�&��]�]�_��L�L��!����
�
�4� 0�1�A��H�H�R�W�W�\�\�$��2�B�G�G�L�L��!�4L�%�f��6�2��
�L�L��!�'�&�s�F&�&F/c��	|jd�tj|�}|j|j|j|j
�}|jj|�|xjt|�z
c_|j}|��t||j|j|��t|jt�\}}|dkDr.|jjtt|z
z�|dz
}|xj|tzz
c_|j j#|�y)Nr)ryrr-)ryr�r�rbrBrCr�rurr>rIrrr1rsrr?rJr)r�r<r�rkryrzr{s       rDr�zTarFile.addfile�s���	�
	
���E���)�)�G�$���m�m�D�K�K�������D�������3�����s�3�x���� � ���������w�|�|�W�M� &�w�|�|�Y� ?��F�I��1�}����"�"�3�)�i�*?�#@�A��!����K�K�6�I�-�-�K������G�$rFc��|�M|j}|�"tjdtd��tSt|t�rtd��|St|�r|S	t|S#t$rtd|�d��d�wxYw)Nz�Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.r)�
stacklevelzrString names are not supported for TarFile.extraction_filter. Use a function such as tarfile.data_filter directly.zfilter z
 not found)�extraction_filter�warnings�warn�DeprecationWarningrr�r��	TypeError�callable�_NAMED_FILTERSrvr<)r�r�s  rD�_get_filter_functionzTarFile._get_filter_function�s����>��+�+�F��~��
�
�J�'�1�	6�
,�+��&�#�&��6�7�7��M��F���M�	G�!�&�)�)���	G��w�v�j�
�;�<�$�F�	G�s�A'�'B)�
numeric_ownerr�c�B�	g}|j|�}|�|}|D]]}|j|||�}|��|j�r|j|�|j	|||j�|���_|jd�d��|D]e}tjj||j�}		|j||	|��|j||	�|j||	��gy#t$r}
|j|
�Yd}
~
��d}
~
wwxYw)N��	set_attrsr�c��|jSr�r|)r>s rD�<lambda>z$TarFile.extractall.<locals>.<lambda>	s��q�v�vrFT)rU�reverse)r�)r��_get_extract_tarinfor_r�_extract_one�sortr�r/rr��chown�utime�chmodr�_handle_nonfatal_error)r�r/rJr�r��directories�filter_functionrcr<�dirpathrs           rD�
extractallzTarFile.extractall�s��	����3�3�F�;���?��G��F��/�/����N�G�����}�}���"�"�7�+����g�t�7�=�=�?�7J�,9�
�
;��	���-�t��<�#�G��g�g�l�l�4����6�G�
/��
�
�7�G�=�
�I��
�
�7�G�,��
�
�7�G�,�#�� �
/��+�+�A�.�.��
/�s�?8C:�:	D�D�Dc�|�	|j|�}|j|||�}|�|j||||�yyr�)r�r�r�)r�rcr/r�r�r�r�r<s        rD�extractzTarFile.extract	sL��	��3�3�F�;���+�+�F�O�T�J�������g�t�Y�
�F�rFc���	t|t�r|j|�}n|}|}	|||�}|� |jdd|jz�y|j�rDtj|�}tjj||j�|_|S#ttf$r}|j|�Yd}~��d}~wt$r}|j|�Yd}~��d}~wwxYw)Nr.r�)r�r�rwr�r�_handle_fatal_errorrr�r�r�r^r�r�r/rrarw)r�rcr�r/r<�
unfilteredrs       rDr�zTarFile._get_extract_tarinfo!	s���N��f�c�"��n�n�V�,�G��G��
�	+�%�g�t�4�G�
�?��I�I�a�/�*�/�/�A�B���=�=�?��i�i��(�G�#%�7�7�<�<��g�6F�6F�#G�G� ������%�	(��$�$�Q�'�'���	+��'�'��*�*��	+�s#�	B*�*C6�9C�C6�C1�1C6c�6�	|jd�	|j|tjj	||j
�||��y#t$r}|j|�Yd}~yd}~wt$r}|j|�Yd}~yd}~wwxYw)Nr�r�)
ry�_extract_memberr�r/rr�r�r�rr�)r�r<r/r�r�rs      rDr�zTarFile._extract_one8	s���3����C��	+�� � ��"�'�'�,�,�t�W�\�\�*J�+4�/<�
!�
>���	(��$�$�Q�'�'���	+��'�'��*�*��	+�s#�=A�	B�A1�1B�=B�Bc�P�	|jdkDr�|jdd|z�y)Nr-�tarfile: %s)rHr��r�rs  rDr�zTarFile._handle_nonfatal_errorE	s'��K��?�?�Q����I�I�a���*�+rFc�N�	|jdkDr�t|t�rY|j� |j	dd|j
z�y|j	dd|j
�d|j���y|j	ddt
|�j�d|���y)Nrr-r�z	tarfile: r)rHr�r��filenamer��strerrorrrr�r�s  rDr�zTarFile._handle_fatal_errorL	sw��?��?�?�Q���
��7�
#��z�z�!��	�	�!�]�Q�Z�Z�7�8��	�	�!����Q�Z�Z�H�I��I�I�a�T�!�W�-=�-=�q�A�BrFc��	|jd�t|t�r|j|�}n|}|j	�s|j
tvr|j||�S|j�s|j�rEt|jt�rtd��|j|j|��Sy)Nr�z'cannot extract (sym)link as file object)ryr�r�rwr]rrr��
fileobjectr^r`r�r�r
�extractfile�_find_link_target)r�rcr<s   rDr�zTarFile.extractfileX	s���	�	
���C���f�c�"��n�n�V�,�G��G��=�=�?�g�l�l�/�A��?�?�4��1�1�
�]�]�_��
�
���$�,�,��0�"�"K�L�L��'�'��(>�(>�w�(G�H�H�rFc��	|jd�}|jdtj�}tjj|�}|r4tjj
|�stj|�|j�s|j�r,|jd|j�d|j���n|jd|j�|j�r|j||�n�|j�r|j!||�n�|j#�r|j%||�n�|j'�s|j)�r|j+||�nj|j�s|j�r|j-||�n7|j.t0vr|j3||�n|j||�|rI|j5|||�|j�s%|j7||�|j9||�yyy)NrUr-z -> )r�r�r�rYr/rbrB�makedirsr^r`r�r�rar]�makefiler_�makedirr-�makefifor(r*�makedev�makelinkrrr��makeunknownr�r�r�)r�r<�
targetpathr�r��	upperdirss      rDr�zTarFile._extract_memberx	s���	� �&�&�s�+�
��'�'��R�V�V�4�
��G�G�O�O�J�/�	��R�W�W�^�^�I�6�
�K�K�	�"��=�=�?�g�m�m�o��I�I�a�w�|�|�W�5E�5E�F�G��I�I�a����&��=�=�?��M�M�'�:�.�
�]�]�_��L�L��*�-�
�^�^�
��M�M�'�:�.�
�]�]�_��
�
���L�L��*�-�
�]�]�_��
�
���M�M�'�:�.�
�\�\��
0����W�j�1��M�M�'�:�.���J�J�w�
�M�:��=�=�?��
�
�7�J�/��
�
�7�J�/�#�rFc���		|j�tj|�ytj|d�y#t$r#tjj|�s�YywxYw)Ni�)r�r��mkdir�FileExistsErrorr/r_�r�r<r�s   rDr�zTarFile.makedir�	sY��	�
	��|�|�#�����$�����U�+���	��7�7�=�=��,��-�	�s�!<�<�)A(�'A(c	���	|j}|j|j�|j}t	|d�5}|j
�d|j
D])\}}|j|�t
|||t|��+|j|j�|j�nt
|||jt|�ddd�y#1swYyxYw)Nr;)
r�r�r8rIrCr9rrrr1�truncate)r�r<r��sourcery�targetrr1s        rDr�zTarFile.makefile�	s���	��������G�'�'�(��"�"��
�z�4�
(�F��~�~�)�$+�N�N�L�F�D��K�K��'�����i��I�%3����G�L�L�)����!��F�F�G�L�L�)�W�M�)�
(�
(�s
�BC�C!c�h�	|j||�|jdd|jz�y)Nr-z9tarfile: Unknown file type %r, extracted as regular file.)r�r�rrr�s   rDr�zTarFile.makeunknown�	s8��	�	
�
�
�g�z�*��	�	�!�2�4;�L�L�A�	BrFc�f�	ttd�rtj|�ytd��)N�mkfifozfifo not supported by system)r�r�r�rr�s   rDr�zTarFile.makefifo�	s)��	��2�x� ��I�I�j�!��=�>�>rFc�h�	ttd�rttd�std��|j}|�d}|j	�r|t
jz}n|t
jz}tj||tj|j|j��y)N�mknodr�z'special devices not supported by systemrW)r�r�rr�r*r��S_IFBLK�S_IFCHRr�r�rsrt)r�r<r�r�s    rDr�zTarFile.makedev�	s���	��r�7�#�7�2�y�+A��H�I�I��|�|���<��D��=�=�?��D�L�L� �D��D�L�L� �D�
����T����G�,�,�g�.>�.>�?�	ArFc�<�		|j�rUtjj|�rtj|�tj
|j|�ytjj|j�r!tj|j|�y|j|j|�|�y#t$r>	|j|j|�|�Yy#t$r
td�d�wxYwwxYw)Nz%unable to resolve link inside archive)r`r�r/�lexists�unlink�symlinkrarBrw�linkr�r��symlink_exceptionrvrr�s   rDr�zTarFile.makelink�	s���	�	V��}�}���7�7�?�?�:�.��I�I�j�)��
�
�7�+�+�Z�8��7�7�>�>�'�"6�"6�7��G�G�G�0�0�*�=��(�(��)?�)?��)H�)3�5�� �	V�
V��$�$�T�%;�%;�G�%D�%/�1���
V�"�#J�K�QU�U�
V��		V�s+�A$C�(A	C�2!C�	D�!D�D�Dc��	ttd�r�tj�dk(r�|j}|j}|sj	t
r.|jr"tj|j�d}	tr.|jr"tj|j�d}|�d}|�d}	|j�r(ttd�rtj|||�ytj|||�yyy#t$rY��wxYw#t$rY�uwxYw#t$r}t!d�|�d}~wwxYw)N�geteuidrr.rH�lchownzcould not change owner)r�r�r�r4r3r�r6�getgrnamrvr�r5�getpwnamr`r�r�r�r)r�r<r�r��g�urs       rDr�z
TarFile.chown
s��	�
�2�y�!�b�j�j�l�a�&7����A����A� ���w�}�}��L�L����7��:����w�}�}��L�L����7��:���y����y���
D��=�=�?�w�r�8�'<��I�I�j�!�Q�/��H�H�Z��A�.�/'8�!�� �����
 ������
D�"�#;�<�!�C��
D�sB�4D�94D�67D&�.D&�	D�D�	D#�"D#�&	E�/D;�;Ec��	|j�y	tj||j�y#t$r}t	d�|�d}~wwxYw)Nzcould not change mode)r�r�r�r�r)r�r<r�rs    rDr�z
TarFile.chmod$
sI��	��<�<���	?��H�H�Z����.���	?��6�7�Q�>��	?�s� 1�	A�A�Ac��	|j}|�yttd�sy	tj|||f�y#t$r}td�|�d}~wwxYw)Nr�z"could not change modification time)r2r�r�r�r�r)r�r<r�r2rs     rDr�z
TarFile.utime.
s]��	��
�
���=���r�7�#��	L��H�H�Z�%���0���	L��C�D�!�K��	L�s�<�	A�A�Ac�N�	|jd�|j�|j}d|_|S|j|jj	�k7r^|jdk(ry|jj|jdz
�|jj
d�std��d}		|jj|�}	|�|j0j3|�|Sd|_|S#t$rU}|jr?|jdd|j|fz�|xjtz
c_Yd}~��Yd}~��d}~wt$rz}|jr?|jdd|j|fz�|xjtz
c_Yd}~��|jdk(rtt|��d�Yd}~��d}~wt $r|jdk(rtd�d�Y��-t"$r/}|jdk(rtt|��d�Yd}~��_d}~wt$$r}tt|��d�d}~wt&$r@}	ddl}t+||j,�rtd	|���d�|�#t.$r|�wxYwd}~wwxYw)
N�rarr-rpTr.z0x%X: %sz
empty filezzlib error: )ryrMrr�r�r�rtrr<r�r�rFr�rrYr�r�r�r��	Exceptionr�r�r�r�rJrrK)r��mr<rr�s     rDr�zTarFile.next<
sW��	�	
���D�����'�� � �A�#�D���H��;�;�$�,�,�+�+�-�-��{�{�a����L�L���d�k�k�A�o�.��<�<�$�$�Q�'�� 8�9�9����
��,�,�2�2�4�8��<
����L�L����(��� �D�L����I"�
��$�$��I�I�a��t�{�{�A�.>�!>�?��K�K�9�,�K��%��&�
6��$�$��I�I�a��t�{�{�A�.>�!>�?��K�K�9�,�K���[�[�A�%�#�C��F�+��5�&��#�
<��;�;�!�#�#�L�1�t�;�$�'�
6��;�;�!�#�#�C��F�+��5�$��(�
2���A��'�T�1���
���!�!�T�Z�Z�0�'�,�q�c�(:�;��E����"���G���
�sb�=D�	J$�
AE�J$�&AG�1$G�'J$�J$�
$H7�7J$�I�J$�%+J�J�J�J$c��	|j�}d}|�	|j|�}|d|}|rtjj|�}t
|�D]a}|r|j|jk(rd}�!|r*tjj|j�}n|j}||k(s�_|cS|rt|��y#t$rd}Y��wxYw)NFT)	r{�indexr<r�r/�normpath�reversedrr�)	r�r�r<�	normalizerJ�skippingr	rc�member_names	         rDruzTarFile._getmember}
s���	��/�/�#������
*��
�
�g�.��"�&�5�/����7�7�#�#�D�)�D��w�'�F���>�>�V�]�]�2�$�H��� �g�g�.�.�v�{�{�;��$�k�k���{�"��
�(���W�%�%���1�
 � ��
 �s�C�C�Cc�X�	|j��	|j���d|_yr)r�rKr�s rDrzz
TarFile._load�
s-��	��i�i�k�%���i�i�k�%���rFc��	|jr"td|jjz��|�'|j|vrtd|jz��yy)Nz%s is closedzbad operation for mode %r)r�r�r=r�r�)r�r�s  rDryzTarFile._check�
sX��	��;�;��.�4�>�>�+B�+B�B�C�C����	�	�� 5��5��	�	�A�B�B�!6�rFc�.�	|j�rQdjtdtjj|j�|jf��}d}n|j}|}|j||d��}|�td|z��|S)NrUT)r<rzlinkname %r not found)
r`rr�r�r/rbr�rarurv)r�r<ra�limitrcs     rDr�zTarFile._find_link_target�
s���	��=�=�?��x�x��t�b�g�g�o�o�g�l�l�.K�W�M]�M]�-^� _�`�H��E��'�'�H��E�����5�D��I���>��2�X�=�>�>��
rFc#�TK�	|jr|jEd{���yd}|j�|j�}|dz
}|��	|t	|j�kr|j|}n'|js|j�}|s	d|_yy|dz
}|���Y7���w)Nrr-T)rKrJrMr�r>)r�r	r<s   rD�__iter__zTarFile.__iter__�
s�����	��<�<��|�|�#�#�������'��i�i�k�G��Q�J�E��M���s�4�<�<�(�(��,�,�u�-���\�\��)�)�+���#'�D�L����Q�J�E��M��
$�s�B(�B&�BB(c�\�	||jkrt|tj��yy)N��file)rGr�r��stderr)r��level�msgs   rDr�zTarFile._dbg�
s&��	��D�J�J���#�C�J�J�'�rFc�&�|j�|Sr�)ryr�s rD�	__enter__zTarFile.__enter__�
s�����
��rFc��|�|j�y|js|jj�d|_yr)r�r�r�r�)r�rrr��	tracebacks    rD�__exit__zTarFile.__exit__�
s2���<��J�J�L��#�#����"�"�$��D�KrF)
Nr�NNNNNNr�NNNN)r�N)r�NrY)r�NN)NNN�Trr�)�.N)r�T)TFr!)=r�r�r�rGrErFrHrrbr
rBrCrr<r6r�r�r�r6rsrrRrirmrqrSr�rwr{r}r�r
r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rurzryr�rr�rrr�rFrDrrns����
�E��K��L��J��F��H�
�F��G��J���AE�HL�>B�)-�b�^��#�t�Z�]/��]/�~�2��2�����@����6����:����	�I�%�*	��?�a�F$�D�$�L1"��1"�f%�2G�.+/�%��+/�ZG���G�&�.+�,�
C��@>B�&+�*0�b
�N� B�?�A�$V�2D�B?�L�<�B&&�P�C��&�>(��rFrc���		t|d�r.|j�}t|��}|j|�nt|�}|j	�y#t
$rYywxYw)Nrt)r�TF)r�r�rr�r�r)r�r�rs   rDrrs]���

��4�� ��)�)�+�C��T�"�A��I�I�c�N��T�
�A�	���	�������s�AA�	A%�$A%c	��ddl}d}|j|��}|jddddd�	�|jd
dtd�
�|j	d��}|jdddd��|jddddd��|jddddd��|jdd dd!��|j�}|jr|j�|jd"d#�|j��|j}t|�rut|d$�5}|j�t|j�tj�%�ddd�|j r=td&j#|��y|jd"d'j#|��yy|j$�u|j$}t|�r<t&j|d(�5}|j%|j �)�ddd�y|jd"d'j#|��y|j��+t)|j�d"k(r |jd}t*j,}nHt)|j�d*k(r|j\}}n |jd"|j/��t�r}t&j|d(�5}|j1|j�+�ddd�|j rWd,k(rd-j#|�}	nd.j#||�}	t|	�y|jd"d'j#|��yy|j2��|j2j5d�}
t*j6j9|
�\}}d/d/d0d0d1d1d1d1d2�}
||
vrd3|
|znd4}|j2}t&j|
|�5}|D]}|j;|��	ddd�|j rtd5j#|
��yyy#1swY���xYw#1swYyxYw#1swY��VxYw#1swY�XxYw)6Nrz3A simple command-line interface for tarfile module.)�descriptionz-vz	--verbose�
store_trueFzVerbose output)�action�default�helpz--filterz<filtername>zFilter for extraction)�metavar�choicesr(T)�requiredz-lz--list�	<tarfile>zShow listing of a tarfile)r)r(z-ez	--extract�+)r,z<output_dir>zExtract tarfile into target dir)�nargsr)r(z-cz--create)z<name>z<file>zCreate tarfile from sourcesz-tz--testzTest if a tarfile is validr-z&--filter is only valid for extraction
r�rz{!r} is a tar archive.z{!r} is not a tar archive.
rP)r�r.)r/r�r!z{!r} file is extracted.z+{!r} file is extracted into {!r} directory.r�r�r�)r�z.tgzz.xzz.txzz.bz2z.tbzz.tbz2z.tb2zw:r�z{!r} file created.)�argparse�ArgumentParser�add_argumentr��add_mutually_exclusive_group�
parse_argsr�r��exit�testrrr{r�r�rr�rbr
rr>r��curdir�format_helpr��creater[r/�splitextr�)r/r$�parserr��argsrvr��tfr6r�tar_namer
�ext�compressions�tar_mode�	tar_files�	file_names                 rD�mainrCs����G�K�
�
$�
$��
$�
=�F�
����k�,��-��/�
���
�N� .�4��6�
�/�/��/�>�E�	���t�X�{�7��9�	���t�[��<�=��?�
���t�Z�s�3�9��;�
���t�X�{�8��:�����D��{�{�t�|�|�+����A�@�A��y�y���i�i���c�?��c�3��3���� ��c�n�n�&�S�Z�Z�8� ��|�|��.�5�5�c�:�;��K�K��9�@�@��E�F��

���	��i�i���c�?����c�5�)�R��������-�*�)�
�K�K��9�@�@��E�F�	
���	!��t�|�|���!��,�,�q�/�C��Y�Y�F�
����
�!�
#��,�,�K�C���K�K��6�-�-�/�0��c�?����c�5�)�R��
�
�6�$�+�+�
�>�*��|�|��S�=�3�:�:�3�?�C�2�39�6�#�v�3F���c�
��K�K��9�@�@��E�F��
���	 ��;�;�?�?�1�%�����!�!�(�+���3���������
��03�l�/B�4�,�s�+�+����K�K�	�
�\�\�(�H�
-��&�	����y�!�'�.��<�<��&�-�-�h�7�8��/
!�M ���*�)��*�)��>.�
-�s0�:P-�P:�Q�"Q�-P7�:Q�Q�Q�__main__r )k�version�
__author__�__credits__�builtinsrrCr�r�r'rqr�r�rir��rer�r�r�r��AttributeError�NotImplementedErrorr�r��__all__r?rrsr�r�r�r�r�ryr�r&r$r�r�r�r,�CONTTYPEr�r�r�r�r�r�rrrrr�rr�rr�r�rWrr�r
�getfilesystemencodingrErLr\rdrnrrr�rrrrr	r
rr�r�r�rYr�r�r��objectr�r�BufferedReaderr6rrrrrrrhrrrr�r��compiler�rrrrCr�r�rFrD�<module>rRs���:���6�
�H��
'�
�	�	�
���
��	������$�%8�'�B��*�����	�
��^�
��	��������
�
����
��
��
��
��
������������
��
������
�
�
�
����H�g��G�X��W�g�#�%5�!�	#���(��>�+�
��/�
�
�	�.�
�9��
�
�
����
���7�7�d�?��H�(�s�(�(�*�H�0�&�
�(�N�
�<*�"&��$��2�	�y�	�	�8�	�	��	�	�x�	�	�(�	�	�(�	�	�{�	�	�;�	�	�[�	�	��	�	�K�	���0r�r�j�6��<e�&�e�P"�2�$�$�"�	�(�	�J��J�
?�k�?�@�{�@�
L��L�
?�+�?�=�~���*�����	���&�2�:�:�&8�9��Z9�f�Z9�zL�f�L�d$�$�|�|��]9�~�z���F���Y��
�C�����
�C��s"�I�I�I�I�I�I