ó
    F\h9`  ã                   ó¨  • S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	/ SQr
Su  rrrrrSrSrSrSrS	rS
rS\R,                  -  rS\SSS4S jrS r " S S5      r " S S\5      r " S S\R:                  5      r " S S\R>                  5      r S r!S r" " S S\RF                  5      r$\4SS.S jjr%S r&S r'\(S:X  a  \'" 5         gg)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)é   é   é   é   é   ÚrbÚwbr   é   é	   i   r
   c                 ó   • SU;   a  SU;   a  [        SU< 35      eO*Ub  [        S5      eUb  [        S5      eUb  [        S5      eUR                  SS5      n[        U [        [        [
        R                  45      (       a  [        XU5      nO;[        U S	5      (       d  [        U S
5      (       a  [        SXbU 5      nO[        S5      eSU;   a-  [        R                  " U5      n[        R                  " XsXE5      $ U$ )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           Ú/usr/lib/python3.13/gzip.pyr   r   !   sô   € ð( ˆdƒ{Ø�$‹;Ý²4Ð9Ó:Ð:ð ð ÑÜÐOÓPÐPØÑÜÐMÓNÐNØÑÜÐNÓOÐOà�l‰l˜3 Ó#€GÜ�(œS¤%¬¯©Ð5×6Ñ6Ü˜x°-Ó@‰Ü	�˜6×	"Ñ	"¤g¨h¸×&@Ñ&@Ü˜t W¸XÓF‰äÐKÓLÐLà
ˆdƒ{Ü×#Ò# HÓ-ˆÜ×Ò °vÓGÐGàÐó    c                 óP   • U R                  [        R                  " SU5      5        g )Nz<L)r   ÚstructÚpack)ÚoutputÚvalues     r+   Úwrite32ur2   N   s   € ð ‡L�L”—’˜T 5Ó)Õ*r,   c                   ó>   • \ rS rSrSrS
S jrS rS
S jrS rS r	Sr
g	)Ú_PaddedFileéS   z¢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.c                 óJ   • X l         [        U5      U l        Xl        SU l        g ©Nr   )Ú_bufferÚlenÚ_lengthÚfileÚ_read)ÚselfÚfÚprepends      r+   Ú__init__Ú_PaddedFile.__init__X   s   € ØŒÜ˜7“|ˆŒØŒ	Øˆ�
r,   c                 ó˜  • U R                   c  U R                  R                  U5      $ U R                   U-   U R                  ::  a9  U R                   nU =R                   U-  sl         U R                  X R                    $ U R                   nS U l         U R                  US  U R                  R                  XR                  -
  U-   5      -   $ ©N)r<   r;   r   r:   r8   )r=   Úsizer   s      r+   r   Ú_PaddedFile.read^   s¢   € Ø�:‰:ÑØ—9‘9—>‘> $Ó'Ð'Ø�:‰:˜Ñ §¡Ó,Ø—:‘:ˆDØ�JŠJ˜$Ñ�JØ—<‘< §Z¡ZÐ0Ð0à—:‘:ˆDØˆDŒJØ—<‘<  Ð&Ø—9‘9—>‘> $§|¡|Ñ"3°DÑ"8Ó9ñ:ð :r,   c                 ó¬   • U R                   c  Xl        OU =R                   [        U5      -  sl         g [        U R                  5      U l        SU l         g r7   )r<   r8   r9   r:   )r=   r?   s     r+   r?   Ú_PaddedFile.prependk   s=   € Ø�:‰:ÑØ"�Là�JŠJœ#˜g›,Ñ&�JØÜ˜4Ÿ<™<Ó(ˆŒØˆ�
r,   c                 óT   • S U l         S U l        U R                  R                  U5      $ rC   )r<   r8   r;   Úseek)r=   Úoffs     r+   rI   Ú_PaddedFile.seekt   s#   € ØˆŒ
ØˆŒØ�y‰y�~‰~˜cÓ"Ð"r,   c                 ó   • g©NT© ©r=   s    r+   ÚseekableÚ_PaddedFile.seekabley   ó   € Ør,   )r8   r:   r<   r;   N)r,   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r@   r   r?   rI   rP   Ú__static_attributes__rN   r,   r+   r4   r4   S   s    † ñ ôò:ôò#õ
r,   r4   c                   ó   • \ rS rSrSrSrg)r   é}   z6Exception raised in some cases for invalid gzip files.rN   N)rS   rT   rU   rV   rW   rX   rN   r,   r+   r   r   }   s   † Ü@r,   r   c                   ó0   • \ rS rSrSrS rS rS rS rSr	g)	Ú_WriteBufferStreamé�   z8Minimal object to pass WriteBuffer flushes into GzipFilec                 ó:   • [         R                  " U5      U l        g rC   )ÚweakrefÚrefÚ	gzip_file)r=   ra   s     r+   r@   Ú_WriteBufferStream.__init__ƒ   s   € Ü Ÿš YÓ/ˆ�r,   c                 ó`   • U R                  5       nUc  [        S5      eUR                  U5      $ )Nzlost gzip_file)ra   ÚRuntimeErrorÚ
_write_raw)r=   Údatara   s      r+   r   Ú_WriteBufferStream.write†   s1   € Ø—N‘NÓ$ˆ	ØÑÜÐ/Ó0Ð0Ø×#Ñ# DÓ)Ð)r,   c                 ó   • g)NFrN   rO   s    r+   rP   Ú_WriteBufferStream.seekableŒ   s   € Ør,   c                 ó   • grM   rN   rO   s    r+   ÚwritableÚ_WriteBufferStream.writable�   rR   r,   )ra   N)
rS   rT   rU   rV   rW   r@   r   rP   rk   rX   rN   r,   r+   r\   r\   �   s   † ÙBò0ò*òõr,   r\   c                   ó  ^ • \ rS rSrSrSrSS\SS4S jr\S 5       r	S r
S rU 4S jrS	 rS
 rS rSS jrSS jrS r\S 5       rS rS r\R.                  4S jrS rS rS rS rS r\R>                  4S jr SS jr!Sr"U =r#$ )r   é“   zú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                 ó†  • U(       a&  SU;   d  SU;   a  [        SR                  U5      5      eU(       a  SU;  a  US-  n Uc%  [        R                  " X=(       d    S5      =o@l        Uc+  [        USS5      n[        U[        [        45      (       d  SnO[        R                  " U5      nUnUc  [        US	S5      nUR                  S
5      (       a8  [        U l        [        U5      n[        R                   " U5      U l        Xl        OóUR                  S5      (       aÃ  Uc  SSKnUR)                  S[*        S5        [,        U l        U R/                  U5        [0        R2                  " U[0        R4                  [0        R6                  * [0        R8                  S5      U l        XPl        [>        U l         [        RB                  " [E        U 5      U R@                  S9U l        O[        SR                  U5      5      eX@l#        U R                  [,        :X  a  U RI                  U5        gg!   U RK                  5         e = f)aî  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 optional mtime argument is the timestamp requested by gzip. The time
is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970.
If mtime is omitted or None, the current time is used. Use mtime = 0
to generate a compressed stream that does not depend on creation time.

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	   )Úbuffer_size)&r   ÚformatÚbuiltinsr   Ú	myfileobjÚgetattrr   r   r   r   ÚfspathÚ
startswithÚREADr$   Ú_GzipReaderr    ÚBufferedReaderr8   rq   ÚwarningsÚwarnÚFutureWarningÚWRITEÚ_init_writeÚzlibÚcompressobjÚDEFLATEDÚ	MAX_WBITSÚDEF_MEM_LEVELr   Ú_write_mtimeÚ_WRITE_BUFFER_SIZEÚ_buffer_sizeÚBufferedWriterr\   ÚfileobjÚ_write_gzip_headerÚ_close)	r=   r#   r$   r%   rŽ   ÚmtimeÚorigmodeÚrawr€   s	            r+   r@   ÚGzipFile.__init__    sæ  € öH �S˜D“[ C¨4£KÜÐ1×8Ñ8¸Ó>Ó?Ð?Þ�C˜t“OØ�C‰KˆDð2	Ø‰Ü+3¯=ª=¸Ç<È4Ó+PÐP�œ.ØÑÜ" 7¨F°BÓ7�Ü! (¬S´%¨L×9Ñ9Ø!�HøäŸ9š9 XÓ.�ØˆHØ‰|Ü˜w¨°Ó5�ð �‰˜s×#Ñ#Ü �”	Ü! 'Ó*�Ü!×0Ò0°Ó5�”Ø$•	à—‘ ×1Ñ1ØÑ#Û#Ø—M‘MðPô & qô	*ô
 "�”	Ø× Ñ  Ô*Ü $× 0Ò 0°Ü15·±Ü26·.±.°Ü15×1CÑ1CØ12ó	!4�”ð
 %*Ô!Ü$6�Ô!Ü!×0Ò0Ô1CÀDÓ1IØ=A×=NÑ=Nñ P�•ô !Ð!5×!<Ñ!<¸TÓ!BÓCÐCà"ŒLà�y‰yœEÓ!Ø×'Ñ'¨Õ6ð "øð	ð �K‰KŒMØús   ÁG*H- È-I c                 óB   • U R                   R                  R                  $ )z0Last modification time read from stream, or None)r8   r“   Ú_last_mtimerO   s    r+   r‘   ÚGzipFile.mtimeý   s   € ð �|‰|×Ñ×+Ñ+Ð+r,   c                 ór   • [        U R                  5      nSUSS -   S-   [        [        U 5      5      -   S-   $ )Nz<gzip r   éÿÿÿÿÚ Ú>)ÚreprrŽ   ÚhexÚid)r=   Úss     r+   Ú__repr__ÚGzipFile.__repr__  s8   € Ü�—‘ÓˆØ˜!˜A˜b˜'Ñ! CÑ'¬#¬b°«h«-Ñ7¸#Ñ=Ð=r,   c                 ó~   • Xl         [        R                  " S5      U l        SU l        / U l        SU l        SU l        g ©Nr,   r   )rq   r…   Úcrc32ÚcrcrD   ÚwritebufÚbufsizeÚoffset)r=   r#   s     r+   r„   ÚGzipFile._init_write  s2   € ØŒ	Ü—:’:˜c“?ˆŒØˆŒ	ØˆŒØˆŒØˆ�r,   c                 ót   >• U R                  5         U R                  R                  5         [        TU ]  5       $ rC   )Ú_check_not_closedr8   ÚflushÚsuperÚtell©r=   Ú	__class__s    €r+   r®   ÚGzipFile.tell  s+   ø€ Ø×ÑÔ Ø�‰×ÑÔÜ‰w‰|‹~Ðr,   c                 óf  • U R                   R                  S5        U R                   R                  S5         [        R                  R	                  U R
                  5      n[        U[        5      (       d  UR                  S5      nUR                  S5      (       a  US S nSnU(       a  [        nU R                   R                  [        U5      R                  S5      5        U R                  nUc  [        R                  " 5       n[        U R                   [!        U5      5        U["        :X  a  SnOU[$        :X  a  S	nOS
nU R                   R                  U5        U R                   R                  S5        U(       a  U R                   R                  US
-   5        g g ! [         a    Sn GNf = f)Nó   ‹ó   zlatin-1s   .gzéýÿÿÿr,   r   ó   ó   ó    ó   ÿ)rŽ   r   r   ÚpathÚbasenamerq   r   r   ÚencodeÚendswithÚUnicodeEncodeErrorÚFNAMEÚchrrŠ   Útimer2   ÚintÚ_COMPRESS_LEVEL_BESTÚ_COMPRESS_LEVEL_FAST)r=   r%   ÚfnameÚflagsr‘   Úxfls         r+   r�   ÚGzipFile._write_gzip_header  sP  € Ø�‰×Ñ˜;Ô'Ø�‰×Ñ˜7Ô#ð		ô —G‘G×$Ñ$ T§Y¡YÓ/ˆEÜ˜e¤U×+Ñ+ØŸ™ YÓ/�Ø�~‰~˜f×%Ñ%Ø˜c˜r˜
�ð ˆÞÜˆEØ�‰×Ñœ3˜u›:×,Ñ,¨YÓ7Ô8Ø×!Ñ!ˆØ‰=Ü—I’I“KˆEÜ�—‘œs 5›zÔ*ØÔ0Ó0Ø‰CØÔ2Ó2Ø‰CàˆCØ�‰×Ñ˜3ÔØ�‰×Ñ˜7Ô#ÞØ�L‰L×Ñ˜u w™Õ/ð øô% "ó 	Ø‹Eð	ús   ¸A*F  Æ F0Æ/F0c                 óä   • U R                  5         U R                  [        :w  a  SS Kn[	        UR
                  S5      eU R                  c  [        S5      eU R                  R                  U5      $ )Nr   z$write() on read-only GzipFile objectz!write() on closed GzipFile object)
r«   r$   rƒ   ÚerrnoÚOSErrorÚEBADFrŽ   r   r8   r   )r=   rf   rÊ   s      r+   r   ÚGzipFile.write3  sZ   € Ø×ÑÔ Ø�9‰9œÓÛÜ˜%Ÿ+™+Ð'MÓNÐNà�<‰<ÑÜÐ@ÓAÐAà�|‰|×!Ñ! $Ó'Ð'r,   c                 ó”  • [        U[        [        45      (       a  [        U5      nO[	        U5      nUR
                  nUS:”  aƒ  U R                  R                  U R                  R                  U5      5        U =R                  U-  sl	        [        R                  " XR                  5      U l        U =R                  U-  sl        U$ r7   )r   r   Ú	bytearrayr9   Ú
memoryviewÚnbytesrŽ   r   r   rD   r…   r¤   r¥   r¨   )r=   rf   Úlengths      r+   re   ÚGzipFile._write_raw>  s�   € ä�dœU¤IÐ.×/Ñ/Ü˜“Y‰Fô ˜dÓ#ˆDØ—[‘[ˆFà�A‹:Ø�L‰L×Ñ˜tŸ}™}×5Ñ5°dÓ;Ô<Ø�IŠI˜Ñ�IÜ—z’z $¯©Ó1ˆDŒHØ�KŠK˜6Ñ!�Kàˆr,   c                 ó´   • U R                  5         U R                  [        :w  a  SS Kn[	        UR
                  S5      eU R                  R                  U5      $ )Nr   z$read() on write-only GzipFile object)r«   r$   r}   rÊ   rË   rÌ   r8   r   ©r=   rD   rÊ   s      r+   r   ÚGzipFile.readO  sD   € Ø×ÑÔ Ø�9‰9œÓÛÜ˜%Ÿ+™+Ð'MÓNÐNØ�|‰|× Ñ  Ó&Ð&r,   c                 óà   • U R                  5         U R                  [        :w  a  SSKn[	        UR
                  S5      eUS:  a  [        R                  nU R                  R                  U5      $ )z\Implements 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_SIZEr8   Úread1rÕ   s      r+   rÙ   ÚGzipFile.read1V  sX   € ð 	×ÑÔ Ø�9‰9œÓÛÜ˜%Ÿ+™+Ð'NÓOÐOà�!‹8Ü×)Ñ)ˆDØ�|‰|×!Ñ! $Ó'Ð'r,   c                 ó´   • U R                  5         U R                  [        :w  a  SS Kn[	        UR
                  S5      eU R                  R                  U5      $ )Nr   z$peek() on write-only GzipFile object)r«   r$   r}   rÊ   rË   rÌ   r8   Úpeek)r=   ÚnrÊ   s      r+   rÜ   ÚGzipFile.peekc  sD   € Ø×ÑÔ Ø�9‰9œÓÛÜ˜%Ÿ+™+Ð'MÓNÐNØ�|‰|× Ñ  Ó#Ð#r,   c                 ó   • U R                   S L $ rC   )rŽ   rO   s    r+   ÚclosedÚGzipFile.closedj  s   € à�|‰|˜tÐ#Ð#r,   c                 ó  • U R                   nUb  U R                  R                  (       a  g  U R                  [        :X  aq  U R                  R                  5         UR                  U R                  R                  5       5        [        XR                  5        [        XR                  S-  5        O.U R                  [        :X  a  U R                  R                  5         U R                  5         g ! U R                  5         f = f)Nì   ÿÿ )rŽ   r8   rà   r$   rƒ   r¬   r   r   r2   r¥   rD   r}   Úcloser�   )r=   rŽ   s     r+   rä   ÚGzipFile.closen  s¥   € Ø—,‘,ˆØ‰?˜dŸl™l×1×1Øð
	Ø�y‰yœEÓ!Ø—‘×"Ñ"Ô$Ø—‘˜dŸm™m×1Ñ1Ó3Ô4Ü˜§(¡(Ô+ä˜§)¡)¨jÑ"8Õ9Ø—‘œdÓ"Ø—‘×"Ñ"Ô$à�K‰K�MøˆD�K‰K�Mús   ­B3C1 Ã1Dc                 ó`   • S U l         U R                  nUb  S U l        UR                  5         g g rC   )rŽ   ry   rä   )r=   ry   s     r+   r�   ÚGzipFile._close~  s.   € ØˆŒØ—N‘Nˆ	ØÑ Ø!ˆDŒNØ�O‰OÕð !r,   c                 ó  • U R                  5         U R                  [        :X  ai  U R                  R	                  5         U R
                  R                  U R                  R	                  U5      5        U R
                  R	                  5         g g rC   )r«   r$   rƒ   r8   r¬   rŽ   r   r   )r=   Ú	zlib_modes     r+   r¬   ÚGzipFile.flush…  s`   € Ø×ÑÔ Ø�9‰9œÓØ�L‰L×ÑÔ à�L‰L×Ñ˜tŸ}™}×2Ñ2°9Ó=Ô>Ø�L‰L×ÑÕ ð	 r,   c                 ó6   • U R                   R                  5       $ )z�Invoke the underlying file object's fileno() method.

This will raise AttributeError if the underlying file object
doesn't support fileno().
)rŽ   ÚfilenorO   s    r+   rì   ÚGzipFile.fileno�  s   € ð �|‰|×"Ñ"Ó$Ð$r,   c                 óx   • U R                   [        :w  a  [        S5      eU R                  R	                  S5        g)zSReturn the uncompressed stream file position indicator to the
beginning of the filezCan't rewind in write moder   N)r$   r}   rË   r8   rI   rO   s    r+   ÚrewindÚGzipFile.rewind•  s.   € ð �9‰9œÓÜÐ6Ó7Ð7Ø�‰×Ñ˜!Õr,   c                 ó(   • U R                   [        :H  $ rC   )r$   r}   rO   s    r+   ÚreadableÚGzipFile.readableœ  s   € Ø�y‰yœDÑ Ð r,   c                 ó(   • U R                   [        :H  $ rC   )r$   rƒ   rO   s    r+   rk   ÚGzipFile.writableŸ  s   € Ø�y‰yœEÑ!Ð!r,   c                 ó   • grM   rN   rO   s    r+   rP   ÚGzipFile.seekable¢  rR   r,   c                 ó¾  • U R                   [        :X  aÿ  U R                  5         U R                  R	                  5         U[
        R                  :w  a/  U[
        R                  :X  a  U R                  U-   nO[        S5      eXR                  :  a  [        S5      eXR                  -
  nSU R                  -  n[        X0R                  -  5       H  nU R                  U5        M     U R                  SX0R                  -  -  5        U R                  $ U R                   [        :X  a+  U R                  5         U R                  R                  X5      $ U R                  $ )NzSeek from end not supportedzNegative seek in write moder¸   )r$   rƒ   r«   r8   r¬   r    ÚSEEK_SETÚSEEK_CURr¨   r   rË   rŒ   Úranger   r}   rI   )r=   r¨   ÚwhenceÚcountÚchunkÚis         r+   rI   ÚGzipFile.seek¥  s  € Ø�9‰9œÓØ×"Ñ"Ô$à�L‰L×ÑÔ ØœŸ™Ó$ØœRŸ[™[Ó(Ø!Ÿ[™[¨6Ñ1‘Fä$Ð%BÓCÐCØŸ™Ó#ÜÐ;Ó<Ð<ØŸ[™[Ñ(ˆEØ˜D×-Ñ-Ñ-ˆEÜ˜5×$5Ñ$5Ñ5Ö6�Ø—
‘
˜5Ö!ñ 7à�J‰J�u ×(9Ñ(9Ñ 9Ñ:Ô;ð
 �{‰{Ðð	 �Y‰Yœ$ÓØ×"Ñ"Ô$Ø—<‘<×$Ñ$ VÓ4Ð4à�{‰{Ðr,   c                 óX   • U R                  5         U R                  R                  U5      $ rC   )r«   r8   Úreadline)r=   rD   s     r+   r  ÚGzipFile.readline¼  s#   € Ø×ÑÔ Ø�|‰|×$Ñ$ TÓ*Ð*r,   )r8   rŒ   rŠ   r§   r   r¥   rŽ   r$   ry   rq   r¨   rD   r¦   ©r™   )$rS   rT   rU   rV   rW   ry   rÃ   r@   Úpropertyr‘   r    r„   r®   r�   r   re   r   rÙ   rÜ   rà   rä   r�   r…   ÚZ_SYNC_FLUSHr¬   rì   rï   rò   rk   rP   r    rù   rI   r  rX   Ú__classcell__©r°   s   @r+   r   r   “   sÃ   ø† ñð €Ià $¨4Ø3¸TÈô[ðz ñ,ó ð,ò>òõò
0ò@	(òô"'ô(ò$ð ñ$ó ð$òò ð "×.Ñ.ô !ò%òò!ò"òð #%§+¡+ô ÷.+ò +r,   r   c                 óÎ   • U R                  U5      n[        U5      U:  aD  U R                  U[        U5      -
  5      nU(       d  [        S5      eX#-  n[        U5      U:  a  MD  U$ )zqRead 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   r9   ÚEOFError)ÚfprÝ   rf   r   s       r+   Ú_read_exactr  Á  sb   € ð �7‰7�1‹:€DÜ
ˆd‹)�a‹-Ø�G‰G�Aœ˜D›	‘MÓ"ˆÞÜð >ó ?ð ?à‰	ˆô ˆd‹)�a�-ð €Kr,   c                 ó4  • U R                  S5      nUS:X  a  gUS:w  a  [        SU-  5      e[        R                  " S[	        U S5      5      u  p#nUS:w  a  [        S5      eU[
        -  (       a.  [        R                  " S	[	        U S5      5      u  n[	        X5        U[        -  (       a"   U R                  S
5      nU(       a  US:X  a  OM!  U[        -  (       a"   U R                  S
5      nU(       a  US:X  a  OM!  U[        -  (       a  [	        U S5        U$ )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<Hr   r¸   )	r   r   r.   Úunpackr  ÚFEXTRAr¿   ÚFCOMMENTÚFHCRC)r  ÚmagicÚmethodÚflagÚ
last_mtimeÚ	extra_lenrŸ   s          r+   Ú_read_gzip_headerr  Ñ  sö   € ð
 �G‰G�A‹J€EØ�ƒ|Øà�ÓÜÐ3°eÑ;Ó<Ð<ä!'§¢¨x¼ÀRÈÓ9KÓ!LÑ€V�:Ø�ƒ{ÜÐ6Ó7Ð7àŒf‡}ä—]’] 4¬°R¸Ó);Ó<‰
ˆ	Ü�BÔ"ØŒe‡|àØ—‘˜“
ˆAÞ˜˜7›
Øñ ð Œh‡àØ—‘˜“
ˆAÞ˜˜7›
Øñ ð Œe‡|Ü�B˜ÔØÐr,   c                   óP   ^ • \ rS rSrU 4S jrS rS rS	S jrS rU 4S jr	Sr
U =r$ )
r~   iö  c                 óŒ   >• [         TU ]  [        U5      [        R                  [        R
                  * S9  SU l        S U l        g )N©ÚwbitsT)r­   r@   r4   r…   Ú_ZlibDecompressorrˆ   Ú_new_memberr–   )r=   r  r°   s     €r+   r@   Ú_GzipReader.__init__÷  s>   ø€ Ü‰Ñœ R›¬$×*@Ñ*@Ü $§¡˜ð 	ñ 	0ð  ˆÔØˆÕr,   c                 óH   • [         R                  " S5      U l        SU l        g r£   )r…   r¤   Ú_crcÚ_stream_sizerO   s    r+   Ú
_init_readÚ_GzipReader._init_readþ  s   € Ü—J’J˜s“OˆŒ	ØˆÕr,   c                 óB   • [        U R                  5      nUc  gXl        g)NFT)r  Ú_fpr–   )r=   r  s     r+   r  Ú_GzipReader._read_gzip_header  s"   € Ü& t§x¡xÓ0ˆ
ØÑØØ%ÔØr,   c                 óö  • US:  a  U R                  5       $ U(       d  g U R                  R                  (       a8  U R                  5         SU l        U R
                  " S0 U R                  D6U l        U R                  (       a>  U R                  5         U R                  5       (       d  U R                  U l
        gSU l        U R                  R                  (       a;  U R                  R                  [        5      nU R                  R                  X!5      nOU R                  R                  SU5      nU R                  R                   S:w  a/  U R                  R#                  U R                  R                   5        US:w  a  OWS:X  a  [%        S5      eGMx  [&        R(                  " X0R*                  5      U l        U =R,                  [/        U5      -  sl        U =R                  [/        U5      -  sl	        U$ )Nr   r,   TFr
  rN   )ÚreadallÚ_decompressorÚeofÚ	_read_eofr  Ú_decomp_factoryÚ_decomp_argsr#  r  Ú_posÚ_sizeÚneeds_inputr&  r   ÚREAD_BUFFER_SIZEr   Úunused_datar?   r  r…   r¤   r!  r"  r9   )r=   rD   ÚbufÚ
uncompresss       r+   r   Ú_GzipReader.read	  s—  € Ø�!‹8Ø—<‘<“>Ð!æØð
 Ø×!Ñ!×%×%ð
 —‘Ô Ø#'�Ô Ø%)×%9Ò%9ñ &)Ø×'Ñ'ñ&)�Ô"ð ××ð —‘Ô!Ø×-Ñ-×/Ñ/Ø!%§¡�D”JØØ#(�Ô ð ×!Ñ!×-×-Ø—h‘h—m‘mÔ$4Ó5�Ø!×/Ñ/×:Ñ:¸3ÓE‘
à!×/Ñ/×:Ñ:¸3ÀÓE�
à×!Ñ!×-Ñ-°Ó4ð —‘× Ñ  ×!3Ñ!3×!?Ñ!?Ô@à˜SÓ ØØ�c‹zÜð  Bó Cð CòG ôL —J’J˜z¯9©9Ó5ˆŒ	Ø×ÒœS ›_Ñ,ÕØ�	Š	”S˜“_Ñ$�	ØÐr,   c                 ó°  • [         R                  " S[        U R                  S5      5      u  pXR                  :w  a/  [        S[        U5      < S[        U R                  5      < 35      eX R                  S-  :w  a  [        S5      eSnUS:X  a#  U R                  R                  S5      nUS:X  a  M#  U(       a  U R                  R                  U5        g g )	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,  Ú_GzipReader._read_eof>  s±   € ô
 —}’} U¬K¸¿¹À!Ó,DÓE‰ˆØ—I‘IÓÝ¼SÀ¾ZÜ=@ÀÇÁ½^ðMó Nð Nà×(Ñ(¨:Ñ5Ó6ÜÐAÓBÐBð
 ˆØ�7‹lØ—‘—‘˜aÓ ˆAð �7�læØ�H‰H×Ñ˜QÕð r,   c                 ó0   >• [         TU ]  5         SU l        g rM   )r­   Ú_rewindr  r¯   s    €r+   r>  Ú_GzipReader._rewindS  s   ø€ Ü‰‰ÔØˆÕr,   )r!  r*  r–   r  r0  r"  r  )rS   rT   rU   rV   r@   r#  r  r   r,  r>  rX   r  r  s   @r+   r~   r~   ö  s'   ø† õ òòô3òj ÷* ó  r,   r~   )r‘   c                ó¶   • [         R                  " XSS9nUc  [        R                  " 5       n[        R                  " SU[        U5      US   S5      nXCS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.
é   )Úlevelr  Nz<4sLBBr   éÿ   é
   )r…   r   rÁ   r.   r/   rÂ   )rf   r%   r‘   Ú	gzip_dataÚheaders        r+   r   r   X  sS   € ô —’˜d¸rÑB€IØ�}Ü—	’	“ˆô �[Š[˜ 9¬c°%«j¸)ÀA¹,ÈÓL€FØ˜b˜c�NÑ"Ð"r,   c                 ó”  • / n [         R                  " U 5      n[        U5      c  SR                  U5      $ [        R
                  " [        R                  * S9nUR                  XR                  5       S 5      nUR                  (       a  [        UR                  5      S:  a  [        S5      e[        R                  " SUR                  SS 5      u  pVU[        R                  " U5      :w  a  [!        S5      eU[        U5      S-  :w  a  [!        S	5      eUR#                  U5        UR                  SS R%                  S
5      n GMF  )zQDecompress a gzip compressed string in one shot.
Return the decompressed string.
Nr,   r  r   r
  r8  zCRC check failedrã   r9  r¸   )r    ÚBytesIOr  Újoinr…   Údecompressobjrˆ   r   r®   r+  r9   r3  r  r.   r  r¤   r   ÚappendÚlstrip)rf   Údecompressed_membersr  ÚdoÚdecompressedr¥   rÒ   s          r+   r   r   i  s  € ð ÐØ
Ü�ZŠZ˜ÓˆÜ˜RÓ Ñ(Ø—8‘8Ð0Ó1Ð1ä×Ò¤t§~¡~ oÑ6ˆà—}‘} T¯'©'«)¨*Ð%5Ó6ˆØ�v�vœ˜RŸ^™^Ó,¨qÓ0Üð 0ó 1ð 1ä—m’m E¨2¯>©>¸"¸1Ð+=Ó>‰ˆØ”$—*’*˜\Ó*Ó*ÜÐ0Ó1Ð1Ø”c˜,Ó'¨*Ñ4Ó5ÜÐAÓBÐBØ×#Ñ# LÔ1Ø�~‰~˜a˜bÐ!×(Ñ(¨Ó1ˆò# r,   c                  ó®  • SSK Jn   U " SS9nUR                  5       nUR                  SSSS9  UR                  S	SS
S9  UR                  SSSSS9  UR                  SSS/SS9  UR	                  5       n[
        nUR                  (       a  [        nOUR                  (       a  [        nUR                   GHœ  nUR                  (       aŽ  US:X  a>  [        SS[        R                  R                  S9n[        R                   R                  nOµUSS  S:w  a  [        R"                  " SU< 35        [%        US5      n[&        R$                  " US S S5      nOkUS:X  a?  [        R                  R                  n[        SS[        R                   R                  US9nO&[&        R$                  " US5      n[%        US-   S5      n UR)                  [*        5      nU(       d  OUR-                  U5        M0  U[        R                   R                  La  UR/                  5         U[        R                  R                  Ld  GMŒ  UR/                  5         GMŸ     g )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Ú*Ú-r;   )ÚnargsÚdefaultÚmetavarr   r   )r#   r$   rŽ   rµ   z.gzzfilename doesn't end in .gz: r   )r#   r$   rŽ   r%   )ÚargparserQ  Úadd_mutually_exclusive_groupÚadd_argumentÚ
parse_argsÚ_COMPRESS_LEVEL_TRADEOFFÚfastrÄ   ÚbestrÃ   rV  r   r   ÚsysÚstdinÚbufferÚstdoutÚexitr   rx   r   r2  r   rä   )	rQ  ÚparserÚgrouprV  r%   Úargr>   Úgrþ   s	            r+   Úmainrl  ‚  sî  € Ý'Ùð	,ñ-€Fð ×/Ñ/Ó1€EØ	×Ñ�x¨Ð;LÐÑMØ	×Ñ�x¨Ð;LÐÑMØ	×Ñ�t˜^°LØ>ð ñ @ð ×Ñ˜ c°C°5À&ÐÑIØ×ÑÓ€Dä,€MØ‡y‡yÜ,‰Ø	��Ü,ˆà�y�yˆØ�?�?Ø�c‹zÜ b¨t¼S¿Y¹Y×=MÑ=MÑN�Ü—J‘J×%Ñ%‘à�r�s�8˜uÓ$Ü—H’HÐ<¸S¹GÐDÔEÜ˜˜d“O�Ü—M’M # c r (¨DÓ1‘à�c‹zÜ—I‘I×$Ñ$�Ü b¨t¼S¿Z¹Z×=NÑ=NØ+8ñ:‘ô —M’M # tÓ,�Ü˜˜u™ dÓ+�ØØ—F‘FÔ+Ó,ˆEÞØØ�G‰G�EŒNñ	 ð
 ”C—J‘J×%Ñ%Ò%Ø�G‰GŒIØ”C—I‘I×$Ñ$Õ$Ø�G‰G�Iò5 r,   Ú__main__))rW   Ú_compressionrx   r    r   r.   rc  rÁ   r_   r…   Ú__all__ÚFTEXTr  r  r¿   r  r}   rƒ   rÄ   r`  rÃ   r2  rØ   r‹   r   r2   r4   rË   r   Ú	RawIOBaser\   Ú
BaseStreamr   r  r  ÚDecompressReaderr~   r   r   rl  rS   rN   r,   r+   Ú<module>rt     s  ðñ%ó Û Û 	Û 	Û Û 
Û Û Û â
G€à(6Ñ %€€uˆf�e˜Xà€Ø€àÐ ØÐ ØÐ àÐ Ø˜×/Ñ/Ñ/Ð ð Ð,@Ø˜t¨Tô+òZ+÷
'ñ 'ôTA�'ô Aô˜Ÿ™ô ô$k+ˆ|×&Ñ&ô k+ò\	ò "ôJ_ �,×/Ñ/ô _ ðD "6ð #Àö #ò"2ò2.ð` ˆzÓÙ…Fð r,   