+
    Dfj%                         R t ^ RIt^ RIt^ RIt^ RIt ! R R]P                  4      t ! R R4      t ! R R]4      t	 ! R R	]4      t
^tR
 tR tRR ltR# )z
An incremental approach to unzipping files.  This allows you to unzip a little
bit of a file at a time, which means you can report progress as a file unzips.
Nc                   *   a  ] tR t^t o RtR tRtV tR# )ChunkingZipFilezr
A L{zipfile.ZipFile} object which, with L{readfile}, also gives you access
to a file-like object for each entry.
c                   V P                   R9  d   \        R4      hV P                  '       g   \        R4      hV P                  V4      pV P                  P	                  VP
                  ^ 4       V P                  P                  \        P                  4      pVR,          \        P                  8w  d   \        P                  ! R4      h\        P                  ! \        P                  V4      pV P                  P                  V\        P                  ,          4      pV\        P                  ,          '       d1   V P                  P                  V\        P                  ,          4       VP                   R,          '       d   VP#                  R4      pMVP#                  R4      pWRP$                  8w  d*   \        P                  ! RVP$                  : R	V: R
24      hVP&                  \        P(                  8X  d   \+        WP,                  4      # VP&                  \        P.                  8X  d   \1        WP,                  4      # \        P                  ! RVP&                  V3,          4      h)z#
Return file-like object for name.
zread() requires mode "r" or "a"z3Attempt to read ZIP archive that was already closed:       Nz Bad magic number for file headeri   zutf-8cp437zFile name in directory "z" and header "z	" differ.z-Unsupported compression method %d for file %s)ra)modeRuntimeErrorfpgetinfoseekheader_offsetreadzipfilesizeFileHeaderstringFileHeader
BadZipFilestructunpackstructFileHeader_FH_FILENAME_LENGTH_FH_EXTRA_FIELD_LENGTH	flag_bitsdecodeorig_filenamecompress_type
ZIP_STOREDZipFileEntrycompress_sizeZIP_DEFLATEDDeflatedZipFileEntry)selfnamezinfofheaderfname	fname_strs   &&    :/usr/lib/python3/dist-packages/twisted/python/zipstream.pyreadfileChunkingZipFile.readfile   s    99J&@AAwwwTUUT"U((!,'',,w5563<7333$$%GHH-- 8 8'BWW%@%@AB71122GGLL!?!?@A??U""W-IW-I+++$$&&	3 
 '"4"44&9&9::  G$8$88'.A.ABB$$?&&-.      N)__name__
__module____qualname____firstlineno____doc__r*   __static_attributes____classdictcell____classdict__s   @r)   r   r      s     
* *r,   r   c                   d   a  ] tR t^Ct o RtR tR tR tR tR t	]	t
R tR tR	 tR
 tR tRtV tR# )
_FileEntrya  
Abstract superclass of both compressed and uncompressed variants of
file-like objects within a zip archive.

@ivar chunkingZipFile: a chunking zip file.
@type chunkingZipFile: L{ChunkingZipFile}

@ivar length: The number of bytes within the zip file that represent this
file.  (This is the size on disk, not the number of decompressed bytes
which will result from reading it.)

@ivar fp: the underlying file object (that contains pkzip data).  Do not
touch this, please.  It will quite likely move or go away.

@ivar closed: File-like 'closed' attribute; True before this file has been
closed, False after.
@type closed: L{bool}

@ivar finished: An older, broken synonym for 'closed'.  Do not touch this,
please.
@type finished: L{int}
c                p    Wn         V P                   P                  V n        W n        ^ V n        RV n        R# )z3
Create a L{_FileEntry} from a L{ChunkingZipFile}.
FN)chunkingZipFiler   lengthfinishedclosedr#   r:   r;   s   &&&r)   __init___FileEntry.__init__[   s0      /&&))r,   c                    R# )z4
Returns false because zip files should not be ttys
Fr-   r#   s   &r)   isatty_FileEntry.isattye   s     r,   c                &    RV n         ^V n        V =R# )z
Close self (file-like object)
TN)r=   r<   r   rB   s   &r)   close_FileEntry.closek   s     Gr,   c                ^   a  Rp\        V 3R lR4       F  pW,          pVR8X  g   K   V# 	  V# )z
Read a line.
r,   c                  &   < S P                  ^4      # )   )r   rB   s   r)   <lambda>%_FileEntry.readline.<locals>.<lambda>x   s    1r,      
)iter)r#   linebytes   f  r)   readline_FileEntry.readlines   s9     -s3DLDu}	 4 r,   c                J    V P                  4       pV'       d   V# \        4       h)zQ
Implement next as file does (like readline, except raises StopIteration
at EOF)
)rQ   StopIteration)r#   nextlines   & r)   __next___FileEntry.__next__~   s    
 ==?Oor,   c                    \        V 4      # )z!
Returns a list of all the lines
)listrB   s   &r)   	readlines_FileEntry.readlines   s     Dzr,   c                    V # z
Returns an iterator (so self)
r-   rB   s   &r)   
xreadlines_FileEntry.xreadlines   	     r,   c                    V # r]   r-   rB   s   &r)   __iter___FileEntry.__iter__   r`   r,   c                    V # Nr-   rB   s   &r)   	__enter___FileEntry.__enter__   s    r,   c                &    V P                  4        R # re   )rF   )r#   exc_type	exc_value	tracebacks   &&&&r)   __exit___FileEntry.__exit__   s    

r,   )r:   r=   r<   r   r;   N)r.   r/   r0   r1   r2   r?   rC   rF   rQ   rV   nextrZ   r^   rb   rf   rl   r3   r4   r5   s   @r)   r8   r8   C   sH     .	 D r,   r8   c                   :   a  ] tR t^t o RtR tR tRR ltRtV t	R# )r   zB
File-like object used to read an uncompressed entry in a ZipFile
c                @    \         P                  WV4       ^ V n        R# )r   N)r8   r?   	readBytesr>   s   &&&r)   r?   ZipFileEntry.__init__   s    D6:r,   c                    V P                   # re   )rq   rB   s   &r)   tellZipFileEntry.tell   s    ~~r,   Nc                   Vf   V P                   V P                  ,
          pV^ 8X  g   V P                  '       d   R# V P                  P                  P                  \        WP                   V P                  ,
          4      4      pV ;P                  \        V4      ,          un        V P                  V P                   8X  g   \        V4      V8  d   ^V n        V# )Nr,   )r;   rq   r<   r:   r   r   minlen)r#   ndatas   && r)   r   ZipFileEntry.read   s    9dnn,A6T]]]##&&++C;;3O,PQ#d)#>>T[[(CIMDMr,   )r<   rq   re   
r.   r/   r0   r1   r2   r?   rt   r   r3   r4   r5   s   @r)   r   r      s     	 	r,   r   c                   :   a  ] tR t^t o RtR tR tRR ltRtV t	R# )r"   z=
File-like object used to read a deflated entry in a ZipFile
c                    \         P                  WV4       ^ V n        ^ V n        \        P
                  ! R4      V n        RV n        R# )r   r,   Ni)r8   r?   returnedBytesrq   zlibdecompressobjdecompbufferr>   s   &&&r)   r?   DeflatedZipFileEntry.__init__   s:    D6:((-r,   c                    V P                   # re   )r   rB   s   &r)   rt   DeflatedZipFileEntry.tell   s    !!!r,   Nc                \   V P                   '       d   R # VEf   V P                  .pVP                  V P                  P	                  V P
                  P                  P                  V P                  V P                  ,
          4      4      4       VP                  V P                  P	                  R4      4       VP                  V P                  P                  4       4       R V n        ^V n         R P                  V4      pV ;P                  \        V4      ,          un        V# \        V P                  4      V8  Ed(   V P
                  P                  P                  \        VRV P                  V P                  ,
          4      4      pV ;P                  \        V4      ,          un	        V'       g~   V P                  V P                  P	                  R4      ,           V P                  P                  4       ,           p^V n         R V n        V ;P                  \        V4      ,          un        V# V ;P                  V P                  P	                  V4      ,          un        EKB  V P                  RV pV P                  VR V n        V ;P                  \        V4      ,          un        V# )r,   N   Zi   )r<   r   appendr   
decompressr:   r   r   r;   rq   flushjoinr   rx   rw   )r#   ry   resultrz   s   &&  r)   r   DeflatedZipFileEntry.read   s   ===9F MM&&((++00t~~1MN
 MM$++0067MM$++++-.DKDMXXf%F#f+-Mdkk"Q&++..334t~~!=> #d)+dkk&<&<T&BBT[[EVEVEXX  %&DM"%DK&&#f+5&!MKK4;;#9#9$#??KK[[!_F++ab/DK#f+-Mr,   )r   r   r<   rq   r   re   r|   r5   s   @r)   r"   r"      s     "& &r,   r"   c                r    ^ p\        V 4      pVP                  4        F  pV\        WA4      ,          pK  	  V# )zf
Predict the number of chunks that will be extracted from the entire
zipfile, given chunksize blocks.
)r   infolistcountFileChunks)filename	chunksizetotalchunkszfinfos   &&   r)   countZipFileChunksr      s8    
 K		"Bt77 r,   c                j    \        V P                  V4      w  r#V^ 8  d
   V^,          pT;'       g    ^# )a  
Count the number of chunks that will result from the given C{ZipInfo}.

@param zipinfo: a C{zipfile.ZipInfo} instance describing an entry in a zip
archive to be counted.

@return: the number of chunks present in the zip file.  (Even an empty file
counts as one chunk.)
@rtype: L{int}
)divmod	file_size)zipinfor   countextras   &&  r)   r   r     s4     '++Y7LEqy
::Ar,   c              #    "   \        V R4      p\        P                  P                  V4      '       g   \        P                  ! V4       \        W4      pVP                  4       pVP                  4       p\        Wg4       EF  w  rV	P                  \        ,          p
\        P                  P                  W4      pV
'       dK   \        P                  P                  V4      '       g   \        P                  ! V4       V^,          pVx  K  \        P                  P                  V4      ^ ,          p\        P                  P                  V4      '       g   \        P                  ! V4       V'       g&   \        P                  P                  V4      '       g   VP                  V4      pV	P                  ^ 8X  d   V^,          pVx  \        VR4      ;_uu_ 4       pVP!                  4       V	P                  8  d2   VP#                  V4      pVP%                  V4       V^,          pVx  KP   RRR4       EK  V\'        W4      ,          pVx  EK  	  R#   + '       g   i     EK  ; i5i)z
Return a generator for the zipfile.  This implementation will yield after
every chunksize uncompressed bytes, or at the end of a file, whichever
comes first.

The value it yields is the number of chunks left to unzip.
r   wbN)r   ospathexistsmakedirsr   namelistr   zipexternal_attrDIR_BITr   splitr*   r   openrt   r   writer   )r   	directory	overwriter   czf	remainingnamesinfosentryr   isdirffdirr   outfilehunks   &&&&            r)   unzipIterChunkyr     s     (C
(C77>>)$$
I"87ILLNELLNE5(""W,GGLL*77>>!$$ANIO 77==#A&D77>>$''D!q 1 1\\%(>>Q&NI#O!T]]g'')dnn4!wwy1d+!Q	'	 5 #] _T==	9 )( #]]s9   C&I.)A/I.I.7$I.AI.AI1(I.I+$
I.).r   i   )r2   os.pathr   r   r   r   ZipFiler   r8   r   r"   r   r   r   r   r-   r,   r)   <module>r      se   

    0goo 0f^ ^B: 05: 5p 	"+ r,   