Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /opt/alt/python311/lib64/python3.11/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/python311/lib64/python3.11/__pycache__/tarfile.cpython-311.opt-2.pyc
�

�,dw��Z�	dZdZdZddlmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZ	ddlZn
#e$rdZYnwxYw	ddlZn
#e$rdZYnwxYweefZ	eefz
Zn#e$rYnwxYwgd�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:ej;d!krd"Z<nej=��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�dJejV��ZWGdK�dLeS��ZXGdM�dNeS��ZYdO�ZZeYjZdP�Z[e\dQkre[��dSdS)Rz0.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�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&r-r,r')�atime�ctimer)r*r+r(�nt�utf-8c�z�	|�||��}|d|�|t|��z
tzzS�N)�encode�len�NUL)�s�length�encoding�errorss    �./opt/alt/python311/lib64/python3.11/tarfile.py�stnr<�s<���	����6�"�"�A��W�f�W�:��#�a�&�&��C�/�/�/�c�z�	|�d��}|dkr
|d|�}|�||��S)Nr���)�find�decode)r7r9r:�ps    r;�ntsrC�s@���	���u�
�
�A��B�w�w�
�b�q�b�E���8�8�H�f�%�%�%r=c�~�	|ddvr]d}tt|��dz
��D]}|dz}|||dzz
}�|ddkrdt|��dz
z|z
}nT	t|dd��}t|���pd	d��}n#t
$rt
d
���wxYw|S)Nr)��r$�rF��ascii�strict�0�invalid header)�ranger5rC�int�strip�
ValueError�InvalidHeaderError)r7�n�is   r;�ntirT�s����	��t�~���
���s�1�v�v��z�"�"�	�	�A�
�!�G�A�
��1�q�5��M�A�A��Q�4�5�=�=��#�a�&�&�1�*�%��)�*�A��	7��A�w��)�)�A��A�G�G�I�I�$��a�(�(�A�A���	7�	7�	7�$�%5�6�6�6�	7�����Hs�*5B � B:rGc���	|}t|��}d|cxkrd|dz
zkr$nn!td|dz
|fzd��tz}n�|tkr�d|dz
z|cxkrd|dz
zkrfnnc|dkrt	dg��}nt	dg��}d|z|z}t|dz
��D] }|�d|dz��|dz}�!ntd	���|S)
NrrGr$z%0*orIrHrErFzoverflow in number field)rN�bytesr6r�	bytearrayrM�insertrP)rR�digits�format�
original_nr7rSs      r;�itnr\�s8����J��A���A��A�!�!�!�!��f�q�j�!�!�!�!�!�!��&�F�Q�J��?�*�G�4�4�s�:���	�:�	�	�3�6�A�:�#6�"6�!�"Q�"Q�"Q�"Q�c�f�q�j�>Q�"Q�"Q�"Q�"Q�"Q���6�6��5�'�"�"�A�A��5�'�"�"�A��v�
��!�A��v��z�"�"�	�	�A�
�H�H�Q��E�	�"�"�"�
�!�G�A�A�	��3�4�4�4��Hr=c��	dttjd|����z}dttjd|����z}||fS)NrH�
148B8x356B�
148b8x356b)�sum�struct�unpack_from)�buf�unsigned_chksum�
signed_chksums   r;�calc_chksumsrf�sR����C�� 2�<�� E� E�F�F�F�O��#�f�0��s�C�C�D�D�D�M��M�)�)r=c���	|pd}|dkrdS|�tj|||��dSt||��\}}t|��D]J}|�|��}t|��|kr|d���|�|���K|dkrH|�|��}t|��|kr|d���|�|��dS)Ni@r�unexpected end of data)�shutil�copyfileobj�divmodrM�readr5�write)	�src�dstr8�	exception�bufsize�blocks�	remainder�brcs	         r;rjrj�s�����"��G�
��{�{���
�~���3��W�-�-�-����v�w�/�/��F�I�
�6�]�]�����h�h�w�����s�8�8�g����)�4�5�5�5��	�	�#������A�~�~��h�h�y�!�!���s�8�8�i����)�4�5�5�5��	�	�#����
�Fr=c��ttjdd��}|�)|�|d���|��}t|d���dS)Nr9�backslashreplace� )�end)�getattr�sys�stdoutr4rA�print)r7r9s  r;�_safe_printr}sV���s�z�:�t�4�4�H���
�H�H�X�1�2�2�9�9�(�C�C��	�!�������r=c��eZdZ	dS)rN��__name__�
__module__�__qualname__�r=r;rrs��������Dr=rc��eZdZ	dS)rNrr�r=r;rrs������/��Dr=rc��eZdZ	dS)rNrr�r=r;rrs������0��Dr=rc��eZdZ	dS)r	Nrr�r=r;r	r	s������8��Dr=r	c��eZdZ	dS)r
Nrr�r=r;r
r
s������G��Dr=r
c��eZdZ	dS)rNrr�r=r;rrs������+��Dr=rc��eZdZ	dS)�EmptyHeaderErrorNrr�r=r;r�r�s������&��Dr=r�c��eZdZ	dS)�TruncatedHeaderErrorNrr�r=r;r�r� s������*��Dr=r�c��eZdZ	dS)�EOFHeaderErrorNrr�r=r;r�r�#s������,��Dr=r�c��eZdZ	dS)rQNrr�r=r;rQrQ&s������(��Dr=rQc��eZdZ	dS)�SubsequentHeaderErrorNrr�r=r;r�r�)s������=��Dr=r�c�(�eZdZ	d�Zd�Zd�Zd�ZdS)�
_LowLevelFilec��tjtjtjztjzd�|}ttd��r|tjz}tj||d��|_dS)N��r�w�O_BINARYi�)	�os�O_RDONLY�O_WRONLY�O_CREAT�O_TRUNC�hasattrr�r�fd)�self�name�modes   r;�__init__z_LowLevelFile.__init__6si������r�z�)�B�J�6�
�
�����2�z�"�"�	 ��B�K��D��'�$��e�,�,����r=c�8�tj|j��dSr3)r��closer��r�s r;r�z_LowLevelFile.close?s��
��������r=c�6�tj|j|��Sr3)r�rlr��r�r(s  r;rlz_LowLevelFile.readBs���w�t�w��%�%�%r=c�:�tj|j|��dSr3)r�rmr��r�r7s  r;rmz_LowLevelFile.writeEs��
����!�����r=N)r�r�r�r�r�rlrmr�r=r;r�r�0sU�������
-�-�-����&�&�&�����r=r�c�Z�eZdZ	d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
dd
�Zd�Zd�Z
d
�ZdS)�_Streamc��	d|_|�t||��}d|_|dkr#t|��}|���}|pd|_||_||_||_||_d|_	d|_
d|_	|dkr�	ddl}n#t$rtd��d�wxYw||_|�d��|_|d	kr"|���|j|_dS|���dS|d
krs	ddl}n#t$rtd��d�wxYw|d	kr.d|_|���|_t2|_dS|���|_dS|dkrs	ddl}n#t$rtd
��d�wxYw|d	kr.d|_|���|_|j|_dS|���|_dS|dkrtd|z���dS#|js|j���d|_�xYw)NTF�*�r=r�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�fileobjrqrc�pos�closed�zlib�ImportErrorr	�crc32�crc�
_init_read_gz�errorrp�_init_write_gzr��dbuf�BZ2Decompressor�cmp�OSError�
BZ2Compressor�lzma�LZMADecompressor�	LZMAError�LZMACompressorr�)	r�r�r�r�r�rqr�r�r�s	         r;r�z_Stream.__init__Ss���	�����?�#�D�$�/�/�G�$�D���s�?�?�#�7�+�+�G��*�*�,�,�H��
���	���	� ��
����������������-	��4���U��K�K�K�K��"�U�U�U�*�+I�J�J�PT�T�U���� ��	��:�:�c�?�?����3�;�;��&�&�(�(�(�%)�Z�D�N�N�N��'�'�)�)�)�)�)��U�"�"�T��J�J�J�J��"�T�T�T�*�+H�I�I�t�S�T�����3�;�;� #�D�I�"�2�2�4�4�D�H�%,�D�N�N�N�"�0�0�2�2�D�H�H�H��T�!�!�U��K�K�K�K��"�U�U�U�*�+I�J�J�PT�T�U�����3�;�;� #�D�I�#�4�4�6�6�D�H�%)�^�D�N�N�N�#�2�2�4�4�D�H�H�H��U�"�"�&�'D�x�'O�P�P�P�#�"��	��#�
%���"�"�$�$�$��D�K����sy�H�
B�H�B-�-A
H�9H�H�D�H�D6�65H�-H�H�F�H�F/�/5H�&H�H�*Ic�d�t|d��r|js|���dSdSdS)Nr�)r�r�r�r�s r;�__del__z_Stream.__del__�sB���4��"�"�	�4�;�	��J�J�L�L�L�L�L�	�	�	�	r=c�B�	|j�d|jj|jj|jjd��|_t
jdttj	������}|�
d|zdz��|j�d��r|jdd�|_tj�|j��|_|�
|j�dd	��t"z��dS)
N�	r�<Ls�s��.gz���z
iso-8859-1�replace)r��compressobj�DEFLATED�	MAX_WBITS�
DEF_MEM_LEVELr�ra�packrN�time�_Stream__writer��endswithr�r&�basenamer4r6)r��	timestamps  r;r�z_Stream._init_write_gz�s���	��9�(�(��D�I�,>�-1�Y�-@�,@�,0�I�,C�,-�/�/����K��c�$�)�+�+�&6�&6�7�7�	����(�9�4�{�B�C�C�C��9���e�$�$�	'��	�#�2�#��D�I��G�$�$�T�Y�/�/��	����T�Y�%�%�l�I�>�>��D�E�E�E�E�Er=c��	|jdkr%|j�||j��|_|xjt|��z
c_|jdkr|j�|��}|�|��dS)Nr�r�)	r�r�r�r�r�r5r��compressr�r�s  r;rmz
_Stream.write�sx��	��=�D� � ��y���q�$�(�3�3�D�H����C��F�F�����=�E�!�!���!�!�!�$�$�A����Q�����r=c�*�	|xj|z
c_t|j��|jkrd|j�|jd|j���|j|jd�|_t|j��|jk�bdSdSr3)rcr5rqr�rmr�s  r;�__writez_Stream.__write�s���	�	
���A�
����$�(�m�m�d�l�*�*��L���t�x�
���
�6�7�7�7��x���
�
�.�D�H��$�(�m�m�d�l�*�*�*�*�*�*r=c��	|jrdSd|_	|jdkr2|jdkr'|xj|j���z
c_|jdkr�|jr�|j�|j��d|_|jdkrg|j�tj	d|j
����|j�tj	d|jdz����|js|j�
��dSdS#|js|j�
��wwxYw)NTr�r�r=r�r�l��)r�r�r�rcr��flushr�rmrar�r�r�r�r�r�s r;r�z
_Stream.close�s?��	��;�	��F����	%��y�C���D�M�U�$:�$:����D�H�N�N�,�,�,����y�C���D�H����"�"�4�8�,�,�,�����=�D�(�(��L�&�&�v�{�4���'B�'B�C�C�C��L�&�&�v�{�4���J�9N�'O�'O�P�P�P��#�
%���"�"�$�$�$�$�$�
%�
%��4�#�
%���"�"�$�$�$�$�
%���s�C'D�#Ec��	|j�|jj��|_d|_|�d��dkrt
d���|�d��dkrtd���t|�d����}|�d��|d	zr]t|�d����d
t|�d����zz}|�	|��|dzr%	|�d��}|r|tkrn�$|d
zr%	|�d��}|r|tkrn�$|dzr|�d��dSdS)Nr=r%s��not a gzip filer$�zunsupported compression method��rHrGT�)r��
decompressobjr�r�r��
_Stream__readrr	�ordrlr6)r��flag�xlenr7s    r;r�z_Stream._init_read_gz�s���	��9�*�*�D�I�,?�+?�@�@�����	��;�;�q�>�>�[�(�(��-�.�.�.��;�;�q�>�>�W�$�$�"�#C�D�D�D��4�;�;�q�>�>�"�"�����A�����!�8�	��t�{�{�1�~�~�&�&��s�4�;�;�q�>�>�/B�/B�)B�B�D��I�I�d�O�O�O��!�8�	�
��K�K��N�N����A��H�H��
��"�9�	�
��K�K��N�N����A��H�H��
��!�8�	��K�K��N�N�N�N�N�	�	r=c��	|jSr3)r�r�s r;�tellz_Stream.tell�s��	��x�r=rc��	||jz
dkrbt||jz
|j��\}}t|��D]}|�|j���|�|��ntd���|jS)Nrz seeking backwards is not allowed)r�rkrqrMrlr
)r�r�rrrsrSs     r;�seekz_Stream.seek�s���	����>�Q��� &�s�T�X�~�t�|� D� D��F�I��6�]�]�
(�
(���	�	�$�,�'�'�'�'��I�I�i� � � � ��@�A�A�A��x�r=c�l�	|�|��}|xjt|��z
c_|Sr3)�_readr�r5)r�r(rcs   r;rlz_Stream.reads1��C��j�j��������C��H�H�����
r=c�*�	|jdkr|�|��St|j��}|jg}||kr�|jr|j}d|_n"|j�|j��}|snk	|j�	|��}n"#|j
$r}td��|�d}~wwxYw|�|��|t|��z
}||k��d�
|��}||d�|_|d|�S)Nr�r=zinvalid compressed data)r�r�r5r�rcr�rlrqr��
decompressrpr�append�join)r�r(�c�trc�es      r;r�z
_Stream._reads*��	��=�E�!�!��;�;�t�$�$�$���	�N�N��
�Y�K���$�h�h��x�
��h�������l�'�'���5�5�����
B��h�)�)�#�.�.�����>�
B�
B�
B�� 9�:�:��A�����
B����
�H�H�S�M�M�M�
��S���M�A��$�h�h�
�H�H�Q�K�K���d�e�e�H��	���$��x�s�=B�
B7�"B2�2B7c�B�	t|j��}|jg}||krO|j�|j��}|sn-|�|��|t|��z
}||k�Od�|��}||d�|_|d|�S)Nr=)r5rcr�rlrqr�r�)r�r(r�r�rcs     r;�__readz_Stream.__read)s���	�
���M�M��
�X�J���$�h�h��,�#�#�D�L�1�1�C��
��
�H�H�S�M�M�M�
��S���M�A��$�h�h�
�H�H�Q�K�K���T�U�U�8�����$��x�r=N)r)r�r�r�r�r�r�rmr�r�r�r�r�rlr�r�r�r=r;r�r�Hs��������D�D�D�L���F�F�F� ���/�/�/�%�%�%�,���>���
����������6����r=r�c�(�eZdZ	d�Zd�Zd�Zd�ZdS)r�c�\�||_|j�t��|_dSr3)r�rl�	BLOCKSIZErc)r�r�s  r;r�z_StreamProxy.__init__?s$������<�$�$�Y�/�/����r=c�2�|jj|_|jSr3)r�rlrcr�s  r;rlz_StreamProxy.readCs���L�%��	��x�r=c���|j�d��rdS|jdd�dkr|jdd�dkrd	S|j�d
��rdSdS)
Ns�r�r�sBZhr��
s1AY&SYr�)s]�s�7zXZr�r�)rc�
startswithr�s r;r�z_StreamProxy.getcomptypeGsp���8����/�/�	��4�
�X�a��c�]�f�
$�
$���!�B�$��9�)D�)D��5�
�X�
 �
 �!C�
D�
D�	��4��5r=c�8�|j���dSr3)r�r�r�s r;r�z_StreamProxy.closeQs����������r=N)r�r�r�r�rlr�r�r�r=r;r�r�:sU�������0�0�0�����������r=r�c�^�eZdZ	dd�Zd�Zd�Zd�Zd�Zd�Ze	j
fd�Zdd	�Zd
�Z
d�ZdS)
�_FileInFileNc���||_||_||_d|_t	|dd��|_d|_|�d|fg}d|_g|_d}|j}|D]T\}}||kr|j�	d||df��|j�	d|||z|f��||z
}||z}�U||jkr%|j�	d||jdf��dSdS)Nrr�FT)
r��offsetr(�positionryr�r��	map_index�mapr�)r�r�rr(�	blockinfo�lastpos�realposs       r;r�z_FileInFile.__init__^s����������	���
��G�V�T�2�2��	�������T���I����������+��%�	$�	$�L�F�D������������� >�?�?�?��H�O�O�T�6�6�D�=�'�B�C�C�C��t�O�G��t�m�G�G��T�Y����H�O�O�U�G�T�Y��=�>�>�>�>�>��r=c��dSr3r�r�s r;r�z_FileInFile.flushws���r=c��dS�NTr�r�s r;�readablez_FileInFile.readablezs���tr=c��dS�NFr�r�s r;�writablez_FileInFile.writable}s���ur=c�4�|j���Sr3)r��seekabler�s r;rz_FileInFile.seekable�s���|�$�$�&�&�&r=c��	|jSr3)r
r�s r;r�z_FileInFile.tell�s��	��}�r=c���	|tjkr)tt|d��|j��|_n�|tjkrG|dkrt|j|zd��|_nst|j|z|j��|_nP|tjkr1tt|j|z|j��d��|_ntd���|jS)NrzInvalid argument)	�io�SEEK_SET�min�maxr(r
�SEEK_CUR�SEEK_ENDrP)r�r
�whences   r;r�z_FileInFile.seek�s���	��R�[� � ���H�a� 0� 0�$�)�<�<�D�M�M�
�r�{�
"�
"��!�|�|� #�D�M�H�$<�a� @� @��
�
� #�D�M�H�$<�d�i� H� H��
�
�
�r�{�
"�
"���D�I��$8�$�)� D� D�a�H�H�D�M�M��/�0�0�0��}�r=c��	|�|j|jz
}nt||j|jz
��}d}|dk�r
	|j|j\}}}}||jcxkr|krnnn5|xjdz
c_|jt|j��krd|_�bt|||jz
��}|rg|j�||j|z
z��|j�|��}t|��|krtd���||z
}n
|t|zz
}||z}|xj|z
c_|dk��
|S)Nr=rTr$rh)r(r
r rrr5r�r�rlrr6)	r�r(rc�data�start�stoprr8rts	         r;rlz_FileInFile.read�sq��	��<��9�t�}�,�D�D��t�T�Y���6�7�7�D����Q�h�h�
+�,0�H�T�^�,D�)��e�T�6��D�M�0�0�0�0�D�0�0�0�0�0���N�N�a�'�N�N��~��T�X���6�6�)*���
+���t�d�m�3�4�4�F��
$���!�!�&�D�M�E�,A�"B�C�C�C��L�%�%�f�-�-���q�6�6�V�#�#�#�$<�=�=�=��q�����s�V�|�#���F�N�D��M�M�V�#�M�M�'�Q�h�h�(�
r=c��|�t|����}||dt|���<t|��Sr3)rlr5)r�rtrcs   r;�readintoz_FileInFile.readinto�s7���i�i��A��������)�3�s�8�8�)���3�x�x�r=c��d|_dSr)r�r�s r;r�z_FileInFile.close�s
������r=r3)r�r�r�r�r�rrrr�rrr�rlr*r�r�r=r;r
r
Xs��������
?�?�?�?�2
�
�
�������'�'�'����
%'�K����� ����>���
����r=r
c���eZdZ�fd�Z�xZS)�ExFileObjectc���t|j|j|j|j��}t���|��dSr3)r
r��offset_datar(�sparse�superr�)r��tarfile�tarinfor��	__class__s    �r;r�zExFileObject.__init__�sB����g�o�w�/B���g�n�.�.��
������!�!�!�!�!r=)r�r�r�r��
__classcell__)r4s@r;r-r-�s8�������"�"�"�"�"�"�"�"�"r=r-c�R�eZdZ	edQidd�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$��ZdRd(�Zed)���Zejd*���Zed+���Z	e	jd,���Z	d-�Z
d.�Zee
d/fd0�Zd1�Zd2�Zd3�Zed4���Zd5�Zed6���Zed7���Zed8���Zed9���Zed:���Zed;���Zd<�Zd=�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�Z0d$S)Srr�zName of the archive member.r�zPermission bits.r*z6User ID of the user who originally stored this member.r+z7Group ID of the user who originally stored this member.r(zSize in bytes.r)zTime 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.�linknamezcName of the target file name, which is only present in TarInfo objects of type LNKTYPE and SYMTYPE.r,z
User name.r-zGroup name.�devmajorzDevice major number.�devminorzDevice minor number.rzThe tar header starts here.r/zThe file's data starts here.�pax_headerszMA dictionary containing key-value pairs of an associated pax extended header.r0zSparse member information.r2N�_sparse_structs�_link_targetr�c��	||_d|_d|_d|_d|_d|_d|_t|_d|_	d|_
d|_d|_d|_
d|_d|_d|_i|_dS)Ni�rr�)r�r�r*r+r(r)r7�REGTYPEr8r9r,r-r:r;rr/r0r<�r�r�s  r;r�zTarInfo.__init__�s���	���	���	���������	���
������	���
���
���
���
���
��������������r=c��	|jSr3�r�r�s r;r&zTarInfo.paths
��2��y�r=c��||_dSr3rCrAs  r;r&zTarInfo.paths
����	�	�	r=c��	|jSr3�r9r�s r;r'zTarInfo.linkpaths
��:��}�r=c��||_dSr3rF)r�r9s  r;r'zTarInfo.linkpaths
�� ��
�
�
r=c�J�d|jj|jt|��fzS)Nz<%s %r at %#x>)r4r�r��idr�s r;�__repr__zTarInfo.__repr__s!���4�>�#:�4�9�R��X�X�"N�N�Nr=c�(�	|j|jdz|j|j|j|j|j|j|j|j	|j
|j|jd�
}|dtkr+|d�d��s|dxxdz
cc<|S)N�)
r�r�r*r+r(r)r7r8r9r,r-r:r;r8r��/)r�r�r*r+r(r)r7r8r9r,r-r:r;�DIRTYPEr�)r��infos  r;�get_infozTarInfo.get_infos���	��	��	�F�*������	��
����	��
��
��
��
��
�
�
�� ��<�7�"�"�4��<�+@�+@��+E�+E�"���L�L�L�C��L�L�L��r=�surrogateescapec��	|���}|tkr|�|||��S|tkr|�|||��S|t
kr|�||��Std���)Nzinvalid format)rPr�create_ustar_headerr�create_gnu_headerr�create_pax_headerrP)r�rZr9r:rOs     r;�tobufz
TarInfo.tobuf3s���	��}�}�����\�!�!��+�+�D�(�F�C�C�C�
�z�
!�
!��)�)�$��&�A�A�A�
�z�
!�
!��)�)�$��9�9�9��-�.�.�.r=c��	t|d<t|d�||����tkrt	d���t|d�||����t
kr&|�|d||��\|d<|d<|�|t||��S)N�magicr9zlinkname is too longr��prefix)	�POSIX_MAGICr5r4�LENGTH_LINKrP�LENGTH_NAME�_posix_split_name�_create_headerr)r�rOr9r:s    r;rSzTarInfo.create_ustar_headerAs���	�#��W�
��t�J��&�&�x��8�8�9�9�K�G�G��3�4�4�4��t�F�|�"�"�8�V�4�4�5�5��C�C�+/�+A�+A�$�v�,�PX�Z`�+a�+a�(�D��N�D��L��"�"�4��x��H�H�Hr=c��	t|d<d}t|d�||����tkr&||�|dt
||��z
}t|d�||����tkr&||�|dt||��z
}||�|t||��zS)NrXr=r9r�)
�	GNU_MAGICr5r4r[�_create_gnu_long_header�GNUTYPE_LONGLINKr\�GNUTYPE_LONGNAMEr^r)r�rOr9r:rcs     r;rTzTarInfo.create_gnu_headerNs���	�!��W�
����t�J��&�&�x��8�8�9�9�K�G�G��4�/�/��Z�0@�BR�T\�^d�e�e�e�C��t�F�|�"�"�8�V�4�4�5�5��C�C��4�/�/��V��>N�PX�Z`�a�a�a�C��T�(�(��z�8�V�L�L�L�Lr=c��	t|d<|j���}ddtfddtfddfD]h\}}}||vr�	||�dd	��n#t$r||||<Y�@wxYwt||��|kr||||<�id
D]u\}}d}||}	t|	t��}
|
rt|	��n|	}d|cxkrd
|dz
zks
nd||<d}n	|
r|||<d}|r||vrt|	��||<�v|r|�|t|��}nd}||�|tdd��zS)NrXr�r&r9r')r,r,� )r-r-rerIrJ))r*rG)r+rG)r(�)r)rfFrrGr$Tr=r�)rZr<�copyr\r[r4�UnicodeEncodeErrorr5�
isinstance�float�round�str�_create_pax_generic_header�XHDTYPEr^r)
r�rOr9r<r��hnamer8rY�	needs_pax�val�val_is_float�val_intrcs
             r;rUzTarInfo.create_pax_header\s���	�$��W�
��&�+�+�-�-��
���-�
�J��/T�&�(>�$@�	0�	0��D�%����#�#��
��T�
�!�!�'�8�4�4�4�4��%�
�
�
�%)�$�Z��E�"���
�����4��:����'�'�%)�$�Z��E�"��R�	-�	-�L�D�&��I��t�*�C�%�c�5�1�1�L�$0�9�e�C�j�j�j�c�G���3�3�3�3�!���
�"3�3�3�3�3���T�
� �	�	��
!�%��T�
� �	��
-�T��4�4�$'��H�H��D�!���	��1�1�+�w��Q�Q�C�C��C��T�(�(��|�W�i�P�P�P�Ps�A$�$A<�;A<c�<�	|�|td��S)Nr1)rm�XGLTYPE)�clsr<s  r;�create_pax_global_headerz TarInfo.create_pax_global_header�s��	��-�-�k�7�G�L�L�Lr=c��	|�d��}tdt|����D]�}d�|d|���}d�||d���}t|�||����t
kr.t|�||����tkrn��td���||fS)NrMr$zname is too long)�splitrMr5r�r4�
LENGTH_PREFIXr\rP)r�r�r9r:�
componentsrSrYs       r;r]zTarInfo._posix_split_name�s���	��Z�Z��_�_�
��q�#�j�/�/�*�*�	1�	1�A��X�X�j��!��n�-�-�F��8�8�J�q�r�r�N�+�+�D��6�=�=��6�2�2�3�3�}�D�D�����H�f�5�5�6�6�+�E�E�����/�0�0�0��t�|�r=c�z�	|�d��ttfv}|rKt|�dd��d|��}t|�dd��d|��}n$t	dd||��}t	dd||��}t	|�dd��d||��t|�d	d��d
zd|��t|�dd��d|��t|�dd��d|��t|�d
d��d|��t|�dd��d|��d|�dt
��t	|�dd��d||��|�dt��t	|�dd��d||��t	|�dd��d||��||t	|�dd��d||��g}tjdtzd�
|����}t|td���d}	|dd�td|	zd��z|dd�z}|S)Nr8r:rrGr;r�r�rr�rLr*r+r(rfr)s        r9rXr,rer-rYrz%dsr=i����z%06orIi����)
�get�CHRTYPE�BLKTYPEr\r<r@rZrar�rr�rfrV)
rOrZr9r:�has_device_fieldsr:r;�partsrcr7s
          r;r^zTarInfo._create_header�sj��	�!�H�H�V�,�,��'�0B�B���	4��4�8�8�J��2�2�A�v�>�>�H��4�8�8�J��2�2�A�v�>�>�H�H��2�q�(�F�3�3�H��2�q�(�F�3�3�H�
������$�$�c�8�V�<�<�������#�#�f�,�a��8�8�������"�"�A�v�.�.�������"�"�A�v�.�.�������#�#�R��0�0������!�$�$�b�&�1�1���H�H�V�W�%�%������R�(�(�#�x��@�@��H�H�W�k�*�*������"�%�%�r�8�V�<�<������"�%�%�r�8�V�<�<��������2�&�&��X�v�>�>�
��$�k�%�)�+�S�X�X�e�_�_�=�=���c�9�*�+�+�.�/�/��2���%�4�%�j�5��F�!2�G�<�<�<�s�4�5�5�z�I���
r=c��	tt|��t��\}}|dkr|t|z
tzz
}|S)Nr)rkr5rr6)�payloadrrrss   r;�_create_payloadzTarInfo._create_payload�sE��	�#�3�w�<�<��;�;���	��q�=�=��	�I�-��4�4�G��r=c��	|�||��tz}i}d|d<||d<t|��|d<t|d<|�|t
||��|�|��zS)Nz
././@LongLinkr�r8r(rX)r4r6r5r`r^rr�)rvr�r8r9r:rOs      r;razTarInfo._create_gnu_long_header�s���	��{�{�8�V�,�,�s�2����&��V����V���4�y�y��V��!��W�
��!�!�$��h��G�G��#�#�D�)�)�*�	*r=c��	d}|���D]/\}}	|�dd���#t$rd}YnwxYwd}|r|dz
}|���D]�\}}|�d��}|r|�|d��}n|�d��}t|��t|��zdz}d	x}	}
	|tt	|
����z}	|	|
krn|	}
�)|tt	|
��d
��dz|zdz|zd
zz
}��i}d|d<||d<t|��|d<t|d<|�|td
d��|�	|��zS)NFr1rJTr=s21 hdrcharset=BINARY
rQrrrI� �=�
z././@PaxHeaderr�r8r(rXr�)
�itemsr4rhr5rlrVrZr^rr�)rvr<r8r9�binary�keyword�value�records�lrRrBrOs            r;rmz"TarInfo._create_pax_generic_header�s���	���)�/�/�1�1�	�	�N�G�U�
����W�h�/�/�/�/��%�
�
�
������
�������	1��0�0�G�)�/�/�1�1�	V�	V�N�G�U��n�n�W�-�-�G��
.����X�/@�A�A������W�-�-���G���s�5�z�z�)�A�-�A��I�A��
���C��F�F���O����6�6����	
�

�u�S��V�V�W�-�-��4�w�>��E��M�PU�U�U�G�G���'��V����V���7�|�|��V��#��W�
��!�!�$��g�y�I�I��#�#�G�,�,�-�	-s�5�A�Ac���	t|��dkrtd���t|��tkrtd���|�t
��tkrt
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�||��}|jt0kr&|j�d��rt4|_|jt6kr�d}g}t9d��D]h}		t|||dz���}
t||dz|dz���}n#t:$rYn!wxYw|�|
|f��|dz
}�it?|d��}t|dd���}
|||
f|_ |�!��r|j�"d��|_|r |jtFvr|dz|jz|_|S)Nrzempty headerztruncated headerzend of file header��zbad checksumr�l�t�|��ii	i)iIiQiYi�rMi�r�rf�i�i�i�)$r5r�rr��countr6r�rTrfrQrCr�r�r*r+r(r)r7r8r9r,r-r:r;�AREGTYPEr�rN�GNUTYPE_SPARSErMrPr��boolr=�isdir�rstrip�	GNU_TYPES)rvrcr9r:r7�objrYr��structsrSr�numbytes�
isextended�origsizes              r;�frombufzTarInfo.frombufsI��	��s�8�8�q�=�=�"�>�2�2�2��s�8�8�y� � �&�'9�:�:�:��9�9�S�>�>�Y�&�&� �!5�6�6�6��S��S��\�"�"����c�*�*�*�*�$�^�4�4�4��c�e�e���s�1�S�5�z�8�V�4�4����s�3�s�7�|�$�$����c�#�c�'�l�#�#����c�#�c�'�l�#�#����s�3�s�7�|�$�$�����C��G��%�%��	���
��s�3�w�<����3�s�3�w�<��6�:�:�����C��G��h��7�7��	���C��G��h��7�7��	��3�s�3�w�<�(�(����3�s�3�w�<�(�(����S��S��\�8�V�4�4���8�x���C�H�$5�$5�c�$:�$:���C�H�
�8�~�%�%��C��G��1�X�X�
�
��� ��S��r��\�!2�3�3�F�"�3�s�R�x��b��'8�#9�:�:�H�H��!�����E�E����������1�2�2�2��r�	����c�#�h���J��3�s�3�w�<�(�(�H�#*�J��"A�C���9�9�;�;�	,��x���s�+�+�C�H��	/�c�h�i�/�/���|�c�h�.�C�H��
s�7J=�=
K�
Kc��	|j�t��}|�||j|j��}|j���tz
|_|�|��Sr3)	r�rlrr�r9r:r�r�_proc_member)rvr2rcr�s    r;�fromtarfilezTarInfo.fromtarfile]sf��	��o�"�"�9�-�-���k�k�#�w�/���@�@���_�)�)�+�+�i�7��
�����(�(�(r=c�,�	|jttfvr|�|��S|jtkr|�|��S|jtttfvr|�	|��S|�
|��Sr3)r8rcrb�
_proc_gnulongr��_proc_sparsernru�SOLARIS_XHDTYPE�	_proc_pax�
_proc_builtin)r�r2s  r;r�zTarInfo._proc_memberrs���	��9�)�+;�<�<�<��%�%�g�.�.�.�
�Y�.�
(�
(��$�$�W�-�-�-�
�Y�7�G�_�=�
=�
=��>�>�'�*�*�*��%�%�g�.�.�.r=c��	|j���|_|j}|���s|jt
vr||�|j��z
}||_|�	|j
|j|j��|�
��r|j�d��|_|S�NrM)r�r�r/�isregr8�SUPPORTED_TYPES�_blockr(r�_apply_pax_infor<r9r:r�r�r�)r�r2rs   r;r�zTarInfo._proc_builtins���	�#�?�/�/�1�1����!���:�:�<�<�	-�4�9�O�;�;��d�k�k�$�)�,�,�,�F����	
���W�0�'�2B�G�N�S�S�S��:�:�<�<�	.��	�(�(��-�-�D�I��r=c�8�	|j�|�|j����}	|�|��}n/#t
$r"}t
t|����d�d}~wwxYw|j|_|j	tkr!t||j|j
��|_n0|j	tkr t||j|j
��|_|���r|j�d��|_|Sr�)r�rlr�r(r�rr�rlrr8rcrCr9r:r�rbr9r��removesuffix)r�r2rc�nextr�s     r;r�zTarInfo._proc_gnulong�s��	��o�"�"�4�;�;�t�y�#9�#9�:�:��	:��#�#�G�,�,�D�D���	:�	:�	:�'��A���/�/�T�9�����	:����
�k����9�(�(�(��C��!1�7�>�B�B�D�I�I�
�Y�*�
*�
*���W�%5�w�~�F�F�D�M��:�:�<�<�	4��	�.�.�s�3�3�D�I��s�A�
A7�A2�2A7c�4�	|j\}}}|`|r�|j�t��}d}t	d��D]l}	t|||dz���}t||dz|dz���}	n#t$rYn%wxYw|r|	r|�||	f��|dz
}�mt|d��}|��||_	|j�
��|_|j|�|j
��z|_||_
|S)Nr�rfr�i�)r=r�rlrrMrTrPr�r�r0r�r/r�r(r)
r�r2r�r�r�rcr�rSrr�s
          r;r�zTarInfo._proc_sparse�sK��	�)-�(<�%���X�� ��	(��/�&�&�y�1�1�C��C��2�Y�Y�
�
��� ��S��r��\�!2�3�3�F�"�3�s�R�x��b��'8�#9�:�:�H�H��!�����E�E������7�h�7��N�N�F�H�#5�6�6�6��r�	����c�#�h���J��	(����"�?�/�/�1�1����)�D�K�K��	�,B�,B�B�����	��s�7A<�<
B
�	B
c�x�	|j�|�|j����}|jt
kr|j}n|j���}tj	d|��}|�+|�
d���d��|d<|�d��}|dkr|j
}nd}tjd��}d}	|�||��}|sn�|���\}	}
t#|	��}	|	dkrt%d	���||�d
��dz|�d��|	zdz
�}|�|
dd|j��}
|
t.vr#|�|||j
|j��}n|�|dd|j��}|||
<||	z
}��	|�|��}n/#t2$r"}
t5t7|
����d�d}
~
wwxYwd|vr|�||��ned|vr|�|||��nI|�d
��dkr0|�d��dkr|�|||��|jt>t@fvr~|�!||j
|j��|j"|_"d|vrM|j#}|�$��s|jtJvr||�|j��z
}||_"|S)Ns\d+ hdrcharset=([^\n]+)\nr$r1�
hdrcharset�BINARYs(\d+) ([^=]+)=rTrLr%�GNU.sparse.map�GNU.sparse.sizezGNU.sparse.major�1zGNU.sparse.minorrKr()&r�rlr�r(r8rur<rg�re�search�grouprAr}r9�compile�match�groupsrNrQrxr'�_decode_pax_fieldr:�PAX_NAME_FIELDSr�rr�rl�_proc_gnusparse_01�_proc_gnusparse_00�_proc_gnusparse_10rnr�r�rr/r�r�)r�r2rcr<r�r�r9�regexr�r8r�r�r�r�rs               r;r�zTarInfo._proc_pax�s`��	��o�"�"�4�;�;�t�y�#9�#9�:�:��
�9����!�-�K�K�!�-�2�2�4�4�K��	�7��=�=����(-���A���(=�(=�g�(F�(F�K��%�
!�_�_�\�2�2�
���!�!��'�H�H��H��
�-�.�.����	��K�K��S�)�)�E��
��#�l�l�n�n�O�F�G���[�[�F���{�{�(�)9�:�:�:���	�	�!���q�(����Q���&�)@�1�)D�D�E�E��,�,�W�g�w��N�$�$�G��/�)�)��.�.�u�h��@P���(�(����.�.�u�g�w���(�(��$)�K�� ��6�M�C�9	�>	:��#�#�G�,�,�D�D���	:�	:�	:�'��A���/�/�T�9�����	:�����{�*�*��#�#�D�+�6�6�6�6�
�+�
-�
-��#�#�D�+�s�;�;�;�;�
�_�_�/�
0�
0�C�
7�
7�K�O�O�L^�<_�<_�cf�<f�<f��#�#�D�+�w�?�?�?��9��/�2�2�2�� � ��g�.>���O�O�O��+�D�K���$�$��)���:�:�<�<�5�4�9�O�#C�#C��d�k�k�$�)�4�4�4�F�!'����s�"G8�8
H$�H�H$c��	g}tjd|��D]7}|�t|�d�������8g}tjd|��D]7}|�t|�d�������8tt
||����|_dS)Ns\d+ GNU.sparse.offset=(\d+)\nr$s\d+ GNU.sparse.numbytes=(\d+)\n)r��finditerr�rNr��list�zipr0)r�r�r<rc�offsetsr�r�s       r;r�zTarInfo._proc_gnusparse_004s���	����[�!B�C�H�H�	0�	0�E��N�N�3�u�{�{�1�~�~�.�.�/�/�/�/����[�!D�c�J�J�	1�	1�E��O�O�C����A���/�/�0�0�0�0��3�w��1�1�2�2����r=c	��	d�|d�d��D��}tt|ddd�|ddd�����|_dS)Nc�,�g|]}t|����Sr�)rN)�.0�xs  r;�
<listcomp>z.TarInfo._proc_gnusparse_01.<locals>.<listcomp>Bs��K�K�K�Q�#�a�&�&�K�K�Kr=r��,r%r$)ryr�r�r0)r�r�r<r0s    r;r�zTarInfo._proc_gnusparse_01?s_��	�K�K�+�.>�"?�"E�"E�c�"J�"J�K�K�K���3�v�c�c��c�{�F�1�4�a�4�L�9�9�:�:����r=c	�\�	d}g}|j�t��}|�dd��\}}t	|��}t|��|dzkrwd|vr"||j�t��z
}|�dd��\}}|�t	|����t|��|dzk�w|j���|_tt|ddd�|ddd�����|_dS)Nr�r$r%)r�rlrryrNr5r�r�r/r�r�r0)r�r�r<r2�fieldsr0rc�numbers        r;r�zTarInfo._proc_gnusparse_10Es��	������o�"�"�9�-�-���i�i��q�)�)�����V�����&�k�k�F�Q�J�&�&��C����w��+�+�I�6�6�6���)�)�E�1�-�-�K�F�C��M�M�#�f�+�+�&�&�&�	�&�k�k�F�Q�J�&�&�
#�?�/�/�1�1����3�v�c�c��c�{�F�1�4�a�4�L�9�9�:�:����r=c��	|���D]�\}}|dkrt|d|���|dkrt|dt|�����B|dkrt|dt|�����g|tvr^|tvr)	t	||��}n#t
$rd}YnwxYw|dkr|�d��}t|||����|���|_dS)NzGNU.sparse.namer&r�r(zGNU.sparse.realsizerrM)	r��setattrrN�
PAX_FIELDS�PAX_NUMBER_FIELDSrPr�rgr<)r�r<r9r:r�r�s      r;r�zTarInfo._apply_pax_infoUs4��	�*�/�/�1�1�	.�	.�N�G�U��+�+�+���f�e�,�,�,�,��-�-�-���f�c�%�j�j�1�1�1�1��1�1�1���f�c�%�j�j�1�1�1�1��J�&�&��/�/�/�"� 1�'� :�5� A� A����%�"�"�"� !����"�����f�$�$�!�L�L��-�-�E���g�u�-�-�-��&�+�+�-�-����s�B&�&B5�4B5c�~�		|�|d��S#t$r|�||��cYSwxYw)NrJ)rA�UnicodeDecodeError)r�r�r9�fallback_encoding�fallback_errorss     r;r�zTarInfo._decode_pax_fieldls[��	�	D��<�<��(�3�3�3��!�	D�	D�	D��<�<� 1�?�C�C�C�C�C�	D���s�� <�<c�V�	t|t��\}}|r|dz
}|tzS)Nr$)rkr)r�r�rrrss    r;r�zTarInfo._blockts9��	�#�5�)�4�4���	��	��a�K�F��	�!�!r=c� �	|jtvSr3)r8�
REGULAR_TYPESr�s r;r�z
TarInfo.isreg}s��>��y�M�)�)r=c�,�	|���Sr3)r�r�s r;�isfilezTarInfo.isfile�s��>��z�z�|�|�r=c�$�	|jtkSr3)r8rNr�s r;r�z
TarInfo.isdir����+��y�G�#�#r=c�$�	|jtkSr3)r8�SYMTYPEr�s r;�issymz
TarInfo.issym�s��/��y�G�#�#r=c�$�	|jtkSr3)r8�LNKTYPEr�s r;�islnkz
TarInfo.islnk�r�r=c�$�	|jtkSr3)r8r~r�s r;�ischrz
TarInfo.ischr�s��2��y�G�#�#r=c�$�	|jtkSr3)r8rr�s r;�isblkz
TarInfo.isblk�s��.��y�G�#�#r=c�$�	|jtkSr3)r8�FIFOTYPEr�s r;�isfifozTarInfo.isfifo�s��&��y�H�$�$r=c��|jduSr3)r0r�s r;�issparsezTarInfo.issparse�s���{�$�&�&r=c�:�	|jtttfvSr3)r8r~rr�r�s r;�isdevz
TarInfo.isdev�s��M��y�W�g�x�8�8�8r=r�)r�)1r�r�r��dict�	__slots__r��propertyr&�setterr'rJrPrr
rVrSrTrU�classmethodrwr]�staticmethodr^r�rarmr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r=r;rr�sD���������
�
�
�,�,�
�!�!�
�G�F�
�H�G�	
�
 ��
�-�,�

�$�#�
�>�>�
�F�F�
���
��
�
�*�)�
� *�)�!
�"/�.�#
�$5�4�%
�&9�9�'
�*.�-�+
�,�$�-
�.�$�/
�0�t�1
�I�6����0����X��
�[����[������X���_�!�!��_�!�O�O�O����0*�H�EV�/�/�/�/�I�I�I�M�M�M�8Q�8Q�8Q�t�M�M��[�M�
��� �!�!��\�!�F����\���*�*��[�*� �0-�0-��[�0-�d�<�<��[�<�|�)�)��[�)�(/�/�/����,���6���8f�f�f�P	3�	3�	3�;�;�;�;�;�;� .�.�.�.D�D�D�"�"�"�*�*�*����$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�%�%�%�'�'�'�9�9�9�9�9r=rc��eZdZ	dZdZdZdZeZe	Z
dZeZ
eZ				d7d�Zedddefd���Zed8d	���Zed9d���Zed9d���Zed:d
���Zddddd�Zd�Zd�Zd�Zd�Zd;d�Zd<dd�d�Zd=dd�d�Zd>d�Z d?dd�d �Z!d@dd�d"�Z"d#�Z#		dAd$�Z$d%�Z%d&�Z&d'�Z'd(�Z(d)�Z)d*�Z*d+�Z+d,�Z,d-�Z-d.�Z.dBd/�Z/d0�Z0d>d1�Z1d2�Z2d3�Z3d4�Z4d5�Z5d6�Z6dS)CrrFr$Nr�rQc��	ddddd�}||vrtd���||_|||_|sU|jdkr-tj�|��sd|_d|_t
||j��}d	|_n]|�8t|d
��r(t|j
ttf��r|j
}t|d��r|j|_d|_|rtj�
|��nd|_
||_|�||_|�||_|�||_|�||_|�||_|	|_|
�|jt*kr|
|_ni|_|�||_|�||_|
|_d	|_g|_d	|_|j���|_i|_	|jd
kr d|_ |�!��|_ |jdkr�	|j�"|j��	|j�#|��}|j�$|��nY#tJ$r"|j�"|j��Yn/tL$r"}tOt|����d�d}~wwxYw��|jdvrxd|_|jrl|j�(|j�)����}|j�*|��|xjtW|��z
c_dSdSdS#|js|j�,��d|_�xYw)N�rbzr+b�wb�xb�r��ar�r��!mode must be 'r', 'a', 'w' or 'x'rr�Fr�r�Tr��rr�r�)-rPr��_moder�r&�exists�	bltn_openr�r�rir�rlrV�abspathr�rZr3�dereference�ignore_zerosr9r:rr<�debug�
errorlevel�copybufsizer��members�_loadedr�r�inodes�firstmemberr�r�r�r�r�rrrwrgrmr5r�)r�r�r�r�rZr3r
rr9r:r<rrr�modesr�rcs                 r;r�zTarFile.__init__�s���	���T��=�=���u����@�A�A�A���	��4�[��
��
	$��y�C�������t�(<�(<����	�!��
���d�j�1�1�G�$�D�������&�!9�!9���7�<�#�u��6�6���|���w��'�'�
*�$�\��
�#�D��-1�;�B�G�O�O�D�)�)�)�t��	������ �D�K���"�D�L��"�*�D���#� ,�D����$�D�M�����"�t�{�j�'@�'@�*�D���!�D�����D�J��!�(�D�O�'�������������l�'�'�)�)������	��y�C���#'�� �#'�9�9�;�;�� ��y�C���	:��L�%�%�d�k�2�2�2�:�"&�,�":�":�4�"@�"@����+�+�G�4�4�4�4��)������)�)�$�+�6�6�6���&�:�:�:�'��A���/�/�T�9�����:����	:��y�O�+�+�#����#�,��,�?�?��@P�@U�@U�@W�@W�X�X�C��L�&�&�s�+�+�+��K�K�3�s�8�8�+�K�K�K�K�
,�+�,�,��	��#�
%���"�"�$�$�$��D�K����s>�<AL'�4I�L'�)J�1L'�3	J�<J�J�BL'�'*Mc����	|s|std���|dvrՈfd�}g}t�j|���D]�}t��j|��}	|�|���}
	|	|d|fi|��cS#t
tf$r<}|�d|�d|����|�|�|
��Yd}~��d}~wwxYwd�	|��}td	|�����d
|vrc|�
d
d��\}
}|
pd}
|pd}|�jvrt��j|��}	nt
d
|z���|	||
|fi|��Sd|vrw|�
dd��\}
}|
pd}
|pd}|
dvrtd���t||
|||��}	�||
|fi|��}n#|����xYwd|_
|S|dvr�j|||fi|��Std���)Nznothing to open)r��r:*c�&���j|dkS)N�taropen)�	OPEN_METH)r�rvs �r;�not_compressedz$TarFile.open.<locals>.not_compressedXs����}�X�.�)�;�;r=��keyr�z	- method z: �
z'file could not be opened successfully:
�:r$r�r��|r�zmode must be 'r' or 'w'Frzundiscernible mode)rP�sortedrryr�rr	r�r�r�ryr�r�r�r)rvr�r�r�rq�kwargsr�
error_msgsr��func�	saved_posr��error_msgs_summary�filemode�streamr�s`               r;rzTarFile.open.s����!	�F�	0�G�	0��.�/�/�/��<���
<�
<�
<�
<�
<��J�"�3�=�n�E�E�E�

�

���s�C�M�(�$;�<�<���&� '�����I���4��c�7�=�=�f�=�=�=�=�=��!�#3�4�����%�%�&C�(�&C�&C�a�&C�&C�D�D�D��*����Y�/�/�/��H�H�H�H�����	����
"&���:�!6�!6���[�GY�[�[�\�\�\�
�D�[�[�!%���C��!3�!3��H�h���3�H��(�5�H��3�=�(�(��s�C�M�(�$;�<�<���&�'D�x�'O�P�P�P��4��h��:�:�6�:�:�:�
�D�[�[�!%���C��!3�!3��H�h���3�H��(�5�H��z�)�)� �!:�;�;�;��T�8�X�w��H�H�F�
��C��h��9�9�&�9�9����
�����������!�A�M��H�
�_�
$�
$��3�;�t�T�7�=�=�f�=�=�=��-�.�.�.s$�+
A8�8C�	2C�C�"F.�.Gc�@�	|dvrtd���||||fi|��S)Nrr)rP)rvr�r�r�r#s     r;rzTarFile.taropen�s>��	��+�+�+��@�A�A�A��s�4��w�1�1�&�1�1�1r=r�c���	|dvrtd���	ddlm}n#t$rt	d��d�wxYw	|||dz||��}n+#t
$r}|�|dkrt
d��|��d}~wwxYw	|j|||fi|��}nR#t
$r0}|���|dkrt
d��|��d}~w|����xYwd	|_	|S)
N�r�r�r��mode must be 'r', 'w' or 'x'r)�GzipFilezgzip module is not availablertr�r�F)
rP�gzipr.r�r	r�rrr�r�)	rvr�r�r��
compresslevelr#r.r�r�s	         r;�gzopenzTarFile.gzopen�sX��	���&�&��;�<�<�<�	M�%�%�%�%�%�%�%���	M�	M�	M�"�#A�B�B��L�	M����	��h�t�T�C�Z���H�H�G�G���	�	�	��"�t�s�{�{�� 1�2�2��9������	����
		����D�$��:�:�6�:�:�A�A���	�	�	��M�M�O�O�O��s�{�{�� 1�2�2��9������	��M�M�O�O�O�������
��s7��8�A�
A6�A1�1A6�:B�
C�+C�Cc�~�	|dvrtd���	ddlm}n#t$rt	d��d�wxYw||p|||���}	|j|||fi|��}nY#ttf$r0}|���|dkrtd��|��d}~w|����xYwd	|_
|S)
Nr,r-r)�BZ2Filer�)r0r�znot a bzip2 fileF)rPr�r3r�r	rr��EOFErrorr�rr�)	rvr�r�r�r0r#r3r�r�s	         r;�bz2openzTarFile.bz2open�s��	���&�&��;�<�<�<�	L�#�#�#�#�#�#�#���	L�	L�	L�"�#@�A�A�t�K�	L�����'�'�/�T�4�}�M�M�M��		����D�$��:�:�6�:�:�A�A����"�	�	�	��M�M�O�O�O��s�{�{�� 2�3�3��:������	��M�M�O�O�O�������
��s ��8�A�B3�.+B�B3c�x�	|dvrtd���	ddlm}m}n#t$rtd��d�wxYw||p|||���}	|j|||fi|��}nT#|tf$r0}	|���|dkrtd��|	��d}	~	w|����xYwd	|_
|S)
Nr,r-r)�LZMAFiler�r�)�presetr�znot an lzma fileF)rPr�r7r�r�r	rr4r�rr�)
rvr�r�r�r8r#r7r�r�r�s
          r;�xzopenzTarFile.xzopen�s��	���&�&��;�<�<�<�	M�0�0�0�0�0�0�0�0�0���	M�	M�	M�"�#A�B�B��L�	M�����(�7�?�d�D��@�@�@��		����D�$��:�:�6�:�:�A�A���8�$�	�	�	��M�M�O�O�O��s�{�{�� 2�3�3��:������	��M�M�O�O�O�������
��s ��:�A�B0�++B�B0rr1r5r9)r�r�r�r�c���	|jrdSd|_	|jdvr�|j�tt
dzz��|xjt
dzz
c_t|jt��\}}|dkr*|j�tt|z
z��|j	s|j�
��dSdS#|j	s|j�
��wwxYw)NTrr%r)r�r�r�rmr6rrrk�
RECORDSIZEr�r�)r�rrrss   r;r�z
TarFile.close�s���	��;�	��F����	%��y�O�+�+���"�"�3�)�a�-�#8�9�9�9����	�A�
�.���%+�4�;�
�$C�$C�!��	��q�=�=��L�&�&�s�j�9�.D�'E�F�F�F��#�
%���"�"�$�$�$�$�$�
%�
%��4�#�
%���"�"�$�$�$�$�
%���s�BC�#C2c��	|�|�d����}|�td|z���|S)NrMzfilename %r not found)�
_getmemberr��KeyError)r�r�r3s   r;�	getmemberzTarFile.getmember
sD��	�
�/�/�$�+�+�c�"2�"2�3�3���?��2�T�9�:�:�:��r=c�p�	|���|js|���|jSr3)�_checkr�_loadrr�s r;�
getmemberszTarFile.getmemberss5��	�	
���
�
�
��|�	��J�J�L�L�L��|�r=c�@�	d�|���D��S)Nc��g|]	}|j��
Sr�rC)r�r3s  r;r�z$TarFile.getnames.<locals>.<listcomp>&s��>�>�>����>�>�>r=)rCr�s r;�getnameszTarFile.getnames"s'��	�?�>�D�O�O�,=�,=�>�>�>�>r=c���	|�d��|�|j}|�|}tj�|��\}}|�tjd��}|�d��}|���}||_	|�1|j
stj|��}n;tj|��}n&tj
|�����}d}|j}tj|��ri|j|jf}	|j
s:|jdkr/|	|jvr&||j|	krt*}
|j|	}n�t,}
|	dr
||j|	<n�tj|��rt0}
n�tj|��rt4}
njtj|��rt8}
tj|��}n:tj|��rt>}
ntj |��rtB}
ndS||_||_"|j#|_$|j%|_&|
t,kr
|j'|_(nd|_(|j)|_*|
|_+||_,tZr6	t[j.|j$��d|_/n#t`$rYnwxYwtbr6	tcj2|j&��d|_3n#t`$rYnwxYw|
t>tBfvrftitd��rQtitd��r<tj5|j6��|_7tj8|j6��|_9|S)N�awxrMr�r$r�major�minor):rAr�r�r&�
splitdriver��sep�lstripr3r2r
�lstat�stat�fstat�fileno�st_mode�S_ISREG�st_ino�st_dev�st_nlinkrr�r@�S_ISDIRrN�S_ISFIFOr��S_ISLNKr��readlink�S_ISCHRr~�S_ISBLKrr��st_uidr*�st_gidr+�st_sizer(�st_mtimer)r8r9�pwd�getpwuidr,r>�grp�getgrgidr-r�rI�st_rdevr:rJr;)r�r��arcnamer��drvr3�statresr9�stmd�inoder8s           r;�
gettarinfozTarFile.gettarinfo(sB��	�	
���E�������<�D�
�?��G��w�)�)�'�2�2���W��/�/�"�&�#�.�.���.�.��%�%���,�,�.�.������?��#�
(��(�4�.�.����'�$�-�-����h�w�~�~�/�/�0�0�G�������<����	��^�W�^�4�E��#�
1��(8�1�(<�(<��T�[�(�(�W���E�8J�-J�-J����;�u�-�������8�1�)0�D�K��&��
�\�$�
�
�	��D�D�
�]�4�
 �
 �
	��D�D�
�\�$�
�
�	��D��{�4�(�(�H�H�
�\�$�
�
�	��D�D�
�\�$�
�
�	��D�D��4��������n����n����7�?�?�"�?�G�L�L��G�L��(��
����#����	�
� #��W�[� 9� 9�!� <��
�
���
�
�
���
�����	�
� #��W�[� 9� 9�!� <��
�
���
�
�
���
�����G�W�%�%�%��r�7�#�#�
=���G�(<�(<�
=�#%�8�G�O�#<�#<�� �#%�8�G�O�#<�#<�� ��s$�>$J#�#
J0�/J0�;$K � 
K-�,K-T)rc�8�	|���|�|}|D�]|}|r�ttj|j����t|jp|j�d|jp|j����|�	��s|�
��r"tdd|j|jfzz��ntd|j
z��tdtj|j��dd�z��t|j|���rdndz��|rV|���rtd|jz��|���rtd	|jz��t-����~dS)
NrMz%10sz%d,%dz%10dz%d-%02d-%02d %02d:%02d:%02dr�r�z-> zlink to )rAr}rOr(r�r,r*r-r+r�r�r:r;r(r��	localtimer)r�r�r�r9r�r|)r��verboserr3s    r;r�zTarFile.list�s���	�
	
���
�
�
��?��G��	�	�G��

A��D�M�'�,�7�7�8�8�8��w�}�'C���'C�'C�'.�}�'C���'C�E�F�F�F��=�=�?�?�7�g�m�m�o�o�7���$��(8�'�:J�'K�K�!M�N�N�N�N� ���� 5�6�6�6��9�"�n�W�]�;�;�B�Q�B�?�@�A�A�A�
���w�}�}���(F���B�G�H�H�H��
?��=�=�?�?�:����(8� 8�9�9�9��=�=�?�?�?��
�W�-=� =�>�>�>��G�G�G�G�)	�	r=��filterc���	|�d��|�|}|j�Ctj�|��|jkr|�dd|z��dS|�d|��|�||��}|�|�dd|z��dS|�(||��}|�|�dd|z��dS|���rAt|d��5}|�	||��ddd��dS#1swxYwYdS|�
��r�|�	|��|ryttj|����D]Y}|�
tj�||��tj�||��||����XdSdS|�	|��dS)	NrHr%ztarfile: Skipped %rr$ztarfile: Unsupported type %rztarfile: Excluded %rrro)rAr�r�r&r�_dbgrkr�r�addfiler�r"�listdir�addr�)r�r�rf�	recursiverpr3�fs       r;ruzTarFile.add�sI��	�	
���E�����?��G��9� �R�W�_�_�T�%:�%:�d�i�%G�%G��I�I�a�.��5�6�6�6��F��	�	�!�T�����/�/�$��0�0���?��I�I�a�7�$�>�?�?�?��F����f�W�o�o�G����	�	�!�3�d�:�;�;�;����=�=�?�?�	"��4��&�&�
)�!����W�a�(�(�(�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)����
)�
)�
)�
)�
)�
)��]�]�_�_�	"��L�L��!�!�!��
6���
�4� 0� 0�1�1�6�6�A��H�H�R�W�\�\�$��2�2�B�G�L�L��!�4L�4L�%�f��6�6�6�6�
6�
6�6�6�

�L�L��!�!�!�!�!s�<D � D$�'D$c�h�	|�d��tj|��}|�|j|j|j��}|j�|��|xjt|��z
c_|j
}|��t||j|j|���t|jt��\}}|dkr/|j�tt|z
z��|dz
}|xj|tzz
c_|j�|��dS)NrH)rqrr$)rArgrVrZr9r:r�rmrr5rrjr(rkrr6rr�)r�r3r�rcrqrrrss       r;rszTarFile.addfile�s��	�
	
���E�����)�G�$�$���m�m�D�K�����D�D������3�������s�3�x�x����� ��������w�|�W�M�M�M�M� &�w�|�Y� ?� ?��F�I��1�}�}���"�"�3�)�i�*?�#@�A�A�A��!����K�K�6�I�-�-�K�K�����G�$�$�$�$�$r=�.��
numeric_ownerc��	g}|�|}|D]r}|���r0|�|��tj|��}d|_|�|||���|����s|�d����|���|D]�}tj�	||j
��}	|�|||���|�||��|�
||���m#t$r/}|jdkr�|�dd|z��Yd}~��d}~wwxYwdS)N���	set_attrsr{c��|jSr3rC)rs r;�<lambda>z$TarFile.extractall.<locals>.<lambda>s��q�v�r=rrzr$�tarfile: %s)r�r�rgr��extract�sort�reverser�r&r�r��chown�utime�chmodrrrr)r�r&rr{�directoriesr3�dirpathr�s        r;�
extractallzTarFile.extractall�s���	����?��G��	6�	6�G��}�}���
%��"�"�7�+�+�+��)�G�,�,��$����L�L��$�g�m�m�o�o�2E�'4�
�
6�
6�
6�
6�	���-�-��.�.�.�������#�
	4�
	4�G��g�l�l�4���6�6�G�
4��
�
�7�G�=�
�I�I�I��
�
�7�G�,�,�,��
�
�7�G�,�,�,�,���
4�
4�
4��?�Q�&�&���I�I�a���!2�3�3�3�3�3�3�3�3�����	
4����
	4�
	4s�AD�
E�!%E�Er�c���	|�d��t|t��r|�|��}n|}|���r*t
j�||j��|_		|�
|t
j�||j��||���dS#t$ri}|j
dkr�|j�|�dd|jz��n,|�dd|j�d|j����Yd}~dSYd}~dSd}~wt"$r0}|j
dkr�|�dd|z��Yd}~dSd}~wwxYw)Nr�r~rr$r�z	tarfile: rw)rArirlr?r�r�r&r�r9r>�_extract_memberr�r�r�filenamerr�strerrorr)r��memberr&rr{r3r�s       r;r�zTarFile.extracts���	�	
���C�����f�c�"�"�	��n�n�V�,�,�G�G��G��=�=�?�?�	H�#%�7�<�<��g�6F�#G�#G�G� �	0�� � ��"�'�,�,�t�W�\�*J�*J�+4�/<�
!�
>�
>�
>�
>�
>���	N�	N�	N����"�"���:�%��I�I�a����!;�<�<�<�<��I�I�a�a�Q�Z�Z�Z����!L�M�M�M�M�M�M�M�M�M�=�<�<�<�<�<������	0�	0�	0����"�"���	�	�!�]�Q�.�/�/�/�/�/�/�/�/�/�����		0���s%�<C�
E,�AD/�/
E,�<%E'�'E,c���	|�d��t|t��r|�|��}n|}|���s|jtvr|�||��S|���s|�	��rQt|j
t��rtd���|�
|�|����SdS)Nr�z'cannot extract (sym)link as file object)rArirlr?r�r8r��
fileobjectr�r�r�r�r
�extractfile�_find_link_target)r�r�r3s   r;r�zTarFile.extractfileEs���	�	
���C�����f�c�"�"�	��n�n�V�,�,�G�G��G��=�=�?�?�	�g�l�/�A�A��?�?�4��1�1�1�
�]�]�_�_�	��
�
���	��$�,��0�0�
I�"�"K�L�L�L��'�'��(>�(>�w�(G�(G�H�H�H��4r=c��	|�d��}|�dtj��}tj�|��}|r3tj�|��stj|��|���s|�	��r&|�
d|j�d|j����n|�
d|j��|�
��r|�||���n|���r|�||��n�|���r|�||��n�|���s|���r|�||��nz|���s|�	��r|�||��n;|jt0vr|�||��n|�||��|rY|�|||��|�	��s0|�||��|�||��dSdSdS)NrMr$z -> )r�r�r�rLr&�dirnamer
�makedirsr�r�rrr�r9r��makefiler��makedirr��makefifor�r��makedev�makelinkr8r��makeunknownr�r�r�)r�r3�
targetpathrr{�	upperdirss      r;r�zTarFile._extract_memberesa��	� �&�&�s�+�+�
��'�'��R�V�4�4�
��G�O�O�J�/�/�	��	#�R�W�^�^�I�6�6�	#�
�K�	�"�"�"��=�=�?�?�	'�g�m�m�o�o�	'��I�I�a�w�|�|�|�W�5E�5E�F�G�G�G�G��I�I�a���&�&�&��=�=�?�?�
	/��M�M�'�:�.�.�.�.�
�]�]�_�_�	/��L�L��*�-�-�-�-�
�^�^�
�
�		/��M�M�'�:�.�.�.�.�
�]�]�_�_�	/��
�
���	/��L�L��*�-�-�-�-�
�]�]�_�_�	/��
�
���	/��M�M�'�:�.�.�.�.�
�\��
0�
0����W�j�1�1�1�1��M�M�'�:�.�.�.��	0��J�J�w�
�M�:�:�:��=�=�?�?�
0��
�
�7�J�/�/�/��
�
�7�J�/�/�/�/�/�		0�	0�
0�
0r=c�V�		tj|d��dS#t$rYdSwxYw)Nr})r��mkdir�FileExistsError�r�r3r�s   r;r�zTarFile.makedir�sH��	�	�
�H�Z��'�'�'�'�'���	�	�	��D�D�	���s��
(�(c	���	|j}|�|j��|j}t	|d��5}|j�i|jD]2\}}|�|��t
|||t|���3|�|j��|�	��nt
|||jt|��ddd��dS#1swxYwYdS)Nr)
r�r�r/rrr0rjrr(�truncate)r�r3r��sourcerq�targetrr(s        r;r�zTarFile.makefile�s8��	�������G�'�(�(�(��"��
�z�4�
(�
(�	N�F��~�)�$+�N�J�J�L�F�D��K�K��'�'�'�����i��I�I�I�I����G�L�)�)�)����!�!�!�!��F�F�G�L�)�W�M�M�M�	N�	N�	N�	N�	N�	N�	N�	N�	N�	N�	N�	N����	N�	N�	N�	N�	N�	Ns�BC�C�Cc�p�	|�||��|�dd|jz��dS)Nr$z9tarfile: Unknown file type %r, extracted as regular file.)r�rrr8r�s   r;r�zTarFile.makeunknown�sT��	�	
�
�
�g�z�*�*�*��	�	�!�2�4;�L�A�	B�	B�	B�	B�	Br=c�x�	ttd��rtj|��dStd���)N�mkfifozfifo not supported by system)r�r�r�rr�s   r;r�zTarFile.makefifo�s>��	��2�x� � �	?��I�j�!�!�!�!�!��=�>�>�>r=c�T�	ttd��rttd��std���|j}|���r|t
jz}n|t
jz}tj||tj	|j
|j����dS)N�mknodr�z'special devices not supported by system)r�r�rr�r�rO�S_IFBLK�S_IFCHRr�r�r:r;)r�r3r�r�s    r;r�zTarFile.makedev�s���	��r�7�#�#�	J�7�2�y�+A�+A�	J��H�I�I�I��|���=�=�?�?�	!��D�L� �D�D��D�L� �D�
���T���G�,�g�.>�?�?�	A�	A�	A�	A�	Ar=c�T�		|���rOtj�|��rtj|��tj|j|��dStj�|j��rtj	|j|��dS|�
|�|��|��dS#t$rL	|�
|�|��|��YdS#t$rtd��d�wxYwwxYw)Nz%unable to resolve link inside archive)r�r�r&�lexists�unlink�symlinkr9r
r>�linkr�r��symlink_exceptionr>rr�s   r;r�zTarFile.makelink�sY��	�	V��}�}���
5��7�?�?�:�.�.�*��I�j�)�)�)��
�7�+�Z�8�8�8�8�8��7�>�>�'�"6�7�7�5��G�G�0�*�=�=�=�=�=��(�(��)?�)?��)H�)H�)3�5�5�5�5�5�� �	V�	V�	V�
V��$�$�T�%;�%;�G�%D�%D�%/�1�1�1�1�1�1���
V�
V�
V�"�#J�K�K�QU�U�
V����		V���s*�A!C�&>C�&)C�
D'�)D�D#�#D'c�^�	ttd���rtj��dkr�|j}|j}|sp	t
rtj|j��d}n#t$rYnwxYw	trtj
|j��d}n#t$rYnwxYw	|���r-ttd��rtj
|||��dStj|||��dS#t$r}t!d��|�d}~wwxYwdSdS)N�geteuidrr%�lchownzcould not change owner)r�r�r�r+r*rc�getgrnamr-r>ra�getpwnamr,r�r�r�r�r)r�r3r�r{�g�ur�s       r;r�z
TarFile.chown�sk��	�
�2�y�!�!�	D�b�j�l�l�a�&7�&7���A���A� �

���;��L���7�7��:���������D�������;��L���7�7��:���������D�����
D��=�=�?�?�/�w�r�8�'<�'<�/��I�j�!�Q�/�/�/�/�/��H�Z��A�.�.�.�.�.���
D�
D�
D�"�#;�<�<�!�C�����
D����)	D�	D�&7�&7sB�&A'�'
A4�3A4�8&B�
B,�+B,�0?D	�1D	�	
D(�D#�#D(c��		tj||j��dS#t$r}t	d��|�d}~wwxYw)Nzcould not change mode)r�r�r�r�r�r�r3r�r�s    r;r�z
TarFile.chmod	sV��	�	?��H�Z���.�.�.�.�.���	?�	?�	?��6�7�7�Q�>�����	?���s��
>�9�>c��	ttd��sdS	tj||j|jf��dS#t$r}td��|�d}~wwxYw)Nr�z"could not change modification time)r�r�r�r)r�rr�s    r;r�z
TarFile.utime	sy��	��r�7�#�#�	��F�	L��H�Z�'�-���!?�@�@�@�@�@���	L�	L�	L��C�D�D�!�K�����	L���s�!=�
A�A�Ac�2�	|�d��|j�|j}d|_|S|j|j���krX|jdkrdS|j�|jdz
��|j�d��std���d}		|j�	|��}�n�#t$rL}|jr:|�dd|j|fz��|xjtz
c_Yd}~�iYd}~�nYd}~wt$rs}|jr:|�dd|j|fz��|xjtz
c_Yd}~��|jdkrtt|����d�Yd}~n�d}~wt $r|jdkrtd��d�Yn�t"$r2}|jdkrtt|����d�Yd}~n~d}~wt$$r"}tt|����d�d}~wt&$rD}	ddl}t+||j��rtd	|����d�|�#t.$r|�wxYwd}~wwxYw	|�|j�|��nd|_|S)
N�rarr$rhTr%z0x%X: %sz
empty filezzlib error: )rArrr�r�r�rlrr3r�r�rrrrrQrlr�r�r��	Exceptionr�rir�r�rr�r)r��mr3r�r�s     r;r�zTarFile.next	s6��	�	
���D������'�� �A�#�D���H��;�$�,�+�+�-�-�-�-��{�a����t��L���d�k�A�o�.�.�.��<�$�$�Q�'�'�
:�� 8�9�9�9��� 	�
��,�2�2�4�8�8����!�
�
�
��$���I�I�a��t�{�A�.>�!>�?�?�?��K�K�9�,�K�K��H�H�H�H����������&�
6�
6�
6��$�6��I�I�a��t�{�A�.>�!>�?�?�?��K�K�9�,�K�K��H�H�H�H��[�A�%�%�#�C��F�F�+�+��5�&�%�%�%�%�����#�
<�
<�
<��;�!�#�#�#�L�1�1�t�;�$�#�'�
6�
6�
6��;�!�#�#�#�C��F�F�+�+��5�$�#�#�#�#�����(�
2�
2�
2���A���'�'�T�1������
�
�
���K�K�K�!�!�T�Z�0�0� �'�(:�q�(:�(:�;�;��E����"�����G���������
����
����L����(�(�(�(��D�L��s`�,C�
I/�<D�
I/�&<F�'(F�(I/�>	I/�(G4�4
I/�H�
I/�,.I�
I'�'I*�*I/c�D�	|���}|�|d|�|���}|rtj�|��}t|��D]:}|r%tj�|j��}n|j}||kr|cS�;dSr3)rC�indexr�r&�normpath�reversedr�)r�r�r3�	normalizerr��member_names       r;r=zTarFile._getmemberZ	s���	��/�/�#�#�����5�w�}�}�W�5�5�5�6�G��	*��7�#�#�D�)�)�D��w�'�'�	�	�F��
*� �g�.�.�v�{�;�;���$�k���{�"�"��
�
�
�#�
	�	r=c�H�		|���}|�n�d|_dSr)r�r)r�r3s  r;rBz
TarFile._loadq	s3��	�	��i�i�k�k�G����	�����r=c��	|jrtd|jjz���|� |j|vrtd|jz���dSdS)Nz%s is closedzbad operation for mode %r)r�r�r4r�r�)r�r�s  r;rAzTarFile._check{	sb��	��;�	D��.�4�>�+B�B�C�C�C����	�� 5� 5��5��	�A�B�B�B��� 5� 5r=c�8�	|���rOd�tdtj�|j��|jf����}d}n	|j}|}|�||d���}|�td|z���|S)NrMT)r3r�zlinkname %r not found)
r�r�rpr�r&r�r�r9r=r>)r�r3r9�limitr�s     r;r�zTarFile._find_link_target�	s���	��=�=�?�?�	��x�x��t�b�g�o�o�g�l�.K�.K�W�M]�-^� _� _�`�`�H��E�E��'�H��E�����5�D��I�I���>��2�X�=�>�>�>��
r=c#�4K�	|jr|jEd{V��dSd}|j�|���}|dz
}|V�	|t	|j��kr|j|}n)|js |���}|s	d|_dSndS|dz
}|V��Y)Nrr$T)rrrr�r5)r�r�r3s   r;�__iter__zTarFile.__iter__�	s�����	��<�	��|�#�#�#�#�#�#�#��F�����'��i�i�k�k�G��Q�J�E��M�M�M�	��s�4�<�(�(�(�(��,�u�-����\�
��)�)�+�+����#'�D�L��F�����Q�J�E��M�M�M�	r=c�X�	||jkrt|tj���dSdS)N��file)rr|rz�stderr)r��level�msgs   r;rrzTarFile._dbg�	s7��	��D�J����#�C�J�'�'�'�'�'�'��r=c�.�|���|Sr3)rAr�s r;�	__enter__zTarFile.__enter__�	s�����
�
�
��r=c��|�|���dS|js|j���d|_dSr)r�r�r�r�)r�r8r��	tracebacks    r;�__exit__zTarFile.__exit__�	sD���<��J�J�L�L�L�L�L��#�
%���"�"�$�$�$��D�K�K�Kr=)
Nr�NNNNNNrQNNNN)r�N)r�Nr�)r�NN)NNN)Trr3)ryN)r�T)TFr)7r�r�r�rr
rrrrZr
r9r:rr3r-r�r�r�r;rrr1r5r9rr�r?rCrFrkr�rursr�r�r�r�r�r�r�r�r�r�r�r�r�r�r=rBrAr�r�rrr�r�r�r=r;rr�s��������
�E��K��L��J��F��H�
�F��G��J�AE�HL�>B�)-�b�b�b�b�^��#�t�Z�[/�[/�[/��[�[/�z�2�2�2��[�2������[��@�����[��6�����[��:����	��I�%�%�%�*	�	�	����?�?�?�a�a�a�a�F�D������@1"��1"�1"�1"�1"�1"�f%�%�%�%�2&4�%�&4�&4�&4�&4�&4�P$0��$0�$0�$0�$0�$0�L���@>B�&+�*0�*0�*0�*0�b���N�N�N� B�B�B�?�?�?�
A�
A�
A�V�V�V�4D�D�D�:?�?�?�L�L�L�<�<�<�B����.���C�C�C�C����&���>(�(�(��������r=rc��		t|d��r:|���}t|���}|�|��nt|��}|���dS#t
$rYdSwxYw)Nrl)r�TF)r�r�rr�r�r)r�r�r�s   r;rr�	s����

��4�� � �	��)�)�+�+�C��T�"�"�"�A��I�I�c�N�N�N�N��T�
�
�A�	���	�	�	��t�������u�u����s�A-A2�2
B�?Bc	���ddl}d}|�|���}|�ddddd�	��|�d
���}|�dd
dd���|�ddddd���|�ddddd���|�dddd���|���}|j��|j}t
|��r�t|d��5}|���t|���tj���ddd��n#1swxYwY|jr$td �
|����dSdS|�d!d"�
|����dS|j��|j}t
|��rQt �|d#��5}|�|j�$��ddd��dS#1swxYwYdS|�d!d"�
|����dS|j��Lt%|j��d!kr|jd}t&j}nKt%|j��d%kr|j\}}n(|�d!|�����t
|��r�t �|d#��5}|�|�&��ddd��n#1swxYwY|jrC|d'krd(�
|��}	nd)�
||��}	t|	��dSdS|�d!d"�
|����dS|j��|j�d��}
t&j�|
��\}}d*d*d+d+d,d,d,d,d-�}
||
vrd.|
|znd/}|j}t �|
|��5}|D]}|�|���	ddd��n#1swxYwY|jr&td0�
|
����dSdSdS)1Nrz3A simple command-line interface for tarfile module.)�descriptionz-vz	--verbose�
store_trueFzVerbose output)�action�default�helpT)�requiredz-lz--list�	<tarfile>zShow listing of a tarfile)�metavarr�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�r�z{!r} is a tar archive.r$z{!r} is not a tar archive.
r)rnr%)r&ryz{!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_argument�add_mutually_exclusive_group�
parse_args�testrrrCr|rzr�rnrZ�exitr�rr�r5r��curdir�format_helpr��create�popr&�splitextru)r�r��parserr��argsrnr��tfr�r��tar_name�_�ext�compressions�tar_mode�	tar_files�	file_names                 r;�mainr��	s����O�O�O�G�K�
�
$�
$��
$�
=�
=�F�
����k�,��-��/�/�/��/�/��/�>�>�E�	���t�X�{�7��9�9�9�	���t�[��<�=��?�?�?�
���t�Z�s�3�9��;�;�;�
���t�X�{�8��:�:�:������D��y���i���c�?�?�	G��c�3���
9�3���� � � ��c�n�n�&�&�S�Z�8�8�8�8�
9�
9�
9�
9�
9�
9�
9�
9�
9�
9�
9����
9�
9�
9�
9��|�
<��.�5�5�c�:�:�;�;�;�;�;�
<�
<�
�K�K��9�@�@��E�E�F�F�F�F�F�	
��	��i���c�?�?�	G����c�5�)�)�
.�R�������-�-�-�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.����
.�
.�
.�
.�
.�
.�
�K�K��9�@�@��E�E�F�F�F�F�F�	
��	!��t�|����!�!��,�q�/�C��Y�F�F�
���
�
�!�
#�
#��,�K�C����K�K��6�-�-�/�/�0�0�0��c�?�?�	G����c�5�)�)�
+�R��
�
�6�
�*�*�*�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+����
+�
+�
+�
+��|�
��S�=�=�3�:�:�3�?�?�C�C�2�39�6�#�v�3F�3F���c�
�
�
�
�
�

�
�
�K�K��9�@�@��E�E�F�F�F�F�F�	
��	 ��;�?�?�1�%�%����!�!�(�+�+���3���������
�
��03�l�/B�/B�4�,�s�+�+�+����K�	�
�\�\�(�H�
-�
-�	"��&�
"�
"�	����y�!�!�!�!�
"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"��<�	9��&�-�-�h�7�7�8�8�8�8�8�1
!�	 �.	9�	9sI�4AE�E�	E�H�H
�
H
�-L�L�L�P;�;P?�P?�__main__)]�version�
__author__�__credits__�builtinsrrrzr�rrirOr�rargr�rar�rc�AttributeError�NotImplementedErrorr�r��	NameError�__all__r6rr;r`rZr\r[rzr@r�r�r�r~rrNr��CONTTYPErcrbr�rnrur�rrrrr�r�r�r�r�rjrNr�r�r
�getfilesystemencodingr<rCrTr\rfrjr}r�rrrr	r
rr�r�r�rQr�r�r��objectr�r
�BufferedReaderr-rrrr�r�r�r=r;�<module>r
s[��:���6�
�H��
'�&�&�&�&�&�
�
�
�
�	�	�	�	�	�	�	�	�
�
�
�
���������
�
�
�
�����	�	�	�	���J�J�J�J������
�C�C�C�������J�J�J�J������
�C�C�C�����$�%8�9��	��'��#�����	�	�	��D�	����%�%�%�����	�
��^�
��	��������
�
����
��
��
��
��
������������
��
������
�
�
�
����H�g��G�X��W�g�#�%5�!�	#���(��>�+�
��/�
�
�	�.�
�9�8�8��
�
�
����
����7�d�?�?��H�H�(�s�(�*�*�H�0�0�0�&�&�&�
�
�
�(�N�
�
�
�
�<*�*�*�"&��$�����2���	�	�	�	�	�y�	�	�	�	�	�	�	�	�8�	�	�	�	�	�	�	�	��	�	�	�	�	�	�	�	�x�	�	�	�	�	�	�	�	�(�	�	�	�	�	�	�	�	�(�	�	�	�	�	�	�	�	�{�	�	�	�	�	�	�	�	�;�	�	�	�	�	�	�	�	�[�	�	�	�	�	�	�	�	��	�	�	�	�	�	�	�	�K�	�	�	���������0o�o�o�o�o�o�o�o�d�����6����<e�e�e�e�e�&�e�e�e�P"�"�"�"�"�2�$�"�"�"�W9�W9�W9�W9�W9�f�W9�W9�W9�tc�c�c�c�c�f�c�c�c�P!���$�|��U9�U9�U9�n�z����D�F�F�F�F�F��s3�8�A�A�A�A�A�A$�$A,�+A,

ZeroDay Forums Mini