§
    ¸)ýf
^  ã                   ór  — d Z ddlZddlZddlZddlZddlZddlZddlZddlZg d¢Z	d\  Z
ZZZZd\  ZZdZdZdZd	edddfd
„Zd„ Z G d„ d¦  «        Z G d„ de¦  «        Z G d„ dej        ¦  «        Zd„ Zd„ Z G d„ dej        ¦  «        Z	 ddede fd„Z!efddœd„Z"d„ Z#d„ Z$e%dk    r e$¦   «          dS dS )z‘Functions that read and write gzipped files.

The user of the file doesn't have to worry about the compression,
but random access is not allowed.é    N)ÚBadGzipFileÚGzipFileÚopenÚcompressÚ
decompress)é   é   é   é   é   )r   r	   r   é   é	   Úrbc                 ó"  — d|v rd|v rt          d|›�¦  «        ‚n3|�t          d¦  «        ‚|�t          d¦  «        ‚|�t          d¦  «        ‚|                     dd¦  «        }t          | t          t          t
          j        f¦  «        rt          | ||¦  «        }nBt          | d	¦  «        st          | d
¦  «        rt          d||| ¦  «        }nt          d¦  «        ‚d|v r+t          j        |¦  «        }t          j        ||||¦  «        S |S )a  Open a gzip-compressed file in binary or text mode.

    The filename argument can be an actual filename (a str or bytes object), or
    an existing file object to read from or write to.

    The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or "ab" for
    binary mode, or "rt", "wt", "xt" or "at" for text mode. The default mode is
    "rb", and the default compresslevel is 9.

    For binary mode, this function is equivalent to the GzipFile constructor:
    GzipFile(filename, mode, compresslevel). In this case, the encoding, errors
    and newline arguments must not be provided.

    For text mode, a GzipFile object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error handling
    behavior, and line ending(s).

    ÚtÚbzInvalid mode: Nz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary modeÚ ÚreadÚwritez1filename must be a str or bytes object, or a file)Ú
ValueErrorÚreplaceÚ
isinstanceÚstrÚbytesÚosÚPathLiker   ÚhasattrÚ	TypeErrorÚioÚtext_encodingÚTextIOWrapper)ÚfilenameÚmodeÚcompresslevelÚencodingÚerrorsÚnewlineÚgz_modeÚbinary_files           úP/home/blender/git/blender-v430/install_release/4.3/python/lib/python3.11/gzip.pyr   r      s2  € ð( ˆd€{€{Ø�$ˆ;ˆ;Ý�*°4°4Ð9Ñ:Ô:Ð:ð ð ÐÝÐOÑPÔPÐPØÐÝÐMÑNÔNÐNØÐÝÐNÑOÔOÐOà�lŠl˜3 Ñ#Ô#€GÝ�(�S¥%­¬Ð5Ñ6Ô6ð MÝ˜x¨°-Ñ@Ô@ˆˆÝ	�˜6Ñ	"Ô	"ð M¥g¨h¸Ñ&@Ô&@ð MÝ˜t W¨m¸XÑFÔFˆˆåÐKÑLÔLÐLà
ˆd€{€{ÝÔ# HÑ-Ô-ˆÝÔ ¨X°v¸wÑGÔGÐGàÐó    c                 óV   — |                       t          j        d|¦  «        ¦  «         d S )Nz<L)r   ÚstructÚpack)ÚoutputÚvalues     r*   Úwrite32ur1   F   s(   € ð ‡L‚L•”˜T 5Ñ)Ô)Ñ*Ô*Ð*Ð*Ð*r+   c                   ó4   — e Zd ZdZd	d„Zd„ Zd	d„Zd„ Zd„ ZdS )
Ú_PaddedFilezªMinimal read-only file object that prepends a string to the contents
    of an actual file. Shouldn't be used outside of gzip.py, as it lacks
    essential functionality.r+   c                 óX   — || _         t          |¦  «        | _        || _        d| _        d S ©Nr   )Ú_bufferÚlenÚ_lengthÚfileÚ_read)ÚselfÚfÚprepends      r*   Ú__init__z_PaddedFile.__init__P   s(   € ØˆŒÝ˜7‘|”|ˆŒØˆŒ	ØˆŒ
ˆ
ˆ
r+   c                 óF  — | j         €| j                             |¦  «        S | j         |z   | j        k    r+| j         }| xj         |z  c_         | j        || j         …         S | j         }d | _         | j        |d …         | j                             || j        z
  |z   ¦  «        z   S ©N)r:   r9   r   r8   r6   )r;   Úsizer   s      r*   r   z_PaddedFile.readV   sŸ   € ØŒ:ÐØ”9—>’> $Ñ'Ô'Ð'ØŒ:˜Ñ ¤Ò,Ð,Ø”:ˆDØˆJŒJ˜$ÑˆJŒJØ”<  T¤Z Ô0Ð0à”:ˆDØˆDŒJØ”<   Ô&Ø”9—>’> $ t¤|Ñ"3°DÑ"8Ñ9Ô9ñ:ð :r+   c                 ó¢   — | j         €|| _        n| xj         t          |¦  «        z  c_         d S t          | j        ¦  «        | _        d| _         d S r5   )r:   r6   r7   r8   )r;   r=   s     r*   r=   z_PaddedFile.prependc   sJ   € ØŒ:ÐØ"ˆDŒLˆLàˆJŒJ�#˜g™,œ,Ñ&ˆJŒJØˆFÝ˜4œ<Ñ(Ô(ˆŒØˆŒ
ˆ
ˆ
r+   c                 óR   — d | _         d | _        | j                             |¦  «        S r@   )r:   r6   r9   Úseek)r;   Úoffs     r*   rD   z_PaddedFile.seekl   s$   € ØˆŒ
ØˆŒØŒy�~Š~˜cÑ"Ô"Ð"r+   c                 ó   — dS ©NT© ©r;   s    r*   Úseekablez_PaddedFile.seekableq   ó   € Øˆtr+   N)r+   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r>   r   r=   rD   rJ   rH   r+   r*   r3   r3   K   ss   € € € € € ð ð  ðð ð ð ð:ð :ð :ðð ð ð ð#ð #ð #ð
ð ð ð ð r+   r3   c                   ó   — e Zd ZdZdS )r   z6Exception raised in some cases for invalid gzip files.N)rL   rM   rN   rO   rH   r+   r*   r   r   u   s   € € € € € Ø@Ð@Ð@Ð@r+   r   c                   óì   — e Zd ZdZdZddeddfd„Zed„ ¦   «         Zed„ ¦   «         Z	d„ Z
d„ Zd„ Zd	„ Zdd„Zdd„Zd„ Zed„ ¦   «         Zd„ Zej        fd„Zd„ Zd„ Zd„ Zd„ Zd„ Zej        fd„Zdd„ZdS )r   a
  The GzipFile class simulates most of the methods of a file object with
    the exception of the truncate() method.

    This class only supports opening files in binary mode. If you need to open a
    compressed file in text mode, use the gzip.open() function.

    Nc                 óä  — |r*d|v sd|v r"t          d                     |¦  «        ¦  «        ‚|r	d|vr|dz  }|€t          j        ||pd¦  «        x}| _        |€0t          |dd¦  «        }t          |t          t          f¦  «        sd}nt          j
        |¦  «        }|}|€t          |d	d¦  «        }|                     d
¦  «        r<t          | _        t          |¦  «        }t          j        |¦  «        | _        || _        n¾|                     d¦  «        r‡|€ ddl}|                     dt*          d¦  «         t,          | _        |                      |¦  «         t1          j        |t0          j        t0          j         t0          j        d¦  «        | _        || _        n"t          d                     |¦  «        ¦  «        ‚|| _        | j        t,          k    r|                       |¦  «         dS dS )aG  Constructor for the GzipFile class.

        At least one of fileobj and filename must be given a
        non-trivial value.

        The new class instance is based on fileobj, which can be a regular
        file, an io.BytesIO object, or any other object which simulates a file.
        It defaults to None, in which case filename is opened to provide
        a file object.

        When fileobj is not None, the filename argument is only used to be
        included in the gzip file header, which may include the original
        filename of the uncompressed file.  It defaults to the filename of
        fileobj, if discernible; otherwise, it defaults to the empty string,
        and in this case the original filename is not included in the header.

        The mode argument can be any of 'r', 'rb', 'a', 'ab', 'w', 'wb', 'x', or
        'xb' depending on whether the file will be read or written.  The default
        is the mode of fileobj if discernible; otherwise, the default is 'rb'.
        A mode of 'r' is equivalent to one of 'rb', and similarly for 'w' and
        'wb', 'a' and 'ab', and 'x' and 'xb'.

        The compresslevel argument is an integer from 0 to 9 controlling the
        level of compression; 1 is fastest and produces the least compression,
        and 9 is slowest and produces the most compression. 0 is no compression
        at all. The default is 9.

        The mtime argument is an optional numeric timestamp to be written
        to the last modification time field in the stream when compressing.
        If omitted or None, the current time is used.

        r   ÚUzInvalid mode: {!r}r   Nr   Únamer   r#   Úr)ÚwÚaÚxr   z‡GzipFile was opened for writing, but this will change in future Python releases.  Specify the mode argument for opening it for writing.r	   )!r   ÚformatÚbuiltinsr   Ú	myfileobjÚgetattrr   r   r   r   ÚfspathÚ
startswithÚREADr#   Ú_GzipReaderr   ÚBufferedReaderr6   rT   ÚwarningsÚwarnÚFutureWarningÚWRITEÚ_init_writeÚzlibÚcompressobjÚDEFLATEDÚ	MAX_WBITSÚDEF_MEM_LEVELr   Ú_write_mtimeÚfileobjÚ_write_gzip_header)	r;   r"   r#   r$   rm   ÚmtimeÚorigmodeÚrawrb   s	            r*   r>   zGzipFile.__init__†   s  € ðF ð 	@�S˜D�[�[ C¨4 K KÝÐ1×8Ò8¸Ñ>Ô>Ñ?Ô?Ð?Øð 	�C˜t�O�OØ�C‰KˆDØˆ?Ý'/¤}°X¸t¸|ÀtÑ'LÔ'LÐLˆG�d”nØÐÝ˜w¨°Ñ3Ô3ˆHÝ˜h­­e¨Ñ5Ô5ð Ø�øå”y Ñ*Ô*ˆHØˆØˆ<Ý˜7 F¨DÑ1Ô1ˆDà�?Š?˜3ÑÔð 	@ÝˆDŒIÝ˜gÑ&Ô&ˆCÝÔ,¨SÑ1Ô1ˆDŒLØ ˆDŒIˆIà�_Š_˜_Ñ-Ô-ð 	@ØÐØ���Ø—’ðLõ " 1ñ	&ô &ð &õ
 ˆDŒIØ×Ò˜XÑ&Ô&Ð&Ý Ô,¨]Ý-1¬]Ý.2¬n¨_Ý-1Ô-?Ø-.ñ	0ô 0ˆDŒMð
 !&ˆDÔÐåÐ1×8Ò8¸Ñ>Ô>Ñ?Ô?Ð?àˆŒàŒ9�ÒÐØ×#Ò# MÑ2Ô2Ð2Ð2Ð2ð Ðr+   c                 óª   — dd l }|                     dt          d¦  «         | j        t          k    r| j        dd …         dk    r
| j        dz   S | j        S )Nr   zuse the name attributer	   éýÿÿÿú.gz)rb   rc   ÚDeprecationWarningr#   re   rT   )r;   rb   s     r*   r"   zGzipFile.filename×   sY   € àˆˆˆØ�ŠÐ.Õ0BÀAÑFÔFÐFØŒ9�ÒÐ $¤)¨B¨C¨C¤.°EÒ"9Ð"9Ø”9˜uÑ$Ð$ØŒyÐr+   c                 ó$   — | j         j        j        S )z0Last modification time read from stream, or None)r6   rq   Ú_last_mtimerI   s    r*   ro   zGzipFile.mtimeß   s   € ð Œ|ÔÔ+Ð+r+   c                 óŠ   — t          | j        ¦  «        }d|dd…         z   dz   t          t          | ¦  «        ¦  «        z   dz   S )Nz<gzip r   éÿÿÿÿú ú>)Úreprrm   ÚhexÚid)r;   Úss     r*   Ú__repr__zGzipFile.__repr__ä   s?   € Ý�”ÑÔˆØ˜!˜A˜b˜Dœ'Ñ! CÑ'­#­b°©h¬h©-¬-Ñ7¸#Ñ=Ð=r+   c                 ó~   — || _         t          j        d¦  «        | _        d| _        g | _        d| _        d| _        d S ©Nr+   r   )rT   rg   Úcrc32ÚcrcrA   ÚwritebufÚbufsizeÚoffset)r;   r"   s     r*   rf   zGzipFile._init_writeè   s8   € ØˆŒ	Ý”:˜c‘?”?ˆŒØˆŒ	ØˆŒØˆŒØˆŒˆˆr+   c                 ó\  — | j                              d¦  «         | j                              d¦  «         	 t          j                             | j        ¦  «        }t          |t          ¦  «        s|                     d¦  «        }| 	                    d¦  «        r
|d d…         }n# t          $ r d}Y nw xY wd}|rt          }| j                              t          |¦  «                             d¦  «        ¦  «         | j        }|€t          j        ¦   «         }t          | j         t!          |¦  «        ¦  «         |t"          k    rd}n|t$          k    rd	}nd
}| j                              |¦  «         | j                              d¦  «         |r| j                              |d
z   ¦  «         d S d S )Nó   ‹ó   zlatin-1s   .gzrs   r+   r   ó   ó   ó    ó   ÿ)rm   r   r   ÚpathÚbasenamerT   r   r   ÚencodeÚendswithÚUnicodeEncodeErrorÚFNAMEÚchrrl   Útimer1   ÚintÚ_COMPRESS_LEVEL_BESTÚ_COMPRESS_LEVEL_FAST)r;   r$   ÚfnameÚflagsro   Úxfls         r*   rn   zGzipFile._write_gzip_headerð   sª  € ØŒ×Ò˜;Ñ'Ô'Ð'ØŒ×Ò˜7Ñ#Ô#Ð#ð		õ ”G×$Ò$ T¤YÑ/Ô/ˆEÝ˜e¥UÑ+Ô+ð 0ØŸš YÑ/Ô/�Ø�~Š~˜fÑ%Ô%ð #Ø˜c˜r˜cœ
�øøÝ!ð 	ð 	ð 	ØˆEˆEˆEð	øøøàˆØð 	ÝˆEØŒ×Ò�3˜u™:œ:×,Ò,¨YÑ7Ô7Ñ8Ô8Ð8ØÔ!ˆØˆ=Ý”I‘K”KˆEÝ�”�s 5™zœzÑ*Ô*Ð*ØÕ0Ò0Ð0ØˆCˆCØÕ2Ò2Ð2ØˆCˆCàˆCØŒ×Ò˜3ÑÔÐØŒ×Ò˜7Ñ#Ô#Ð#Øð 	0ØŒL×Ò˜u w™Ñ/Ô/Ð/Ð/Ð/ð	0ð 	0s   ¶A-B$ Â$B3Â2B3c                 ó  — |                       ¦   «          | j        t          k    rdd l}t	          |j        d¦  «        ‚| j        €t          d¦  «        ‚t          |t          t          f¦  «        rt          |¦  «        }nt          |¦  «        }|j        }|dk    rq| j                             | j                             |¦  «        ¦  «         | xj        |z  c_        t#          j        || j        ¦  «        | _        | xj        |z  c_        |S )Nr   z$write() on read-only GzipFile objectz!write() on closed GzipFile object)Ú_check_not_closedr#   re   ÚerrnoÚOSErrorÚEBADFrm   r   r   r   Ú	bytearrayr7   Ú
memoryviewÚnbytesr   r   rA   rg   rƒ   r„   r‡   )r;   ÚdatarŸ   Úlengths       r*   r   zGzipFile.write  s÷   € Ø×ÒÑ Ô Ð ØŒ9�ÒÐØˆLˆLˆLÝ˜%œ+Ð'MÑNÔNÐNàŒ<ÐÝÐ@ÑAÔAÐAå�d�U¥IÐ.Ñ/Ô/ð 	!Ý˜‘Y”YˆFˆFõ ˜dÑ#Ô#ˆDØ”[ˆFà�AŠ:ˆ:ØŒL×Ò˜tœ}×5Ò5°dÑ;Ô;Ñ<Ô<Ð<ØˆIŒI˜ÑˆIŒIÝ”z $¨¬Ñ1Ô1ˆDŒHØˆKŒK˜6Ñ!ˆKŒKàˆr+   ry   c                 ó°   — |                       ¦   «          | j        t          k    rdd l}t	          |j        d¦  «        ‚| j                             |¦  «        S )Nr   z$read() on write-only GzipFile object)rž   r#   r_   rŸ   r    r¡   r6   r   ©r;   rA   rŸ   s      r*   r   zGzipFile.read(  sS   € Ø×ÒÑ Ô Ð ØŒ9�ÒÐØˆLˆLˆLÝ˜%œ+Ð'MÑNÔNÐNØŒ|× Ò  Ñ&Ô&Ð&r+   c                 óÔ   — |                       ¦   «          | j        t          k    rddl}t	          |j        d¦  «        ‚|dk     rt          j        }| j         	                    |¦  «        S )zdImplements BufferedIOBase.read1()

        Reads up to a buffer's worth of data if size is negative.r   Nz%read1() on write-only GzipFile object)
rž   r#   r_   rŸ   r    r¡   r   ÚDEFAULT_BUFFER_SIZEr6   Úread1r¨   s      r*   r«   zGzipFile.read1/  sf   € ð 	×ÒÑ Ô Ð ØŒ9�ÒÐØˆLˆLˆLÝ˜%œ+Ð'NÑOÔOÐOà�!Š8ˆ8ÝÔ)ˆDØŒ|×!Ò! $Ñ'Ô'Ð'r+   c                 ó°   — |                       ¦   «          | j        t          k    rdd l}t	          |j        d¦  «        ‚| j                             |¦  «        S )Nr   z$peek() on write-only GzipFile object)rž   r#   r_   rŸ   r    r¡   r6   Úpeek)r;   ÚnrŸ   s      r*   r­   zGzipFile.peek<  sS   € Ø×ÒÑ Ô Ð ØŒ9�ÒÐØˆLˆLˆLÝ˜%œ+Ð'MÑNÔNÐNØŒ|× Ò  Ñ#Ô#Ð#r+   c                 ó   — | j         d u S r@   )rm   rI   s    r*   ÚclosedzGzipFile.closedC  s   € àŒ|˜tÐ#Ð#r+   c                 óò  — | j         }|€d S d | _         	 | j        t          k    rZ|                     | j                             ¦   «         ¦  «         t          || j        ¦  «         t          || j        dz  ¦  «         n)| j        t          k    r| j
                             ¦   «          | j        }|rd | _        |                     ¦   «          d S d S # | j        }|rd | _        |                     ¦   «          w w xY w)Nì   ÿÿ )rm   r#   re   r   r   Úflushr1   r„   rA   r_   r6   Úcloser[   )r;   rm   r[   s      r*   r´   zGzipFile.closeG  s  € Ø”,ˆØˆ?ØˆFØˆŒð	"ØŒy�EÒ!Ð!Ø—’˜dœm×1Ò1Ñ3Ô3Ñ4Ô4Ð4Ý˜ $¤(Ñ+Ô+Ð+å˜ $¤)¨jÑ"8Ñ9Ô9Ð9Ð9Ø”�dÒ"Ð"Ø”×"Ò"Ñ$Ô$Ð$àœˆIØð "Ø!%�”Ø—’Ñ!Ô!Ð!Ð!Ð!ð"ð "øð œˆIØð "Ø!%�”Ø—’Ñ!Ô!Ð!Ð!ð"øøøs   ”BC Ã'C6c                 óè   — |                       ¦   «          | j        t          k    rM| j                             | j                             |¦  «        ¦  «         | j                             ¦   «          d S d S r@   )rž   r#   re   rm   r   r   r³   )r;   Ú	zlib_modes     r*   r³   zGzipFile.flushZ  si   € Ø×ÒÑ Ô Ð ØŒ9�ÒÐàŒL×Ò˜tœ}×2Ò2°9Ñ=Ô=Ñ>Ô>Ð>ØŒL×ÒÑ Ô Ð Ð Ð ð Ðr+   c                 ó4   — | j                              ¦   «         S )z¥Invoke the underlying file object's fileno() method.

        This will raise AttributeError if the underlying file object
        doesn't support fileno().
        )rm   ÚfilenorI   s    r*   r¸   zGzipFile.filenoa  s   € ð Œ|×"Ò"Ñ$Ô$Ð$r+   c                 óx   — | j         t          k    rt          d¦  «        ‚| j                             d¦  «         dS )z[Return the uncompressed stream file position indicator to the
        beginning of the filezCan't rewind in write moder   N)r#   r_   r    r6   rD   rI   s    r*   ÚrewindzGzipFile.rewindi  s<   € ð Œ9�ÒÐÝÐ6Ñ7Ô7Ð7ØŒ×Ò˜!ÑÔÐÐÐr+   c                 ó"   — | j         t          k    S r@   )r#   r_   rI   s    r*   ÚreadablezGzipFile.readablep  s   € ØŒy�DÒ Ð r+   c                 ó"   — | j         t          k    S r@   )r#   re   rI   s    r*   ÚwritablezGzipFile.writables  s   € ØŒy�EÒ!Ð!r+   c                 ó   — dS rG   rH   rI   s    r*   rJ   zGzipFile.seekablev  rK   r+   c                 óú  — | j         t          k    r¦|t          j        k    r*|t          j        k    r| j        |z   }nt          d¦  «        ‚|| j        k     rt          d¦  «        ‚|| j        z
  }d}t          |dz  ¦  «        D ]}|  	                    |¦  «         Œ|  	                    d|dz  z  ¦  «         n?| j         t          k    r/|                      ¦   «          | j                             ||¦  «        S | j        S )NzSeek from end not supportedzNegative seek in write modes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   i   r�   )r#   re   r   ÚSEEK_SETÚSEEK_CURr‡   r   r    Úranger   r_   rž   r6   rD   )r;   r‡   ÚwhenceÚcountÚchunkÚis         r*   rD   zGzipFile.seeky  s   € ØŒ9�ÒÐØ�œÒ$Ð$Ø�Rœ[Ò(Ð(Ø!œ[¨6Ñ1�F�Få$Ð%BÑCÔCÐCØ˜œÒ#Ð#ÝÐ;Ñ<Ô<Ð<Ø˜Tœ[Ñ(ˆEØ ˆEÝ˜5 D™=Ñ)Ô)ð "ð "�Ø—
’
˜5Ñ!Ô!Ð!Ð!Ø�JŠJ�u ¨¡Ñ-Ñ.Ô.Ð.Ð.ØŒY�$ÒÐØ×"Ò"Ñ$Ô$Ð$Ø”<×$Ò$ V¨VÑ4Ô4Ð4àŒ{Ðr+   c                 ó^   — |                       ¦   «          | j                             |¦  «        S r@   )rž   r6   Úreadline)r;   rA   s     r*   rÉ   zGzipFile.readline�  s*   € Ø×ÒÑ Ô Ð ØŒ|×$Ò$ TÑ*Ô*Ð*r+   ©ry   )rL   rM   rN   rO   r[   r˜   r>   Úpropertyr"   ro   r€   rf   rn   r   r   r«   r­   r°   r´   rg   ÚZ_SYNC_FLUSHr³   r¸   rº   r¼   r¾   rJ   r   rÁ   rD   rÉ   rH   r+   r*   r   r   y   s´  € € € € € ðð ð €Ià $¨4Ø3¸TÈðO3ð O3ð O3ð O3ðb ðð ñ „Xðð ð,ð ,ñ „Xð,ð>ð >ð >ðð ð ð0ð 0ð 0ð@ð ð ð0'ð 'ð 'ð 'ð(ð (ð (ð (ð$ð $ð $ð ð$ð $ñ „Xð$ð"ð "ð "ð& "Ô.ð !ð !ð !ð !ð%ð %ð %ðð ð ð!ð !ð !ð"ð "ð "ðð ð ð #%¤+ð ð ð ð ð(+ð +ð +ð +ð +ð +r+   r   c                 óò   — |                       |¦  «        }t          |¦  «        |k     rN|                       |t          |¦  «        z
  ¦  «        }|st          d¦  «        ‚||z  }t          |¦  «        |k     °N|S )z}Read exactly *n* bytes from `fp`

    This method is required because fp may be unbuffered,
    i.e. return short reads.
    úACompressed file ended before the end-of-stream marker was reached)r   r7   ÚEOFError)Úfpr®   r¥   r   s       r*   Ú_read_exactrÑ   ’  s}   € ð �7Š7�1‰:Œ:€DÝ
ˆd‰)Œ)�aŠ-ˆ-Ø�GŠG�A�˜D™	œ	‘MÑ"Ô"ˆØð 	?Ýð >ñ ?ô ?ð ?à�‰	ˆõ ˆd‰)Œ)�aŠ-ˆ-ð €Kr+   c                 óB  — |                       d¦  «        }|dk    rdS |dk    rt          d|z  ¦  «        ‚t          j        dt	          | d¦  «        ¦  «        \  }}}|dk    rt          d¦  «        ‚|t
          z  r5t          j        d	t	          | d¦  «        ¦  «        \  }t	          | |¦  «         |t          z  r 	 |                       d¦  «        }|r|dk    rnŒ|t          z  r 	 |                       d¦  «        }|r|dk    rnŒ|t          z  rt	          | d¦  «         |S )z‰Read a gzip header from `fp` and progress to the end of the header.

    Returns last mtime if header was present or None otherwise.
    r	   r+   Nr‰   zNot a gzipped file (%r)z<BBIxxr   zUnknown compression methodz<HTr   r�   )	r   r   r-   ÚunpackrÑ   ÚFEXTRAr”   ÚFCOMMENTÚFHCRC)rÐ   ÚmagicÚmethodÚflagÚ
last_mtimeÚ	extra_lenr   s          r*   Ú_read_gzip_headerrÜ   ¢  sI  € ð
 �GŠG�A‰JŒJ€EØ�‚|€|Øˆtà�ÒÐÝÐ3°eÑ;Ñ<Ô<Ð<å!'¤¨x½ÀRÈÑ9KÔ9KÑ!LÔ!LÑ€VˆT�:Ø�‚{€{ÝÐ6Ñ7Ô7Ð7à�f�}ð #å”] 4­°R¸Ñ);Ô);Ñ<Ô<‰
ˆ	Ý�B˜	Ñ"Ô"Ð"Ø�e�|ð ð	Ø—’˜‘
”
ˆAØð ˜˜7š
˜
Øð	ð �h�ð ð	Ø—’˜‘
”
ˆAØð ˜˜7š
˜
Øð	ð �e�|ð Ý�B˜ÑÔÐØÐr+   c                   óH   ‡ — e Zd Zˆ fd„Zd„ Zd„ Zd	d„Zd„ Zd„ Zˆ fd„Z	ˆ xZ
S )
r`   c                 ó°   •— t          ¦   «                              t          |¦  «        t          j        t          j         ¬¦  «         d| _        d | _        d S )N©ÚwbitsT)Úsuperr>   r3   rg   Údecompressobjrj   Ú_new_memberrw   )r;   rÐ   Ú	__class__s     €r*   r>   z_GzipReader.__init__È  sP   ø€ Ý‰Œ×Ò� R™œ­$Ô*<Ý $¤˜ð 	ñ 	0ô 	0ð 	0ð  ˆÔØˆÔÐÐr+   c                 óF   — t          j        d¦  «        | _        d| _        d S r‚   )rg   rƒ   Ú_crcÚ_stream_sizerI   s    r*   Ú
_init_readz_GzipReader._init_readÏ  s   € Ý”J˜s‘O”OˆŒ	ØˆÔÐÐr+   c                 óD   — t          | j        ¦  «        }|€dS || _        dS )NFT)rÜ   Ú_fprw   )r;   rÚ   s     r*   rÜ   z_GzipReader._read_gzip_headerÓ  s)   € Ý& t¤xÑ0Ô0ˆ
ØÐØ�5Ø%ˆÔØˆtr+   ry   c                 ó8  — |dk     r|                       ¦   «         S |sdS 	 | j        j        r2|                      ¦   «          d| _         | j        di | j        ¤Ž| _        | j        r=|                      ¦   «          |                      ¦   «         s| j	        | _
        dS d| _        | j                             t          j        ¦  «        }| j                             ||¦  «        }| j        j        dk    r%| j                             | j        j        ¦  «         n4| j        j        dk    r$| j                             | j        j        ¦  «         |dk    rn|dk    rt'          d¦  «        ‚�ŒH|                      |¦  «         | xj	        t+          |¦  «        z  c_	        |S )Nr   r+   TFrÎ   rH   )ÚreadallÚ_decompressorÚeofÚ	_read_eofrã   Ú_decomp_factoryÚ_decomp_argsrè   rÜ   Ú_posÚ_sizerê   r   r   rª   r   Úunconsumed_tailr=   Úunused_datarÏ   Ú_add_read_datar7   )r;   rA   ÚbufÚ
uncompresss       r*   r   z_GzipReader.readÚ  s¿  € Ø�!Š8ˆ8Ø—<’<‘>”>Ð!àð 	Ø�3ð
#	CØÔ!Ô%ð )ð
 —’Ñ Ô Ð Ø#'�Ô Ø%9 TÔ%9ð &)ð &)ØÔ'ð&)ð &)�Ô"ð Ôð )ð —’Ñ!Ô!Ð!Ø×-Ò-Ñ/Ô/ð Ø!%¤�D”JØ˜3Ø#(�Ô ð ”(—-’-¥Ô 6Ñ7Ô7ˆCàÔ+×6Ò6°s¸DÑAÔAˆJØÔ!Ô1°SÒ8Ð8Ø”× Ò  Ô!3Ô!CÑDÔDÐDÐDØÔ#Ô/°3Ò6Ð6ð ”× Ò  Ô!3Ô!?Ñ@Ô@Ð@à˜SÒ Ð ØØ�cŠzˆzÝð  Bñ Cô Cð CñE#	CðJ 	×Ò˜ZÑ)Ô)Ð)Øˆ	Œ	•S˜‘_”_Ñ$ˆ	Œ	ØÐr+   c                 ó|   — t          j        || j        ¦  «        | _        | j        t	          |¦  «        z   | _        d S r@   )rg   rƒ   ræ   rç   r7   )r;   r¥   s     r*   rö   z_GzipReader._add_read_data  s3   € Ý”J˜t T¤YÑ/Ô/ˆŒ	Ø Ô-µ°D±	´	Ñ9ˆÔÐÐr+   c                 ó   — t          j        dt          | j        d¦  «        ¦  «        \  }}|| j        k    r4t          dt          |¦  «        ›dt          | j        ¦  «        ›�¦  «        ‚|| j        dz  k    rt          d¦  «        ‚d}|dk    r | j                             d¦  «        }|dk    ° |r| j         	                    |¦  «         d S d S )	Nú<IIr   zCRC check failed z != r²   ú!Incorrect length of data producedr�   r   )
r-   rÓ   rÑ   rê   ræ   r   r}   rç   r   r=   )r;   rƒ   ÚisizeÚcs       r*   rï   z_GzipReader._read_eof  sæ   € õ
 ”} U­K¸¼À!Ñ,DÔ,DÑEÔE‰ˆˆuØ�D”IÒÐÝ�+½SÀ¹Z¼Z¸Z¸ZÝ=@ÀÄ¹^¼^¸^ðMñ Nô Nð Nà�tÔ(¨:Ñ5Ò6Ð6ÝÐAÑBÔBÐBð
 ˆØ�7ŠlˆlØ”—’˜aÑ Ô ˆAð �7Šlˆlàð 	 ØŒH×Ò˜QÑÔÐÐÐð	 ð 	 r+   c                 óV   •— t          ¦   «                              ¦   «          d| _        d S rG   )rá   Ú_rewindrã   )r;   rä   s    €r*   r   z_GzipReader._rewind&  s%   ø€ Ý‰Œ�ŠÑÔÐØˆÔÐÐr+   rÊ   )rL   rM   rN   r>   rè   rÜ   r   rö   rï   r   Ú__classcell__)rä   s   @r*   r`   r`   Ç  s¢   ø€ € € € € ð ð  ð  ð  ð  ðð ð ðð ð ð1ð 1ð 1ð 1ðf:ð :ð :ð ð  ð  ð* ð  ð  ð  ð  ð  ð  ð  ð  r+   r`   r$   Úreturnc           
      ó¸   — |€t          j         ¦   «         }| t          k    rd}n| t          k    rd}nd}t          j        dddddt          |¦  «        |d	¦  «        S )
a  
    Write a simple gzip header with no extra fields.
    :param compresslevel: Compresslevel used to determine the xfl bytes.
    :param mtime: The mtime (must support conversion to a 32-bit integer).
    :return: A bytes object representing the gzip header.
    Nr	   r
   r   z<BBBBLBBé   é‹   r   éÿ   )r–   r˜   r™   r-   r.   r—   )r$   ro   rœ   s      r*   Ú_create_simple_gzip_headerr  +  se   € ð €}Ý”	‘”ˆØÕ,Ò,Ð,ØˆˆØ	Õ.Ò	.Ð	.Øˆˆàˆõ Œ;�z 4¨¨q°!µS¸±Z´ZÀÀcÑJÔJÐJr+   )ro   c                ó  — |dk    rt          j        | |d¬¦  «        S t          ||¦  «        }t          j        dt          j        | ¦  «        t          | ¦  «        dz  ¦  «        }|t          j        | |d¬¦  «        z   |z   S )zôCompress data in one shot and return the compressed string.

    compresslevel sets the compression level in range of 0-9.
    mtime can be used to set the modification time. The modification time is
    set to the current time by default.
    r   r  )Úlevelrà   z<LLr²   iñÿÿÿ)rg   r   r  r-   r.   rƒ   r7   )r¥   r$   ro   ÚheaderÚtrailers        r*   r   r   @  sƒ   € ð �‚z€zõ Œ}˜T¨¸bÐAÑAÔAÐAÝ'¨°uÑ=Ô=€FÝŒk˜%¥¤¨DÑ!1Ô!1µC¸±I´IÀ
Ñ4JÑLÔL€Gà•T”] 4¨}ÀCÐHÑHÔHÑHØñð r+   c                 óÆ  — g }	 t          j        | ¦  «        }t          |¦  «        €d                     |¦  «        S t	          j        t          j         ¬¦  «        }|                     | |                     ¦   «         d…         ¦  «        }|j	        rt          |j        ¦  «        dk     rt          d¦  «        ‚t          j        d|j        dd…         ¦  «        \  }}|t	          j        |¦  «        k    rt!          d¦  «        ‚|t          |¦  «        d	z  k    rt!          d
¦  «        ‚|                     |¦  «         |j        dd…                              d¦  «        } �Œ_)zYDecompress a gzip compressed string in one shot.
    Return the decompressed string.
    TNr+   rß   r   rÎ   rû   zCRC check failedr²   rü   r�   )r   ÚBytesIOrÜ   Újoinrg   râ   rj   r   Útellrî   r7   rõ   rÏ   r-   rÓ   rƒ   r   ÚappendÚlstrip)r¥   Údecompressed_membersrÐ   ÚdoÚdecompressedr„   r¦   s          r*   r   r   R  sO  € ð Ðð2ÝŒZ˜ÑÔˆÝ˜RÑ Ô Ð(Ø—8’8Ð0Ñ1Ô1Ð1åÔ¥t¤~ oÐ6Ñ6Ô6ˆà—}’} T¨"¯'ª'©)¬)¨*¨*Ô%5Ñ6Ô6ˆØŒvð 	1�˜Rœ^Ñ,Ô,¨qÒ0Ð0Ýð 0ñ 1ô 1ð 1å”m E¨2¬>¸"¸1¸"Ô+=Ñ>Ô>‰ˆˆVØ•$”*˜\Ñ*Ô*Ò*Ð*ÝÐ0Ñ1Ô1Ð1Ø•c˜,Ñ'Ô'¨*Ñ4Ò5Ð5ÝÐAÑBÔBÐBØ×#Ò# LÑ1Ô1Ð1ØŒ~˜a˜b˜bÔ!×(Ò(¨Ñ1Ô1ˆñ#2r+   c                  ó˜  — ddl m}   | d¬¦  «        }|                     ¦   «         }|                     ddd¬¦  «         |                     d	dd
¬¦  «         |                     dddd¬¦  «         |                     dddgd¬¦  «         |                     ¦   «         }t
          }|j        rt          }n|j        rt          }|j
        D �]}|j        rŒ|dk    r3t          ddt          j        j        ¬¦  «        }t          j        j        }nµ|dd …         dk    rt          j        d|›�¦  «         t%          |d¦  «        }t'          j        |d d…         d¦  «        }nb|dk    r4t          j        j        }t          ddt          j        j        |¬¦  «        }n(t'          j        |d¦  «        }t%          |dz   d¦  «        }	 |                     t*          j        ¦  «        }|sn|                     |¦  «         Œ8|t          j        j        ur|                     ¦   «          |t          j        j        ur|                     ¦   «          �Œ�d S )Nr   )ÚArgumentParserzeA simple command line interface for the gzip module: act like gzip, but do not delete the input file.)Údescriptionz--fastÚ
store_truezcompress faster)ÚactionÚhelpz--bestzcompress betterz-dz--decompresszact like gunzip instead of gzipÚargsÚ*ú-r9   )ÚnargsÚdefaultÚmetavarr   r   )r"   r#   rm   rs   rt   zfilename doesn't end in .gz: Úwb)r"   r#   rm   r$   )Úargparser  Úadd_mutually_exclusive_groupÚadd_argumentÚ
parse_argsÚ_COMPRESS_LEVEL_TRADEOFFÚfastr™   Úbestr˜   r  r   r   ÚsysÚstdinÚbufferÚstdoutÚexitr   rZ   r   r   rª   r   r´   )	r  ÚparserÚgroupr  r$   Úargr<   ÚgrÆ   s	            r*   Úmainr2  k  ss  € Ø'Ð'Ð'Ð'Ð'Ð'Øˆ^ð	,ð-ñ -ô -€Fð ×/Ò/Ñ1Ô1€EØ	×Ò�x¨Ð;LÐÑMÔMÐMØ	×Ò�x¨Ð;LÐÑMÔMÐMØ	×Ò�t˜^°LØ>ð ñ @ô @ð @ð ×Ò˜ c°C°5À&ÐÑIÔIÐIØ×ÒÑÔ€Då,€MØ„yð -Ý,ˆˆØ	Œð -Ý,ˆàŒyð ñ ˆØŒ?ð 	,Ø�cŠzˆzÝ b¨t½S¼YÔ=MÐNÑNÔN�Ý”JÔ%��à�r�s�s”8˜uÒ$Ð$Ý”HÐD¸SÐDÐDÑEÔEÐEÝ˜˜d‘O”O�Ý”M # c r c¤(¨DÑ1Ô1��à�cŠzˆzÝ”IÔ$�Ý b¨t½S¼ZÔ=NØ+8ð:ñ :ô :��õ ”M # tÑ,Ô,�Ý˜˜u™ dÑ+Ô+�ð	Ø—F’F�2Ô1Ñ2Ô2ˆEØð ØØ�GŠG�E‰NŒNˆNð		ð
 •C”JÔ%Ð%Ð%Ø�GŠG‰IŒIˆIØ•C”IÔ$Ð$Ð$Ø�GŠG‰IŒIˆIùð5ð r+   Ú__main__r@   )&rO   r-   r)  r–   r   rg   rZ   r   Ú_compressionÚ__all__ÚFTEXTrÖ   rÔ   r”   rÕ   r_   re   r™   r&  r˜   r   r1   r3   r    r   Ú
BaseStreamr   rÑ   rÜ   ÚDecompressReaderr`   r—   r   r  r   r   r2  rL   rH   r+   r*   ú<module>r9     sS  ðð%ð %ð Ð Ð Ð Ð Ð Ð Ð Ð Ð Ð Ð Ð Ð Ð Ð Ø €€€Ø €€€Ø 	€	€	€	Ø Ð Ð Ð à
GÐ
GÐ
G€à(6Ñ %€€uˆf�e˜Xà�€€eàÐ ØÐ ØÐ ð Ð,@Ø˜t¨Tð+ð +ð +ð +ðZ+ð +ð +ð
'ð 'ð 'ð 'ð 'ñ 'ô 'ð 'ðTAð Að Að Að A�'ñ Aô Að AðV+ð V+ð V+ð V+ð V+ˆ|Ô&ñ V+ô V+ð V+ðrð ð ð "ð "ð "ðJa ð a ð a ð a ð a �,Ô/ñ a ô a ð a ðJ (,ðKð K¨cð KØ05ðKð Kð Kð Kð* "6ð Àð ð ð ð ð ð$2ð 2ð 2ð2.ð .ð .ð` ˆzÒÐØ€D�F„F€F€F€Fð Ðr+   