� !A?hÞ´� ��dZdZdZdZddlmZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZ ddlZn #e$rdZYnwxYw ddlZn #e$rdZYnwxYweefZ eefz Zn #e$rYnwxYwgd�ZdZd Zed zZd Zd Zd Zd Z dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3e3Z4e"e#e$e%e(e)e*e&e'e+e,e-f Z5e"e#e*e-fZ6e+e,e-fZ7dZ8hd �Z9e:e:e:e;e;e;d!�Znej?��Z>d$�Z@d%�ZAd&�ZBd'e4fd(�ZCd)�ZDdedfd*�ZEd+�ZFGd,�d-eG��ZHGd.�d/eH��ZIGd0�d1eH��ZJGd2�d3eH��ZKGd4�d5eH��ZLGd6�d7eH��ZMGd8�d9eM��ZNGd:�d;eM��ZOGd<�d=eM��ZPGd>�d?eM��ZQGd@�dAeM��ZRGdB�dC��ZSGdD�dE��ZTGdF�dGeU��ZVGdH�dIeU��ZWGdJ�dKe jX��ZYGdL�dMeH��ZZGdN�dOeZ��Z[GdP�dQeZ��Z\GdR�dSeZ��Z]GdT�dUeZ��Z^GdV�dWeZ��Z_GdX�dYeZ��Z`eZeeIfZadhd[�Zbd\�Zcd]�Zdd^�Zeecedeed_�ZfeU��Zgejhd`��ZiGda�dbeU��ZjGdc�ddeU��Zkde�ZlekjZdf�Zmendgkr em��dSdS)iz,Read from and write to tar format archives. z0.9.0u"Lars Gustäbel ([email protected])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��|�td���|�||��}|d|�|t|��z tzzS)z8Convert a string to a null-terminated bytes object. Nzmetadata cannot contain None)� ValueError�encode�len�NUL)�s�length�encoding�errorss �4/opt/alt/python-internal/lib64/python3.11/tarfile.py�stnr<�sM�� �y��7�8�8�8� ����6�"�"�A� �W�f�W�:��#�a�&�&��C�/� /�/�c�x�|�d��}|dkr |d|�}|�||��S)z8Convert a null-terminated bytes object to a string. r�����N)�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) z/Convert a number field to a python number. r)���r$�rF��ascii�strict�0�invalid header)�ranger5rC�int�stripr3�InvalidHeaderError)r7�n�is r;�ntirS�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�B9rGc���|}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) z/Convert a python number to a number field. rrGr$z%0*orIrHrErFzoverflow in number field)rN�bytesr6r� bytearrayrM�insertr3)rQ�digits�format� original_nr7rRs r;�itnr[�s3���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)a�Calculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be different if there are chars in the buffer with the high bit set. So we calculate two checksums, unsigned and signed. rH� 148B8x356B� 148b8x356b)�sum�struct� unpack_from)�buf�unsigned_chksum� signed_chksums r;� calc_chksumsre�sM���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)zjCopy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. i@rN�unexpected end of data)�shutil� copyfileobj�divmodrM�readr5�write) �src�dstr8� exception�bufsize�blocks� remainder�brbs r;riri�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��eZdZdZdS)rzBase exception.N��__name__� __module__� __qualname__�__doc__�r=r;rrs���������Dr=rc��eZdZdZdS)r z%General exception for extract errors.Nr~r�r=r;r r s������/�/��Dr=r c��eZdZdZdS)rz&Exception for unreadable tar archives.Nr~r�r=r;rrs������0�0��Dr=rc��eZdZdZdS)r z.Exception for unavailable compression methods.Nr~r�r=r;r r s������8�8��Dr=r c��eZdZdZdS)r z=Exception for unsupported operations on stream-like TarFiles.Nr~r�r=r;r r s������G�G��Dr=r c��eZdZdZdS)r z!Base exception for header errors.Nr~r�r=r;r r s������+�+��Dr=r c��eZdZdZdS)�EmptyHeaderErrorzException for empty headers.Nr~r�r=r;r�r�!s������&�&��Dr=r�c��eZdZdZdS)�TruncatedHeaderErrorz Exception for truncated headers.Nr~r�r=r;r�r�$s������*�*��Dr=r�c��eZdZdZdS)�EOFHeaderErrorz"Exception for end of file headers.Nr~r�r=r;r�r�'s������,�,��Dr=r�c��eZdZdZdS)rPzException for invalid headers.Nr~r�r=r;rPrP*s������(�(��Dr=rPc��eZdZdZdS)�SubsequentHeaderErrorz3Exception for missing and invalid extended headers.Nr~r�r=r;r�r�-s������=�=��Dr=r�c�*�eZdZdZd�Zd�Zd�Zd�ZdS)� _LowLevelFilez�Low-level file object. Supports reading and writing. It is used instead of a regular file object for streaming access. c���tjtjtjztjzd�|}t td��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__:si������r�z�)�B�J�6� � � ��� �2�z� "� "� � �B�K� �D��'�$��e�,�,����r=c�8�tj|j��dS�N)r��closer��r�s r;r�z_LowLevelFile.closeCs�� ��������r=c�6�tj|j|��Sr�)r�rkr��r�r(s r;rkz_LowLevelFile.readFs���w�t�w��%�%�%r=c�:�tj|j|��dSr�)r�rlr��r�r7s r;rlz_LowLevelFile.writeIs�� ����!�����r=N)rr�r�r�r�r�rkrlr�r=r;r�r�4sZ�������� -�-�-����&�&�&�����r=r�c�\�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z d�Z d �Z dd �Z d �Z d �Zd�ZdS)�_Streama�Class that serves as an adapter between TarFile and a stream-like object. The stream-like object only needs to have a read() or write() method that works with bytes, and the method is accessed blockwise. Use of gzip or bzip2 compression is possible. A stream-like object could be for example: sys.stdin.buffer, sys.stdout.buffer, a socket, a tape device etc. _Stream is intended to be used only internally. c��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)z$Construct a _Stream object. TNF�*�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�fileobjrprb�pos�closed�zlib� ImportErrorr �crc32�crc�errorro� _init_read_gz�_init_write_gzr��dbuf�BZ2Decompressor�cmp�OSError� BZ2Compressor�lzma�LZMADecompressor� LZMAError�LZMACompressorr�) r�r�r�r�r�rpr�r�r�s r;r�z_Stream.__init__Xs��� ��� �?�#�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��&�&�(�(�(�(�(��'�'�)�)�)�)�)��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�8H�H�D�H�D5�55H�,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�@�|j�d|jj|jj |jjd��|_t jdttj ������}|� d|zdz��|j � d��r|j dd�|_ tj�|j ��|_ |� |j �d d ��t"z��dS) z6Initialize for writing with gzip compression. � r��-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)z&Write string s to the stream. r�r�N) r�r�r�r�r�r5r��compressr�r�s r;rlz _Stream.write�su�� �=�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�bdSdS)z]Write string s to the stream if a whole new block is ready to be written. N)rbr5rpr�rlr�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|j dz����|j s|j� ��dSdS#|j s|j� ��wwxYw) z[Close the _Stream object. No operation should be done on it afterwards. NTr�r�r=r�r�l��)r�r�r�rbr��flushr�rlr`r�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}|� |��|d zr% |�d��}|r |tkrn�$|d zr% |�d��}|r |tkrn�$|dzr|�d��dSdS)z:Initialize for reading a gzip compressed fileobj. r=r%s��not a gzip filer$�zunsupported compression method��rHrGT�N) r�� decompressobjr�r�r�� _Stream__readrr �ordrkr6)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��|jS)z3Return the stream's file pointer position. )r�r�s r;�tellz _Stream.tell�s ���x�r=rc��||jz dkrbt||jz |j��\}}t|��D]}|�|j���|�|��nt d���|jS)zXSet the stream's file pointer to pos. Negative seeking is forbidden. rz seeking backwards is not allowed)r�rjrprMrkr )r�r�rqrrrRs r;�seekz _Stream.seek�s��� ���>�Q� � � &�s�T�X�~�t�|� D� D� �F�I��6�]�]� (� (��� � �$�,�'�'�'�'� �I�I�i� � � � ��@�A�A� A��x�r=c�r�|�J�|�|��}|xjt|��z c_|S)z5Return the next size number of bytes from the stream.)�_readr�r5)r�r(rbs r;rkz _Stream.read s:�������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)z+Return size bytes from the stream. r�r=zinvalid compressed dataN)r�r�r5r�rbr�rkrpr�� decompressror�append�join)r�r(�c�trb�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� B6�!B1�1B6c�@�t|j��}|jg}||krO|j�|j��}|sn-|�|��|t|��z }||k�Od�|��}||d�|_|d|�S)zsReturn size bytes from stream. If internal buffer is empty, read another block from the stream. r=N)r5rbr�rkrpr�r�)r�r(r�r�rbs 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)rr�r�r�r�r�r�rlr�r�r�r�r�rkr�r�r�r=r;r�r�Ls������� � �D�D�D�L���F�F�F� ���/�/�/�%�%�%�,���>��� � � � �������6����r=r�c�*�eZdZdZd�Zd�Zd�Zd�ZdS)r�zsSmall proxy class that enables transparent compression detection for the Stream interface (mode 'r|*'). c�\�||_|j�t��|_dSr�)r�rk� BLOCKSIZErb)r�r�s r;r�z_StreamProxy.__init__Ds$���� ��<�$�$�Y�/�/����r=c�2�|jj|_|jSr�)r�rkrbr�s r;rkz_StreamProxy.readHs���L�%�� ��x�r=c���|j�d��rdS|jdd�dkr|jdd�dkrd S|j�d ��rd Sd S) Ns�r�r�sBZhr�� s1AY&SYr�)s]�s�7zXZr�r�)rb� startswithr�s r;r�z_StreamProxy.getcomptypeLsp�� �8� � �� /� /� ��4� �X�a��c�]�f� $� $���!�B�$��9�)D�)D��5� �X� � �!C� D� D� ��4��5r=c�8�|j���dSr�)r�r�r�s r;r�z_StreamProxy.closeVs�� � �������r=N)rr�r�r�r�rkr�r�r�r=r;r�r�?sZ��������0�0�0�����������r=r�c�`�eZdZdZd d�Zd�Zd�Zd�Zd�Zd�Z e j fd �Z d d �Z d �Zd �ZdS)� _FileInFilezA thin wrapper around an existing file object that provides a part of its data as an individual file object. Nc���||_||_||_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(�positionrxr�r�� map_index�mapr�)r�r�r r(� blockinfo�lastpos�realposs r;r�z_FileInFile.__init__cs���� ��� ��� ��� ��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��dSr�r�r�s r;r�z_FileInFile.flush|s�� �r=c��dS�NTr�r�s r;�readablez_FileInFile.readables���tr=c��dS�NFr�r�s r;�writablez_FileInFile.writable�s���ur=c�4�|j���Sr�)r��seekabler�s r;rz_FileInFile.seekable�s���|�$�$�&�&�&r=c��|jS)z*Return the current file position. )rr�s r;r�z_FileInFile.tell�� ���}�r=c���|tjkr)tt|d��|j��|_n�|tjkrG|dkrt|j|zd��|_nst|j|z|j��|_nP|tjkr1tt|j|z|j��d��|_ntd���|jS)z(Seek to a position in the file. rzInvalid argument) �io�SEEK_SET�min�maxr(r�SEEK_CUR�SEEK_ENDr3)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)z!Read data from the file. Nr=rTr$rg) r(rr"rrr5r�r�rkrr6) r�r(rb�data�start�stopr r8rss r;rkz_FileInFile.read�sn�� �<��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|��Sr�)rkr5)r�rsrbs 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=r�)rr�r�r�r�r�rrrr�r r!r�rkr,r�r�r=r;r r ]s��������� ?�?�?�?�2 � � �������'�'�'���� %'�K����� ����>��� ����r=r c���eZdZ�fd�Z�xZS)� ExFileObjectc���t|j|j|j|j��}t ���|��dSr�)r r�� offset_datar(�sparse�superr�)r��tarfile�tarinfor�� __class__s �r;r�zExFileObject.__init__�sB����g�o�w�/B�� �g�n�.�.�� ������!�!�!�!�!r=�rr�r�r�� __classcell__�r6s@r;r/r/�s8�������"�"�"�"�"�"�"�"�"r=r/c��eZdZdS)� FilterErrorN)rr�r�r�r=r;r;r;�s�������Dr=r;c���eZdZ�fd�Z�xZS)�AbsolutePathErrorc�j��||_t���d|j�d���dS)Nzmember z has an absolute path�r5r3r�r��r�r5r6s �r;r�zAbsolutePathError.__init__�s6����� � �����H�7�<�H�H�H�I�I�I�I�Ir=r7r9s@r;r=r=�sA�������J�J�J�J�J�J�J�J�Jr=r=c���eZdZ�fd�Z�xZS)�OutsideDestinationErrorc���||_||_t���|j�d|�d�dz��dS)Nz would be extracted to �, � which is outside the destination�r5�_pathr3r�r��r�r5r&r6s �r;r�z OutsideDestinationError.__init__�sT����� ��� � �����G�L�M�M�4�M�M�M�=�>� ?� ?� ?� ?� ?r=r7r9s@r;rBrB��8�������?�?�?�?�?�?�?�?�?r=rBc���eZdZ�fd�Z�xZS)�SpecialFileErrorc�h��||_t���|j�d���dS)Nz is a special filer?r@s �r;r�zSpecialFileError.__init__�s3����� � �����G�L�>�>�>�?�?�?�?�?r=r7r9s@r;rKrK�sA�������@�@�@�@�@�@�@�@�@r=rKc���eZdZ�fd�Z�xZS)�AbsoluteLinkErrorc�h��||_t���|j�d���dS)Nz is a link to an absolute pathr?r@s �r;r�zAbsoluteLinkError.__init__�s3����� � �����G�L�J�J�J�K�K�K�K�Kr=r7r9s@r;rNrN�sA�������L�L�L�L�L�L�L�L�Lr=rNc���eZdZ�fd�Z�xZS)�LinkOutsideDestinationErrorc���||_||_t���|j�d|�d�dz��dS)Nz would link to rDrErFrHs �r;r�z$LinkOutsideDestinationError.__init__�sT����� ��� � �����G�L�E�E�4�E�E�E�=�>� ?� ?� ?� ?� ?r=r7r9s@r;rQrQ�rIr=rQc���eZdZ�fd�Z�xZS)�LinkFallbackErrorc���||_||_t���d|j�d�d|�d�z��dS)Nzlink z would be extracted as a zcopy of z, which was rejectedrFrHs �r;r�zLinkFallbackError.__init__�s`����� ��� � �����J���J�J�J�B�d�B�B�B�C� D� D� D� D� Dr=r7r9s@r;rTrT�sA�������D�D�D�D�D�D�D�D�Dr=rTTc���i}|j}tj�|tjj���}|�dtjf��r,|j�dtjz��x}|d<tj�|��rt|���tj�tj� ||��tjj���}tj� ||g��|krt||���|j }|��|dz}|rr|���s|���r|dzs|dz}|dz}n:|���s|���rd}nt%|���||j kr||d<|�r�|j�d|d <|j�d|d <|j�d|d <|j�d|d <|���s|����rItj�|j��rt1|���tj�|j��}||jkr||d <|���rDtj� |tj�|��|j��}n%tj� ||j��}tj�|tjj���}tj� ||g��|krt7||���|S)N)rJ�/r�i��@i�����r�r*r+r,r-�linkname)r�r�r&�realpath� ALLOW_MISSINGr�sep�lstrip�isabsr=r�� commonpathrBr��isreg�islnk�isdir�issymrKr*r+r,r-rZrN�normpath�dirnamerQ)�member� dest_path�for_data� new_attrsr�� target_pathr�� normalizeds r;�_get_filtered_attrsrm�s(���I� �;�D��� � ��2�7�3H� �I�I�I� ����R�V�}�%�%�D�#)�;�#5�#5�c�B�F�l�#C�#C�C��y�� � �w�}�}�T���(� ��'�'�'��'�"�"�2�7�<�<� �4�#@�#@�*,�'�*?�#�A�A�K� �w���;� �2�3�3�y�@�@�%�f�k�:�:�:� �;�D� ���e�|�� � /��|�|�~�~� /������ /��e�|�#��F�N�D��� �������� /�6�<�<�>�>� /����'�v�.�.�.� �6�;� � � $�I�f� ��G� �:� !�#�I�e� � �:� !�#�I�e� � �<� #�!%�I�g� � �<� #�!%�I�g� � �<�<�>�>� G�V�\�\�^�^� G��w�}�}�V�_�-�-� 0�'��/�/�/���)�)�&�/�:�:�J��V�_�,�,�(2� �*�%��|�|�~�~� <� �g�l�l�9�+-�7�?�?�4�+@�+@�+1�?�<�<� � �!�g�l�l�9�+1�?�<�<� ��'�*�*�;�24�'�2G�+�I�I�K��w�!�!�;� �":�;�;�y�H�H�1�&�+�F�F�F� �r=c��|Sr�r�)rgrhs r;�fully_trusted_filterroBs�� �Mr=c�N�t||d��}|r|jdi|�ddi��S|S)NF�deepr��rmr��rgrhrjs r;� tar_filterrtEsC��#�F�I�u�=�=�I��7��v�~�6�6� �6�6��6�6�6�6� �Mr=c�N�t||d��}|r|jdi|�ddi��S|S)NTrqFr�rrrss r;� data_filterrvKsC��#�F�I�t�<�<�I��7��v�~�6�6� �6�6��6�6�6�6� �Mr=)� fully_trustedr�r(s([0-9]{1,20}) c �r�eZdZdZedUidd�dd�dd�dd �d d �d d �dd�dd�dd�dd�dd�dd�dd�dd�dd�d d!�d"d#�d$d%�d&d%�d'd%��ZdVd)�Zed*���Zej d+���Zed,���Z e j d-���Z d.�Z e e e e e e e e d/e d0� d1�Z d2�Zeed3fd4�Zd5�Zd6�Zd7�Zed8���Zd9�Zed:���Zed;���Zed<���Zed=���Zed>���Zed?���Zd@�ZdA�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�Z/dQ�Z0dR�Z1dS�Z2dT�Z3d%S)WraInformational class which holds the details about an archive member given by a tar header block. TarInfo objects are returned by TarFile.getmember(), TarFile.getmembers() and TarFile.gettarinfo() and are usually created internally. r�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.rZzcName of the target file name, which is only present in TarInfo objects of type LNKTYPE and SYMTYPE.r,z User name.r-z Group name.�devmajorzDevice major number.�devminorzDevice minor number.r zThe tar header starts here.r1zThe file's data starts here.� pax_headerszMA dictionary containing key-value pairs of an associated pax extended header.r2zSparse member information.r4N�_sparse_structs� _link_targetr�c���||_d|_d|_d|_d|_d|_d|_t|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_i|_dS)zXConstruct a TarInfo object. name is the optional name of the member. i�rr�N)r�r�r*r+r(r)ry�REGTYPErzrZr,r-r{r|r r1r2r}�r�r�s r;r�zTarInfo.__init__�s����� ��� ��������� ��� ��� ��� ��� ��� ��� ��� ��� ��� ������ �����r=c��|jS)z(In pax headers, "name" is called "path".�r�r�s r;r&z TarInfo.path�s ���y�r=c��||_dSr�r�r�s r;r&z TarInfo.path�s ���� � � r=c��|jS)z0In pax headers, "linkname" is called "linkpath".�rZr�s r;r'zTarInfo.linkpath�rr=c��||_dSr�r�)r�rZs r;r'zTarInfo.linkpath�s �� �� � � r=c�J�d|jj|jt|��fzS)Nz<%s %r at %#x>)r6rr��idr�s r;�__repr__zTarInfo.__repr__�s!���4�>�#:�4�9�R��X�X�"N�N�Nr=T) r�r)r�rZr*r+r,r-rq�_KEEPc � �| rtj|��} ntj|��} || ur|| _|| ur|| _|| ur|| _|| ur|| _|| ur|| _|| ur|| _|| ur|| _|| ur|| _ | S)zGReturn a deep copy of self with the given attributes replaced. ) �copy�deepcopyr�r)r�rZr*r+r,r-) r�r�r)r�rZr*r+r,r-rqr��results r;r�zTarInfo.replace�s��� � %��]�4�(�(�F�F��Y�t�_�_�F� �u� � ��F�K� �� � � �F�L� �u� � ��F�K� �5� � �&�F�O� �e� � ��F�J� �e� � ��F�J� �� � � �F�L� �� � � �F�L�� r=c�>�|j�d}n |jdz}|j||j|j|j|j|j|j|j|j |j |j |j d� }|dtkr+|d�d��s|dxxdz cc<|S)z9Return the TarInfo's attributes as a dictionary. N��) r�r�r*r+r(r)ryrzrZr,r-r{r|rzr�rW)r�r�r*r+r(r)ryrzrZr,r-r{r|�DIRTYPEr�)r�r��infos r;�get_infozTarInfo.get_info�s��� �9� ��D�D��9�v�%�D�� ������� �� �� �� �� �� �� �� �� � � �� ��<�7� "� "�4��<�+@�+@��+E�+E� "� ��L�L�L�C� �L�L�L�� r=�surrogateescapec�n�|���}|���D]\}}|�td|z����|tkr|�|||��S|t kr|�|||��S|tkr|�||��Std���)z� >�K�D�%��}� �!5��!<�=�=�=�� �\� !� !��+�+�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)z3Return the object as a ustar header block. �magicrZzlinkname is too longr��prefix) � POSIX_MAGICr5r4� LENGTH_LINKr3� LENGTH_NAME�_posix_split_name�_create_headerr)r�r�r9r:s r;r�zTarInfo.create_ustar_header�s���$��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)z:Return the object as a GNU header block sequence. r�r=rZr�) � GNU_MAGICr5r4r��_create_gnu_long_header�GNUTYPE_LONGLINKr��GNUTYPE_LONGNAMEr�r)r�r�r9r:rbs r;r�zTarInfo.create_gnu_headers���"��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)z�Return the object as a ustar header block. If it cannot be represented this way, prepend a pax extended header sequence with supplement information. r�r�r&rZr')r,r,� )r-r-r�rIrJ))r*rG)r+rG)r(� )r)r�FrrGr$Tr=r�)r�r}r�r�r�r4�UnicodeEncodeErrorr5� isinstance�float�round�str�_create_pax_generic_header�XHDTYPEr�r) r�r�r9r}r��hnamer8rX� needs_pax�val� val_is_float�val_intrbs r;r�zTarInfo.create_pax_headers��� $��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)zAReturn the object as a pax global header block sequence. r1)r��XGLTYPE)�clsr}s r;�create_pax_global_headerz TarInfo.create_pax_global_headerOs���-�-�k�7�G�L�L�Lr=c��|�d��}tdt|����D]�}d�|d|���}d�||d���}t|�||����t kr.t|�||����t krn��td���||fS)zUSplit a name longer than 100 chars into a prefix and a name part. rWr$Nzname is too long)�splitrMr5r�r4� LENGTH_PREFIXr�r3)r�r�r9r:� componentsrRr�s r;r�zTarInfo._posix_split_nameUs����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��|�d��ttfv}|rKt|�dd��d|��}t|�dd��d|��}n$t dd||��}t dd||��}|�dt ��}|�t d���t |�d d��d ||��t|�d d��d zd|��t|�d d��d|��t|�dd��d|��t|�dd��d|��t|�dd��d|��d|t |�dd��d ||��|�dt��t |�dd��d||��t |�dd��d||��||t |�dd��d||��g}tj dtzd� |����} t| t d���d} | dd�td| zd��z| dd�z} | S) z�Return a header block. info is a dictionary with file information, format must be one of the *_FORMAT constants. rzr{rrGr|r�NzTarInfo.type must not be Noner�rr�r�r*r+r(r�r)s rZr�r,r�r-r�rz%dsr=i����z%06orIi����)�get�CHRTYPE�BLKTYPEr[r<r�r3r�r`r�rr�rerU) r�rYr9r:�has_device_fieldsr{r|�filetype�partsrbrys r;r�zTarInfo._create_headeres��� !�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��8�8�F�G�,�,�� � ��<�=�=� =� ������$�$�c�8�V� <� <� ������#�#�f�,�a�� 8� 8� ������"�"�A�v� .� .� ������"�"�A�v� .� .� ������#�#�R�� 0� 0� �����!�$�$�b�&� 1� 1� � � �����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)zdReturn the string payload filled with zero bytes up to the next 512 byte border. r)rjr5rr6)�payloadrqrrs r;�_create_payloadzTarInfo._create_payload�s@�� #�3�w�<�<��;�;��� � �q�=�=� � �I�-��4� 4�G��r=c���|�||��tz}i}d|d<||d<t|��|d<t|d<|�|t ||��|�|��zS)zTReturn a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence for name. z ././@LongLinkr�rzr(r�)r4r6r5r�r�rr�)r�r�rzr9r:r�s r;r�zTarInfo._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| } �)|t t | ��d ��d z|zd z|zd zz }��i} d| d<|| d<t|��| d<t | d<|�| td d��|� |��zS)z�Return a POSIX.1-2008 extended or global header sequence that contains a list of keyword, value pairs. The values must be strings. Fr1rJTr=s21 hdrcharset=BINARY r�rrrI� �=� z././@PaxHeaderr�rzr(r�r�) r�r4r�r5r�rUr�r�rr�) r�r}rzr9�binary�keywordr��records�lrQrBr�s r;r�z"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�4� A�Ac���t|��dkrtd���t|��tkrtd���|�t ��tkrt d���t|dd���}|t|��vrtd���|��}t|dd�||��|_ t|dd ���|_ t|d d ���|_ t|d d ���|_t|d d ���|_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|j z|_ |S)zAConstruct a TarInfo object from a 512 byte bytes object. rz empty headerztruncated headerzend of file header��z bad checksumr�l�t�|��ii i)iIiQiYi�rWi�r�r��i�i�i�)$r5r�rr��countr6r�rSrerPrCr�r�r*r+r(r)ryrzrZr,r-r{r|�AREGTYPEr�r��GNUTYPE_SPARSErMr3r��boolr~rc�rstrip� GNU_TYPES)r�rbr9r:ry�objr�r��structsrRr �numbytes� isextended�origsizes r;�frombufzTarInfo.frombuf�sF�� �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 � K c���|j�t��}|�||j|j��}|j���tz |_|�|��S)zOReturn the next TarInfo object from TarFile object tarfile. ) r�rkrr�r9r:r�r � _proc_member)r�r4rbr�s r;� fromtarfilezTarInfo.fromtarfilesa�� �o�"�"�9�-�-���k�k�#�w�/���@�@���_�)�)�+�+�i�7�� �����(�(�(r=c�*�|jttfvr|�|��S|jtkr|�|��S|jt ttfvr|� |��S|� |��S)zYChoose the right processing method depending on the type and call it. ) rzr�r�� _proc_gnulongr�� _proc_sparser�r��SOLARIS_XHDTYPE� _proc_pax� _proc_builtin)r�r4s r;r�zTarInfo._proc_member1s��� �9�)�+;�<� <� <��%�%�g�.�.� .� �Y�.� (� (��$�$�W�-�-� -� �Y�7�G�_�=� =� =��>�>�'�*�*� *��%�%�g�.�.� .r=c��|j���|_|j}|���s|jt vr||�|j��z }||_|� |j |j |j ��|� ��r|j�d��|_|S)zfProcess a builtin type or an unknown type which will be treated as a regular file. rW)r�r�r1rarz�SUPPORTED_TYPES�_blockr(r �_apply_pax_infor}r9r:rcr�r�)r�r4r s r;r�zTarInfo._proc_builtin>s���#�?�/�/�1�1����!�� �:�:�<�<� -�4�9�O�;�;� �d�k�k�$�)�,�,� ,�F���� ���W�0�'�2B�G�N�S�S�S� �:�:�<�<� .�� �(�(��-�-�D�I�� r=c�6�|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��|_|S)zSProcess the blocks that hold a GNU longname or longlink member. NrW)r�rkr�r(r�r r�r�r rzr�rCr9r:r�r�rZrc� removesuffix)r�r4rb�nextr�s r;r�zTarInfo._proc_gnulongTs����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 � A6�A1�1A6c�2�|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)z8Process a GNU sparse header plus extra headers. r�r�r�i�)r~r�rkrrMrSr3r�r�r2r�r1r�r(r ) r�r4r�r�r�rbr�rRr r�s r;r�zTarInfo._proc_sparseosF��)-�(<�%���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��|j�|�|j����}|jt kr|j}n|j���}d}d}g}t|��|k�r�||dk�rst� ||��x}std��� t|� d����}n#t$rtd���wxYw|dkrtd���||zt|��krtd���|�d��|zdz } ||�d��dz| �} | �d��\} } } | r| dks || dkrtd���|�|| | f��| dkr|�| d kr|j}nd }||z }t|��|kr ||dk��s|�d }|D]q\}} } |�| d d |j��}|t,vr#|�| ||j|j��}n|�| d d |j��}|||<�r |�|��}n/#t0$r"}t3t5|����d�d}~wwxYwd |vr|�||��ndd |vr|�||��nI|�d ��dkr0|�d��dkr|�|||��|jt>t@fvr~|�!||j|j��|j"|_"d|vrM|j#}|�$��s|jtJvr||�|j��z }||_"|S)zVProcess an extended or global header as described in POSIX.1-2008. rNrLr$�r�rs hdrcharsetsBINARYr1�GNU.sparse.map�GNU.sparse.sizezGNU.sparse.major�1zGNU.sparse.minorrKr()&r�rkr�r(rzr�r}r�r5�_header_length_prefix_re�matchrPrN�groupr3r)rw� partitionr�r9�_decode_pax_fieldr:�PAX_NAME_FIELDSr�r r�r��_proc_gnusparse_01�_proc_gnusparse_00r��_proc_gnusparse_10r�r�r�r r1rar�)r�r4rbr}r�r9� raw_headersrr8�header_value_end_offset�keyword_and_value� raw_keyword�equals� raw_valuer�r�r�r�r s r;r�zTarInfo._proc_pax�sA�� �o�"�"�4�;�;�t�y�#9�#9�:�:�� �9�� � �!�-�K�K�!�-�2�2�4�4�K� ����� ��#�h�h��n�n��S��T�!1�!1�5�;�;�C��E�E�E�E� ;�(�)9�:�:�:� ;��U�[�[��^�^�,�,����� ;� ;� ;�(�)9�:�:�:� ;������z�z�(�)9�:�:�:��V�|�c�#�h�h�&�&�(�)9�:�:�:�&+�k�k�!�n�n�v�&=��&A� #� #�E�I�I�a�L�L�1�$4�5L�$L� M� �->�-H�-H��-N�-N� *�K���� ;�&�D�.�.�C�8O�4P�TX�4X�4X�(�)9�:�:�:� � � �� �Y�?� @� @� @��m�+�+��0@�� �)�)�&�/�H�H�&�H� �6�M�C�M�#�h�h��n�n��S��T�!1�!1�R � ��H�/:� )� )� *�F�K���,�,�[�'�7��N�$�$�G��/�)�)��.�.�y�(�G�DT���(�(����.�.�y�'�7���(�(��$)�K�� � � :��#�#�G�,�,�D�D��� :� :� :�'��A���/�/�T� 9����� :���� �{� *� *� � #� #�D�+� 6� 6� 6� 6� �+� -� -� � #� #�D�+� 6� 6� 6� 6� �_�_�/� 0� 0�C� 7� 7�K�O�O�L^�<_�<_�cf���� O� O� O��+�D�K���$�$��)���:�:�<�<�5�4�9�O�#C�#C��d�k�k�$�)�4�4�4�F�!'���� s$�8"C�C5�7J � J9�J4�4J9c���g}g}|D]�\}}}|dkrS |�t|��������B#t$rt d���wxYw|dkrS |�t|���������#t$rt d���wxYw��t t ||����|_dS)z?Process a GNU tar extended sparse header, version 0.0. sGNU.sparse.offsetrLsGNU.sparse.numbytesN)r�rNrAr3rP�list�zipr2)r�r�r �offsetsr��_r�r�s r;rzTarInfo._proc_gnusparse_00s ������!,� ?� ?� �A�w���.�.�.�?��N�N�3�u�|�|�~�~�#6�#6�7�7�7�7��!�?�?�?�,�-=�>�>�>�?�����2�2�2�?��O�O�C�� � ���$7�$7�8�8�8�8��!�?�?�?�,�-=�>�>�>�?����3� �3�w��1�1�2�2�� � � s�4A � A#�-4B"�"B<c ��d�|d�d��D��}tt|ddd�|ddd�����|_dS)z?Process a GNU tar extended sparse header, version 0.1. c�,�g|]}t|����Sr�)rN)�.0�xs r;� z.TarInfo._proc_gnusparse_01..s��K�K�K�Q�#�a�&�&�K�K�Kr=r��,Nr%r$)r�rrr2)r�r�r}r2s r;rzTarInfo._proc_gnusparse_01s]��L�K�+�.>�"?�"E�"E�c�"J�"J�K�K�K���3�v�c�c��c�{�F�1�4�a�4�L�9�9�:�:�� � � r=c �Z�d}g}|j�t��}|�dd��\}}t |��}t |��|dzkrwd|vr"||j�t��z }|�dd��\}}|�t |����t |��|dzk�w|j���|_tt|ddd�|ddd�����|_ dS)z?Process a GNU tar extended sparse header, version 1.0. Nr�r$r%) r�rkrr�rNr5r�r�r1rrr2)r�r�r}r4�fieldsr2rb�numbers r;r zTarInfo._proc_gnusparse_10s�������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) zoReplace fields with supplemental information from a previous pax extended or global header. zGNU.sparse.namer&r�r(zGNU.sparse.realsizerrWN) r��setattrrN� PAX_FIELDS�PAX_NUMBER_FIELDSr3r�r�r})r�r}r9r:r�r�s r;r�zTarInfo._apply_pax_info.s/��*�/�/�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%�% B4�3B4c�|� |�|d��S#t$r|�||��cYSwxYw)z1Decode a single field from a pax record. rJ)rA�UnicodeDecodeError)r�r�r9�fallback_encoding�fallback_errorss r;rzTarInfo._decode_pax_fieldEsV�� D��<�<��(�3�3� 3��!� D� D� D��<�<� 1�?�C�C� C� C� C� D���s �� ;�;c�T�t|t��\}}|r|dz }|tzS)z_Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024. r$)rjr)r�r�rqrrs r;r�zTarInfo._blockMs4��#�5�)�4�4��� � � � �a�K�F�� �!�!r=c��|jtvS�z4Return True if the Tarinfo object is a regular file.)rz� REGULAR_TYPESr�s r;raz TarInfo.isregVs���y�M�)�)r=c�*�|���Sr()rar�s r;�isfilezTarInfo.isfileZs���z�z�|�|�r=c�"�|jtkS)z!Return True if it is a directory.)rzr�r�s r;rcz TarInfo.isdir^����y�G�#�#r=c�"�|jtkS)z%Return True if it is a symbolic link.)rz�SYMTYPEr�s r;rdz TarInfo.issymbr-r=c�"�|jtkS)z!Return True if it is a hard link.)rz�LNKTYPEr�s r;rbz TarInfo.islnkfr-r=c�"�|jtkS)z(Return True if it is a character device.)rzr�r�s r;�ischrz TarInfo.ischrjr-r=c�"�|jtkS)z$Return True if it is a block device.)rzr�r�s r;�isblkz TarInfo.isblknr-r=c�"�|jtkS)zReturn True if it is a FIFO.)rz�FIFOTYPEr�s r;�isfifozTarInfo.isfifors���y�H�$�$r=c��|jduSr�)r2r�s r;�issparsezTarInfo.issparsevs���{�$�&�&r=c�8�|jtttfvS)zCReturn True if it is one of character device, block device or FIFO.)rzr�r�r7r�s r;�isdevz TarInfo.isdevys���y�W�g�x�8�8�8r=r�)r�)4rr�r�r��dict� __slots__r��propertyr&�setterr'r�r�r�r�rr r�r�r�r�� classmethodr�r�� staticmethodr�r�r�r�r�r�r�r�r�r�r�rrr r�rr�rar+rcrdrbr3r5r8r:r<r�r=r;rras{���������� � � �,�,� �!�!� �G�F� �H�G�  �  ��  � -�,�  �$�#� �>�>� �F�F� �� � �� � �*�)� � *�)�! �"/�.�# �$5�4�% �&9�9�' �*.�-�+ �,�$�- �.�$�/ �0�t�1 �I�6����0����X�� �[����[������X���_�!�!��_�!�O�O�O��%�e�e��u�E���������8���8*�H�EV�/�/�/�/�" I� I� I� M� M� M�8Q�8Q�8Q�t�M�M��[�M� ��� �'�'��\�'�R����\���*�*��[�*� �0-�0-��[�0-�d�<�<��[�<�|�)�)��[�)�( /� /� /����,���6���8w�w�w�r3�3�3�(;�;�;� ;�;�;� .�.�.�.D�D�D�"�"�"�*�*�*����$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�%�%�%�'�'�'�9�9�9�9�9r=rc���eZdZdZdZdZdZdZeZ e Z dZ e ZeZdZ d@d�Zedddefd ���ZedAd ���ZedBd ���ZedBd ���ZedCd���Zddddd�Zd�Zd�Zd�Zd�ZdDd�ZdEdd�d�Z dFdd�d�Z!dGd�Z"d�Z#dHddd!�d"�Z$d#�Z%dIddd!�d%�Z&d&�Z' dGd'�Z(d(�Z)d)�Z*d*�Z+ dJddd+�d,�Z,d-�Z-d.�Z.d/�Z/d0�Z0d1�Z1d2�Z2d3�Z3d4�Z4d5�Z5d6�Z6d7�Z7dKd8�Z8d9�Z9dGd:�Z:d;�Z;d<�Z�Z>d?�Z?dS)Lrz=The TarFile Class provides an interface to tar archives. rFr$Nr�r�c��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|_ |jdkr 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_d Sd Sd S#|js|j�,��d |_�xYw)a�Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for reading or writing data. If it can be determined, `mode' is overridden by `fileobj's mode. `fileobj' is not closed, when TarFile is closed. �rbzr+b�wb�xb�r��ar�r�!mode must be 'r', 'a', 'w' or 'x'rIr�FNr�r�Tr��rIr�r)-r3r��_moder�r&�exists� bltn_openr�r�r�r�r�rU�abspathr�rYr5� dereference� ignore_zerosr9r:rr}�debug� errorlevel� copybufsizer��members�_loadedr�r �inodes� firstmemberr�r�r�r�r�r rr�r�rlr5r�)r�r�r�r�rYr5rPrQr9r:r}rRrSrT�modesr�rbs 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�0L&�2 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 � |��} t d | �����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���)a�Open a tar archive for reading, writing or appending. Return an appropriate TarFile class. mode: 'r' or 'r:*' open for reading with transparent compression 'r:' open for reading exclusively uncompressed 'r:gz' open for reading with gzip compression 'r:bz2' open for reading with bzip2 compression 'r:xz' open for reading with lzma compression 'a' or 'a:' open for appending, creating the file if necessary 'w' or 'w:' open for writing without compression 'w:gz' open for writing with gzip compression 'w:bz2' open for writing with bzip2 compression 'w:xz' open for writing with lzma compression 'x' or 'x:' create a tarfile exclusively without compression, raise an exception if the file is already created 'x:gz' create a gzip compressed tarfile, raise an exception if the file is already created 'x:bz2' create a bzip2 compressed tarfile, raise an exception if the file is already created 'x:xz' create an lzma compressed tarfile, raise an exception if the file is already created 'r|*' open a stream of tar blocks with transparent compression 'r|' open an uncompressed stream of tar blocks for reading 'r|gz' open a gzip compressed stream of tar blocks 'r|bz2' open a bzip2 compressed stream of tar blocks 'r|xz' open an lzma compressed stream of tar blocks 'w|' open an uncompressed stream for writing 'w|gz' open a gzip compressed stream for writing 'w|bz2' open a bzip2 compressed stream for writing 'w|xz' open an lzma compressed stream for writing znothing to open)r��r:*c�&���j|dkS)N�taropen)� OPEN_METH)r�r�s �r;�not_compressedz$TarFile.open..not_compressed3s����}�X�.�)�;�;r=)�keyNr�z - method z: � z'file could not be opened successfully: �:r$r�r��|r�zmode must be 'r' or 'w'FrKzundiscernible mode)r3�sortedr^rxr�rr r�r�r�r�r�r�r�r])r�r�r�r�rp�kwargsr_� error_msgsr��func� saved_posr��error_msgs_summary�filemode�streamr�s` r;rz TarFile.open s����J� 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$�* A7�7C�2B?�?C�! F-�-Gc �>�|dvrtd���||||fi|��S)zCOpen uncompressed tar archive name for reading or writing. rHrJ)r3)r�r�r�r�res r;r]zTarFile.taropengs;�� �+� +� +��@�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) zkOpen gzip compressed tar archive name for reading or writing. Appending is not allowed. �r�r�r�mode must be 'r', 'w' or 'x'r)�GzipFilezgzip module is not availableNrsr�r�F) r3�gziprpr�r r�rr]r�r�) r�r�r�r�� compresslevelrerpr�r�s r;�gzopenzTarFile.gzopenosS�� �� &� &��;�<�<� <� 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��7�A � A5�A0�0A5�9B � C�+B?�?Cc �|�|dvrtd��� ddlm}n#t$rt d��d�wxYw||p|||���} |j|||fi|��}nY#t tf$r0}|���|dkrtd ��|��d}~w|����xYwd |_ |S) zlOpen bzip2 compressed tar archive name for reading or writing. Appending is not allowed. rnror)�BZ2Filer�N)rrr�znot a bzip2 fileF) r3r�rur�r r]r��EOFErrorr�rr�) r�r�r�r�rrrerur�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 ��7� A�B2�-+B�B2c �v�|dvrtd��� ddlm}m}n#t$rt d��d�wxYw||p|||���} |j|||fi|��}nT#|tf$r0} |���|dkrtd ��| ��d} ~ w|����xYwd |_ |S) zkOpen lzma compressed tar archive name for reading or writing. Appending is not allowed. rnror)�LZMAFiler�r�N)�presetr�znot an lzma fileF) r3r�ryr�r�r r]rvr�rr�) r�r�r�r�rzreryr�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 ��9� A� B/�*+B�B/r]rsrwr{)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)zlClose the TarFile. In write-mode, two finishing zero blocks are appended to the archive. NTrKr%r) r�r�r�rlr6rr rj� RECORDSIZEr�r�)r�rqrrs 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�#C1c�~�|�|�d����}|�td|z���|S)aReturn a TarInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version. rWNzfilename %r not found)� _getmemberr��KeyError)r�r�r5s r;� getmemberzTarFile.getmember�s?�� �/�/�$�+�+�c�"2�"2�3�3�� �?��2�T�9�:�:� :��r=c�n�|���|js|���|jS)z�Return the members of the archive as a list of TarInfo objects. The list has the same order as the members in the archive. )�_checkrV�_loadrUr�s r;� getmemberszTarFile.getmembers�s0�� � � � � � ��|� � �J�J�L�L�L��|�r=c�>�d�|���D��S)z�Return the members of the archive as a list of their names. It has the same order as the list returned by getmembers(). c��g|] }|j�� Sr�r�)rr5s r;rz$TarFile.getnames..s��>�>�>��� �>�>�>r=)r�r�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 zlink to )r�r�r|r�rjr,r*r-r+r3r5r{r|r(r)r�� localtimer�rcrdrZrbr{)r��verboserUr5s r;rz TarFile.listfs��� � � � � � � �?��G�� � �G�� E��<�'�� �-�-�-�-��� �g�l� ;� ;�<�<�<��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��=�(�� 5�6�6�6�6�� =�"&�.���"?�"?����"C�!D�E�E�E� �� �w�}�}���(F���B�G� H� H� H�� ?��=�=�?�?�:����(8� 8�9�9�9��=�=�?�?�?�� �W�-=� =�>�>�>� �G�G�G�G�5 � 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) a!Add the file `name' to the archive. `name' may be any type of file (directory, fifo, symbolic link, etc.). If given, `arcname' specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting `recursive' to False. `filter' is a function that expects a TarInfo object argument and returns the changed TarInfo object, if it returns None the TarInfo object will be excluded from the archive. r�Nr%ztarfile: Skipped %rr$ztarfile: Unsupported type %r�tarfile: Excluded %rrEr�)r�r�r�r&rO�_dbgr�rarN�addfilercrd�listdir�addr�)r�r�r�� recursiver�r5�fs r;r�z TarFile.add�sD�� � � �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�f�|�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)aAdd the TarInfo object `tarinfo' to the archive. If `fileobj' is given, it should be a binary file, and tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects directly, or by using gettarinfo(). r�N)rprr$)r�r�r�rYr9r:r�rlr r5rTrir(rjrr6rUr�)r�r5r�rbrprqrrs r;r�zTarFile.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=c���|�6|j}|�tSt|t��rt d���|St |��r|S t |S#t$rtd|�d���d�wxYw)NzrString names are not supported for TarFile.extraction_filter. Use a function such as tarfile.data_filter directly.zfilter z not found) �extraction_filterror�r�� TypeError�callable�_NAMED_FILTERSr�r3)r�r�s r;�_get_filter_functionzTarFile._get_filter_function�s��� �>��+�F��~�+�+��&�#�&�&� 7��6�7�7�7��M� �F� � � ��M� G�!�&�)� )��� G� G� G��;�v�;�;�;�<�<�$� F� G���s � A�A7�.)� numeric_ownerr�c�2�g}|�|��}|�|}|D]u}|�|||��\}} |��|���r|�| ��|�|||��� ||����v|�d�d���|D�]g} || |��}n:#t $r-} |�| t| ����Yd} ~ �Dd} ~ wwxYw|�|�| d���etj � ||j ��} tj | ��} n&#t$r|�|d��Y��wxYwtj| j��s|�|d����|�|| |� ��|�|| ��|�|| ����<#t*$r } |�| ��Yd} ~ ��ad} ~ wwxYwdS) a�Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmembers(). If `numeric_owner` is True, only the numbers for user/group names are used and not the names. The `filter` function will be called on each member just before extraction. It can return a changed TarInfo or None to skip the member. String names of common filters are accepted. N)� set_attrsr��filter_functionc��|jSr�r�)rIs r;�z$TarFile.extractall.. s��q�v�r=T)r`�reversezexcluded by filter�missingznot a directory)r�)r��_get_extract_tarinforcr�� _extract_one�sort�_FILTER_ERRORS�_log_no_directory_fixup�reprr�r&r�r�r��FileNotFoundErrorr�r�r��chown�utime�chmodr �_handle_nonfatal_error)r�r&rUr�r�� directoriesr�rgr5� unfiltered�exc�dirpathr�r�s r;� extractallzTarFile.extractall�s���� ��3�3�F�;�;�� �?��G�� ?� ?�F�"&�";�";����#/�#/� �G�Z�����}�}��� /��"�"�:�.�.�.� � � �g�t�7�=�=�?�?�7J�,9�.=� � ?� ?� ?� ?� ���-�-�t��<�<�<�&� /� /�J� /��-�o�j�$�?�?�G�G��%�����0�0��T�#�Y�Y�G�G�G��H�H�H�H����������?��0�0��1E�G�G�G���'�,�,�t�W�\�:�:����H�W�-�-�E�E��(�����0�0��)�D�D�D��H������|�E�M�2�2���0�0��:K�L�L�L��� � �7�G�=� �I�I�I�� � �7�G�,�,�,�� � �7�G�,�,�,�,��� /� /� /��+�+�A�.�.�.�.�.�.�.�.����� /����7 /� /sm�3 C�?G*� C7� #C2�-G*�2C7�7G*�%G*�9E� G*� E1�.G*�0E1�12G*�$AG*�* H�4H�Hc�J�|�dd|j�d|�d���dS)Nr%z!tarfile: Not fixing up directory z (�))r�r�)r�rg�reasons r;r�zTarFile._log_no_directory_fixup/ s:�� � � �!�!��;�;�;����(� )� )� )� )� )r=r�c��|�|��}|�|||��\}}|�|�||||��dSdS)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 TarInfo object. You can specify a different directory using `path'. File attributes (owner, mtime, mode) are set unless `set_attrs' is False. If `numeric_owner` is True, only the numbers for user/group names are used and not the names. The `filter` function will be called before extraction. It can return a changed TarInfo or None to skip the member. String names of common filters are accepted. N)r�r�r�) r�rgr&r�r�r�r�r5r�s r;�extractzTarFile.extract3 sf���3�3�F�;�;��"�7�7� �O�T�+�+���� � � � � �g�t�Y� � F� F� F� F� F� � r=c� �t|t��r|�|��}n|}d} |||��}nZ#ttf$r}|�|��Yd}~n/d}~wt $r}|�|��Yd}~nd}~wwxYw|� |�dd|j z��dS|� ��r>tj |��}tj �||j��|_||fS)z�Get (filtered, unfiltered) TarInfos from *member* *member* might be a string. Return (None, None) if not found. Nr%r�)NN)r�r�r�r�r;�_handle_fatal_errorr r�r�r�rbr�r�r&r�rZr)r�rgr�r&r��filteredr�s r;r�zTarFile._get_extract_tarinfoG s<�� �f�c� "� "� �����/�/�J�J��J��� +�&��z�4�8�8�H�H����%� (� (� (� � $� $�Q� '� '� '� '� '� '� '� '������ +� +� +� � '� '�� *� *� *� *� *� *� *� *����� +���� � � �I�I�a�/�*�/�A� B� B� B��:� �>�>� � � J��y��*�*�H�$&�G�L�L��x�7H�$I�$I�H� !���#�#s!� >�B�A)�) B�6B�Bc�X�|�d�� |�|tj�||j��||||���dS#t $r }|�|��Yd}~dSd}~wt$r }|� |��Yd}~dSd}~wwxYw)z�Extract from filtered tarinfo to disk. filter_function is only used when extracting a *different* member (e.g. as fallback to creating a symlink) r�)r�r�r��extraction_rootN) r��_extract_memberr�r&r�r�r�r�r r�)r�r5r&r�r�r�r�s r;r�zTarFile._extract_onee s��� � � �C���� +� � � ��"�'�,�,�t�W�\�*J�*J�+4�/<�1@�15� !� 7� 7� 7� 7� 7�� � (� (� (� � $� $�Q� '� '� '� '� '� '� '� '� '������ +� +� +� � '� '�� *� *� *� *� *� *� *� *� *����� +���s#�>A� B)�!A<�< B)� B$�$B)c�P�|jdkr�|�dd|z��dS)z=Handle non-fatal error (ExtractError) according to errorlevelr$� tarfile: %sN)rSr��r�r�s r;r�zTarFile._handle_nonfatal_errory s1�� �?�Q� � � � �I�I�a���*� +� +� +� +� +r=c�B�|jdkr�t|t��rO|j� |�dd|jz��dS|�dd|j�d|j����dS|�ddt |��j�d|����dS)z1Handle "fatal" error according to self.errorlevelrNr$r�z tarfile: rv)rSr�r��filenamer��strerrorrzrr�s r;r�zTarFile._handle_fatal_error� s��� �?�Q� � � � ��7� #� #� C��z�!�� � �!�]�Q�Z�7�8�8�8�8�8�� � �!�!�����Q�Z�Z�H�I�I�I�I�I� �I�I�a�a�T�!�W�W�-=�-=�-=�q�q�A� B� B� B� B� Br=c���|�d��t|t��r|�|��}n|}|���s|jt vr|�||��S|���s|� ��rQt|j t��rtd���|� |�|����SdS)a\Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file or a link, an io.BufferedReader object is returned. For all other existing members, None is returned. If `member' does not appear in the archive, KeyError is raised. r�z'cannot extract (sym)link as file objectN)r�r�r�r�rarzr�� fileobjectrbrdr�r�r � extractfile�_find_link_target)r�rgr5s r;r�zTarFile.extractfile� s��� � � �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=�r�r�c� �|�d��}|�dtj��}tj�|��}|r3tj�|��stj|��|���s|� ��r&|� d|j �d|j ����n|� d|j ��|� ��r|�||���n|���r|�||��n�|���r|�||��n�|���s|���r|�||��n}|���s|� ��r|�||||���n;|jt0vr|�||��n|�||��|rY|�|||��|� ��s0|�||��|�||��dSdSdS)z�Extract the filtered TarInfo object tarinfo to a physical file called targetpath. filter_function is only used when extracting a *different* member (e.g. as fallback to creating a symlink) rWr$z -> r�N)r�r�r�r]r&rfrM�makedirsrbrdr�r�rZra�makefilerc�makedirr8�makefifor3r5�makedev�makelink_with_filterrzr�� makeunknownr�r�r�)r�r5� targetpathr�r�r�r�� upperdirss r;r�zTarFile._extract_member� st�� �&�&�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��*� -� -� -� -� �]�]�_�_� /�� � ��� /� � %� %��� /� /� &� 1� 1� 1� 1��\�� 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��� |j�tj|��dStj|d��dS#t$r$tj�|��s�YdSwxYw)z,Make a directory called targetpath. Ni�)r�r��mkdir�FileExistsErrorr&rc�r�r5r�s r;r�zTarFile.makedir� s��� ��|�#����$�$�$�$�$����U�+�+�+�+�+��� � � ��7�=�=��,�,� �� � � � ���s�6�6�*A$�#A$c ���|j}|�|j��|j}t |d��5}|j�i|jD]2\}}|�|��t |||t|���3|�|j��|� ��nt |||jt|��ddd��dS#1swxYwYdS)z'Make a file called targetpath. rFN) r�r�r1rTrNr2rirr(�truncate)r�r5r��sourcerp�targetr r(s r;r�zTarFile.makefile� s5������ � �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�n�|�||��|�dd|jz��dS)zYMake a file from a TarInfo object with an unknown type at targetpath. r$z9tarfile: Unknown file type %r, extracted as regular file.N)r�r�rzr�s r;r�zTarFile.makeunknown sO�� � � �g�z�*�*�*� � � �!�2�4;�L�A� B� B� B� B� Br=c�v�ttd��rtj|��dStd���)z'Make a fifo called targetpath. �mkfifozfifo not supported by systemN)r�r�rr r�s r;r�zTarFile.makefifo s;�� �2�x� � � ?� �I�j� !� !� !� !� !��=�>�>� >r=c�Z�ttd��rttd��std���|j}|�d}|���r|t jz}n|t jz}tj||tj |j |j ����dS)z�?�?� A� A� A� A� Ar=c�2�|�||dd��Sr�)r�r�s r;�makelinkzTarFile.makelink% s���(�(��*�d�D�I�I�Ir=c��d} |���rOtj�|��rtj|��tj|j|��dStj�|j��rtj |j|��dSn#t$rd}YnwxYw |� |��}n!#t$r|rtd��d��wxYw|�|}nG|�td��� |||��}n(#t$r}t||j��|�d}~wwxYw|�|�||||���dSdS)a3Make a (symbolic) link called targetpath. If it cannot be created (platform limitation), we try to make a copy of the referenced file instead of a link. filter_function is only used when extracting a *different* member (e.g. as fallback to creating a link). FNTz%unable to resolve link inside archivez[makelink_with_filter: if filter_function is not None, extraction_root must also not be Noner�)rdr�r&�lexists�unlink�symlinkrZrMr�link�symlink_exceptionr�r�r r�rTr�r�) r�r5r�r�r��keyerror_to_extracterrorr�r��causes r;r�zTarFile.makelink_with_filter( s���$)� � ,��}�}��� ��7�?�?�:�.�.�*��I�j�)�)�)�� �7�+�Z�8�8�8����7�>�>�'�"6�7�7���G�G�0�*�=�=�=��F���!� ,� ,� ,�'+� $� $� $� ,���� ��/�/��8�8�J�J��� � � �'� �"�;�=�=�BF�G��  ���� � "�!�H�H��&�"�>�?�?�?� M�*�?�:��G�G����!� M� M� M�'����A�A�u�L����� M���� � � � � ��:�1@�1@� !� B� B� B� B� B� � s<�A!B(�'>B(�( B7�6B7�;C�C/� D� D;� D6�6D;c��ttd���r*tj��dk�r|j}|j}|s~ t r&|jrt j|j��d}n#t$rYnwxYw tr&|j rtj |j ��d}n#t$rYnwxYw|�d}|�d} |� ��r-ttd��rtj |||��dStj|||��dS#t$r}t!d��|�d}~wwxYwdSdS)z�Set owner of targetpath according to tarinfo. If numeric_owner is True, use .gid/.uid instead of .gname/.uname. If numeric_owner is False, fall back to .gid/.uid when the search based on name fails. �geteuidrr%Nr?�lchownzcould not change owner)r�r�rr+r*r�r-�getgrnamr�r�r,�getpwnamrdrr�r�r )r�r5r�r��g�ur�s r;r�z TarFile.chownZ s��� �2�y� !� !� D�b�j�l�l�a�&7�&7�� �A�� �A� � ���;�w�}�;��L���7�7��:���������D�������;�w�}�;��L���7�7��:���������D������y����y��� D��=�=�?�?�/�w�r�8�'<�'<�/��I�j�!�Q�/�/�/�/�/��H�Z��A�.�.�.�.�.��� D� D� D�"�#;�<�<�!�C����� D����1 D� D�&7�&7sB�-A.�. A;�:A;�?-B-�- B:�9B:�?D�D� D>�)D9�9D>c��|j�dS tj||j��dS#t$r}t d��|�d}~wwxYw)zASet file permissions of targetpath according to tarinfo. Nzcould not change mode)r�r�r�r�r )r�r5r�r�s r;r�z TarFile.chmod{ s`�� �<� � �F� ?� �H�Z��� .� .� .� .� .��� ?� ?� ?��6�7�7�Q� >����� ?���s�'� A�A�Ac��|j}|�dSttd��sdS tj|||f��dS#t$r}t d��|�d}~wwxYw)zBSet modification time of targetpath according to tarinfo. Nr�z"could not change modification time)r)r�r�r�r�r )r�r5r�r)r�s r;r�z TarFile.utime� s���� �� �=� �F��r�7�#�#� � �F� L� �H�Z�%��� 0� 0� 0� 0� 0��� L� L� L��C�D�D�!� K����� L���s�=� A�A�Ac�0�|�d��|j�|j}d|_|S|j|j���krX|jdkrdS|j�|jdz ��|j�d��std���d} |j� |��}�n�#t$rL}|j r:|� dd|j|fz��|xjtz c_Yd}~�iYd}~�nYd}~wt$rs}|j r:|� 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) z�Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. �raNrr$rgTr%z0x%X: %sz empty filez zlib error: )r�rXr r�r�r�rkrr5r�r�rQr�rrPr�r�r�r�� Exceptionr�r�r�r�rUr�rV)r��mr5r�r�s r;r�z TarFile.next� s1�� � � �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.��V�]�2�2�$�H��� *� �g�.�.�v�{�;�;� � �$�k� ��{�"�"�� � � �#� � &��W�%�%� %� &� &s�:� A �A c�F� |���}|�n�d|_dS)zWRead through the entire archive file and look for readable members. TN)r�rV)r�r5s r;r�z TarFile._load� s.�� ��i�i�k�k�G���� ��� � � r=c��|jrtd|jjz���|� |j|vrtd|jz���dSdS)znCheck if TarFile is still open, and if the operation's mode corresponds to TarFile's mode. z %s is closedNzbad operation for mode %r)r�r�r6rr�)r�r�s r;r�zTarFile._check s]�� �;� D��.�4�>�+B�B�C�C� C� � �� �� 5� 5��5�� �A�B�B� B� � � 5� 5r=c�6�|���rOd�tdtj�|j��|jf����}d}n |j}|}|�||d���}|�td|z���|S)zZFind the target member of a symlink or hardlink member in the archive. rWNT)r5r"zlinkname %r not found) rdr�r�r�r&rfr�rZrr�)r�r5rZ�limitrgs 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#�2K�|jr|jEd{V��dSd}|j�|���}|dz }|V� |t |j��kr|j|}n)|js |���}|s d|_dSndS|dz }|V��Y)z$Provide an iterator object. Nrr$T)rVrUrXr�r5)r�r r5s 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�V�||jkrt|tj���dSdS)z.Write debugging output to sys.stderr. ��fileN)rRr{ry�stderr)r��level�msgs r;r�z TarFile._dbgA s4�� �D�J� � � �#�C�J� '� '� '� '� '� '� � r=c�.�|���|Sr�)r�r�s r;� __enter__zTarFile.__enter__G s�� � � � � � �� r=c��|�|���dS|js|j���d|_dSr)r�r�r�r�)r�rzr�� tracebacks r;�__exit__zTarFile.__exit__K sD�� �<� �J�J�L�L�L�L�L��#� %�� �"�"�$�$�$��D�K�K�Kr=) Nr�NNNNNNr�NNNN)r�N)r�Nr�)r�NN)NNN�Trr�)r�N)r�T)TFr)@rr�r�r�rRrPrQrSrrYr r9r:rr5r/r�r�r�rAr}rr]rsrwr{r^r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r r�r�r�r�r�rr�r�r�r*r�r2r5r�r=r;rr~s1�������� �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�$�$�$�$�$�L1"��1"�1"�1"�1"�1"�f%�%�%�%�2G�G�G�$C/�%��C/�C/�C/�C/�C/�J)�)�)�G���G�G�G�G�G�($�$�$�>&*�+�+�+�+�(,�,�,� C� C� C����@>B�&+�10�@D�(,�10�10�10�10�10�p � � �N�N�N� B�B�B�?�?�?�A�A�A�$J�J�J�0B�0B�0B�dD�D�D�B?�?�?� L� L� L�<�<�<�B&&�&&�&&�&&�P���C�C�C�C����&���>(�(�(� �������r=rc�� t|d��r:|���}t|���}|�|��nt|��}|���dS#t $rYdSwxYw)z�Return True if name points to a tar archive that we are able to handle, else return False. 'name' should be a string, file, or file-like object. rk)r�TF)r�r�rr�r�r)r�r�r�s r;rrY s��� � �4�� � � ��)�)�+�+�C��T�"�"�"�A� �I�I�c�N�N�N�N��T� � �A� ��� � � ��t�� �����u�u����s�A-A1�1 A?�>A?c �z �ddl}d}|�|���}|�ddddd� ��|�d d td � ��|�d���}|�dddd���|�ddddd���|�ddddd���|�dd dd!���|���}|jr|j�|�d"d#��|j ��|j }t|��r�t|d$��5}|� ��t|� ��tj�%��ddd��n #1swxYwY|jr$td&�|����dSdS|�d"d'�|����dS|j��|j}t|��rQt&� |d(��5}|�|j�)��ddd��dS#1swxYwYdS|�d"d'�|����dS|j��Rt)|j��d"kr|jd}t*j}nKt)|j��d*kr |j\}}n(|�d"|�����t|��r�t&� |d(��5}|�||j�+��ddd��n #1swxYwY|jrC|d,krd-�|��} nd.�||��} t| ��dSdS|�d"d'�|����dS|j��|j�d��} t*j�| ��\} } d/d/d0d0d1d1d1d1d2�} | | vr d3| | znd4}|j}t&� | |��5}|D]}|�|��� ddd��n #1swxYwY|jr&td5�| ����dSdSdS)6Nrz3A simple command-line interface for tarfile module.)� descriptionz-vz --verbose� store_trueFzVerbose output)�action�default�helpz--filterz zFilter for extraction)�metavar�choicesr=T)�requiredz-lz--list� zShow listing of a tarfile)r>r=z-ez --extract�+)rAz zExtract tarfile into target dir)�nargsr>r=z-cz--create)zzzCreate tarfile from sourcesz-tz--testzTest if a tarfile is validr$z&--filter is only valid for extraction r�r,z{!r} is a tar archive.z{!r} is not a tar archive. r[)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{ryr.r�rYrrr5r��curdir� format_helpr��create�popr&�splitextr�)rDr9�parserr�argsrmr��tfrKr0�tar_namer�ext� compressions�tar_mode� tar_files� file_names r;�mainrYn s$���O�O�O�G�K� � $� $�� $� =� =�F� ����k�,��-��/�/�/� ��� �N� .�4��6�6�6� � /� /�� /� >� >�E� ���t�X�{�7��9�9�9� ���t�[��<�=��?�?�?� ���t�Z�s�3�9��;�;�;� ���t�X�{�8��:�:�:� � � � � �D� �{�B�t�|�+�� � �A�@�A�A�A� �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�6AF�F� F�I�I �I �/M�M�M�R�R� R�__main__r6)or��version� __author__� __credits__�builtinsrrNryr�r rhr�r�r`r��re�warningsr�r�r��AttributeError�NotImplementedErrorrr�� NameError�__all__r6rr}r�r�r�r�r�r�r�r1r/r�r�r�r7�CONTTYPEr�r�r�r�r�r�rrrrr�r)r�r rr�rNr!r�r �getfilesystemencodingr<rCrSr[rerir|rrr rr r r r�r�r�rPr�r�r��objectr�r �BufferedReaderr/r;r=rBrKrNrQrTr�rmrortrvr�r��compilerrrrrYrr�r=r;�rjs<��:����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� � � ���������0p�p�p�p�p�p�p�p�f�����6����