+
     Bie                    D   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt ^ RIt]P                  t ^ RIt ^ RIt ^ RIHt . RAOt ! R R]4      t ! R	 R]4      t];ttRBtRCtRCt^ t^t^t^t^]t ^t!^-t"^.t#^?t$^?t%^?t&R
t'Rt(]PR                  ! ]'4      t*^ t+^t,^t-^t.^t/^t0^t1^t2^t3^	t4Rt5Rt6]PR                  ! ]54      t7^ t8^t9^t:^t;^t<^t=^t>^t?^t@^	tA^
tB^tC^tD^tE^tF^tG^tH^tI^tJ^tK^tL^tM^ tN^@tORDtPRtQRtR]PR                  ! ]Q4      tS^ tT^tU^tV^tW^tX^tY^tZ^t[^t\^	t]^
t^^t_Rt`Rta]PR                  ! ]`4      tbRtcRtd]PR                  ! ]c4      te^ tf^tg^th^ti^tj^tk^tl^tm^tn^	toRtp ! R R]q4      trR tsR ttRER ltuR tvR twR tx ! R R4      tyRszR t{R t| ! R  R!4      t} ! R" R#4      t~/ ^ R$b^R%b^R&b^R&b^R&b^R&b^R'b^R(b^R)b^	R*b^
R'b^R+b^R,b^R-b^R.b^]R/b^aR0b^bR1/CtR2 tRFR3 ltR4 t ! R5 R64      t ! R7 R84      t ! R9 R:]EP
                  4      t ! R; R<]EP
                  4      t ! R= R4      t ! R> R]4      tRFR? lt^R@IHtHt R#   ] d    Rt]P                  t EL2i ; i  ] d    Rt EL=i ; i  ] d    Rt ELHi ; i  ] d    Rt ELQi ; i)GzP
Read and write ZIP files.

XXX references to utf-8 need further investigation.
N)zstd
BadZipFileZipInfoZipFile	PyZipFileLargeZipFilec                       ] tR t^,tRtR# )r    N)__name__
__module____qualname____firstlineno____static_attributes__r	       '/usr/lib/python3.14/zipfile/__init__.pyr   r   ,   s    r   c                       ] tR t^0tRtRtR# )r   zi
Raised when writing a zipfile, the zipfile requires ZIP64 extensions
and those extensions are disabled.
r	   N)r
   r   r   r   __doc__r   r	   r   r   r   r   0   s    r   s   <4s4H2LHs   PKz<4s4B4HL2L5H2Ls   PKz<4s2B4HL2L2Hs   PKz<4sLQLs   PKz
<4sQ2H2L4Qs   PKiPKc                      a a ] tR t^t o]P
                  ! R4      tRV 3R lltRR lt]	R 4       t
]	R 4       t]	R 4       tRtVtV ;t# )	_Extra<HHc                "   < \         SV `  W4      # N)super__new__)clsvalid	__class__s   &&&r   r   _Extra.__new__   s    ws((r   c                    W n         R # r   r   )selfr   r   s   &&&r   __init___Extra.__init__   s    r   c                     V P                   P                  VR ,          4      w  r#V ! VR^V,            V4      V^V,           R 3#   \        P                   d    Rp^ p L:i ; i)N   NN)FIELD_STRUCTunpackstructerror)r   rawxidxlens   &&  r   read_one_Extra.read_one   sj    	((//B8IC 3w$<%s1T67|33 || 	CD	s   $A A! A!c              #  n   "   \        V4      pV'       d   \        P                  V4      w  r2Vx  K%  R # 5ir   )
memoryviewr   r.   )r   datarestextras   &&  r   split_Extra.split   s.      $ //$/KEK s   55c                X   a RP                  V3R lV P                  V4       4       4      # )z'Remove Extra fields with specified IDs.r   c              3   N   <"   T F  pVP                   S9  g   K  Vx  K  	  R # 5ir   r    ).0exxidss   & r   	<genexpr>_Extra.strip.<locals>.<genexpr>   s&      
%uuD  B%s   %
%)joinr5   )r   r2   r;   s   &&fr   strip_Extra.strip   s+     xx 
iio
 
 	
r   r    r   )r
   r   r   r   r)   Structr'   r   r"   classmethodr.   r5   r?   r   __classdictcell____classcell__r   __classdict__s   @@r   r   r      s^     =='L) 4 4   
 
 
r   r   c                 &    \        V 4      pV'       d   V\        ,          ^ 8X  d'   V\        ,          ^ 8X  d   V\        ,          ^ 8X  d   R# V\        ,          V\
        ,          8X  d   V P                  \        \        V4      4      4       V\        ,          \        8  d]   V P                  \        4      p\        V4      \        8X  d4   \        P                  ! \        V4      pV\        ,          \         8X  d   R# R#   \"         d     R# i ; i)    TF)_EndRecData_ECD_ENTRIES_TOTAL	_ECD_SIZE_ECD_OFFSET_ECD_DISK_NUMBER_ECD_DISK_STARTseeksum_handle_prepended_datasizeCentralDirreadlenr)   r(   structCentralDir_CD_SIGNATUREstringCentralDirOSError)fpendrecr2   centdirs   &   r   _check_zipfiler\      s    R()Q.6)3D3IfU`NaefNf()VO-DD26:;<)$677>2D4yN2"(--0@$"G"=15EE#'   s   A	D B0D DDc                *   Rp \        V R4      '       d0   V P                  4       p\        V R7      pV P                  V4       V# \	        V R4      ;_uu_ 4       p\        V4      pRRR4       V#   + '       g   i     T# ; i  \
         d     T# i ; i)zQuickly see if a file is a ZIP file by checking the magic number.

The filename argument may be a file or file-like object too.
FrS   )rY   rbN)hasattrtellr\   rO   openrX   )filenameresultposrY   s   &   r   
is_zipfilere      s    
 F	8V$$--/C#x0FMM# M	 h%%'+ & M	 &% M  Ms5   ?B B A/%B /B 	:B  B BBc                    V \         ,          pV \        ,          pV \        ,          V,
          V,
          pV \        ,          \        8X  d   V\
        \        ,           ,          pV^8  d   WC,           p\        RW5V4       W43# )   zgiven, inferred, offset)rK   rL   _ECD_LOCATION_ECD_SIGNATUREstringEndArchive64sizeEndCentDir64sizeEndCentDir64Locatorprint)rZ   debugsize_cd	offset_cdconcatinferreds   &&    r   rQ   rQ     sp    YG{#I M"W,y8Fn!33#&==>qy%'fEr   c           
         V P                  V\        ,
          ^4       T P                  \        4      p\	        T4      \        8w  d   T# \
        P                  ! \        T4      w  rErgT\        8w  d   T# T^ 8w  g   T^8  d   \        R4      hT P                  T\        ,
          \        ,
          ^4       T P                  \        4      p\	        T4      \        8w  d   T# \
        P                  ! \        T4      w
  rHrrrppT\        8w  d   T# YB\        &   Y\        &   Y\        &   Y\         &   Y\"        &   Y\$        &   TT\&        &   T#   \         d    Tu # i ; i)zE
Read the ZIP64 end-of-archive records and use that to update endrec
z3zipfiles that span multiple disks are not supported)rO   rl   rX   rS   rT   r)   r(   structEndArchive64LocatorstringEndArchive64Locatorr   rk   structEndArchive64rj   ri   rM   rN   _ECD_ENTRIES_THIS_DISKrJ   rK   rL   )fpinoffsetrZ   r2   sigdisknoreloffdisksszcreate_versionread_versiondisk_numdisk_dirdircount	dircount2dirsize	diroffsets   &&&              r   _EndRecData64r      sF   		&22A6 99,-D
4y++!'/H$!OC
''{eaiNOO 	IIf..1AA1E99%&D
4y$$ 	($/0C^8Wi
   !>'&?%-!"!*9#F;ME   s   E EEc                D   V P                  ^ ^4       V P                  4       p V P                  \        ) ^4       T P	                  \        4      p\        T4      \        8X  d   TR,          \        8X  dp   TRR R8X  df   \        P                  ! \        T4      p\        T4      pTP                  R4       TP                  T\        ,
          4       \        T \        ) T4      # \        T\        ,
          \        ,
          ^ 4      pT P                  T^ 4       T P	                  \        \        ,           4      pTP                  \        4      pT^ 8  d   Y%T\        ,            p\        T4      \        8w  d   R# \        \        P                  ! \        T4      4      pT\         ,          pY%\        ,           T\        ,           T,            pTP                  T4       TP                  YE,           4       \        YT,           T,
          T4      # R#   \         d     R# i ; i)zReturn data from the "End of Central Directory" record, or None.

The data is a list of the nine items in the ZIP "End of central dir"
record followed by a tenth item, the file seek offset of this record.N:rH   r&   Ns     r   )rO   r`   sizeEndCentDirrX   rS   rT   stringEndArchiver)   r(   structEndArchivelistappendr   maxZIP_MAX_COMMENTrfind_ECD_COMMENT_SIZE)	rx   filesizer2   rZ   maxCommentStartstartrecDatacommentSizecomments	   &        r   rI   rI   K  s    	IIaOyy{H
		>/1% 99^$DD	^#S	%%RS	[ /6F| 	ch/0 TN?F;; (_4~EqIOIIoq!99_~56DJJ'(EzU>12w<>)fmm$4g>?./^+E.,@,LMgo-. TU#:X#E#% 	% W  s   H HHc                   V P                  \        ^ 4      4      pV^ 8  d   V ^ V p \        P                  R8w  d6   \        P                  V 9   d!   V P	                  \        P                  R4      p \        P
                  '       dK   \        P
                  R8w  d6   \        P
                  V 9   d!   V P	                  \        P
                  R4      p V # )zvTerminate the file name at the first null byte and
ensure paths always use forward slashes as the directory separator./)findchrossepreplacealtsep)rb   	null_bytes   & r   _sanitize_filenamer     s     c!f%IA~Ai( 
vv}8+##BFFC0	yyyRYY#%"))x*?##BIIs3Or   c                      a  ] tR tRt o RtRtRR lt]R 4       t]P                  R 4       tR t
RR ltR	 tR
 t]RRR/R ll4       tR tR tRtV tR# )r   i  z>Class with attributes describing each file in the ZIP archive.c                   Wn         \        V4      pWn        W n        V^ ,          R8  d   \	        R4      h\
        V n        RV n        RV n        RV n	        \        P                  R8X  d	   ^ V n        M^V n        \        V n        \        V n        ^ V n        ^ V n        ^ V n        ^ V n        ^ V n        ^ V n        ^ V n        RV n        R# )rH     z+ZIP does not support timestamps before 1980Nr   win32)orig_filenamer   rb   	date_time
ValueError
ZIP_STOREDcompress_typecompress_levelr   r4   sysplatformcreate_systemDEFAULT_VERSIONr   extract_versionreserved	flag_bitsvolumeinternal_attrexternal_attrcompress_size	file_size_end_offset)r!   rb   r   s   &&&r   r"   ZipInfo.__init__  s    % &h/ "Q<$JKK ("
<<7"!"D "#D-.r   c                    V P                   # r   r   r!   s   &r   _compresslevelZipInfo._compresslevel  s    """r   c                    Wn         R # r   r   )r!   values   &&r   r   r     s    #r   c                   R V P                   P                  : RV P                  : 2.pV P                  \        8w  dA   VP                  R\        P                  V P                  V P                  4      ,          4       V P                  ^,	          pV P                  R,          pV'       d-   VP                  R\        P                  ! V4      ,          4       V'       d   VP                  RV,          4       V P                  4       pV'       d   V P                  '       d#   VP                  RV P                  ,          4       V'       d   V P                  '       dS   V P                  \        8w  g   V P                  V P                  8w  d#   VP                  RV P                  ,          4       VP                  R4       R	P                  V4      # )
<z
 filename= compress_type=%s  z filemode=%rz external_attr=%#xz file_size=%rz compress_size=%r> )r   r
   rb   r   r   r   compressor_namesgetr   statfilemodeis_dirr   r   r>   )r!   rc   hiloisdirs   &    r   __repr__ZipInfo.__repr__  s@   '+~~'>'>NO+MM-*..t/A/A/3/A/ACC D 2%&(MM.4==+<<=MM.34MM/DNN:;$,,,:-^^t111MM-0B0BBCcwwvr   Nc                   V P                   pV^ ,          R,
          ^	,          V^,          ^,          ,          V^,          ,          pV^,          ^,          V^,          ^,          ,          V^,          ^,          ,          pV P                  \        ,          '       d   ^ ;p;rgM$V P                  pV P                  pV P
                  pV P                  p^ p	Vf   V\        8  ;'       g
    V\        8  pV'       dH   Rp
V\        P                  ! V
^\        P                  ! V
4      ^,
          Wv4      ,           pRpRp\        p	V P                  \        8X  d   \        \        V	4      p	MKV P                  \         8X  d   \        \"        V	4      p	M%V P                  \$        8X  d   \        \&        V	4      p	\        WP(                  4      V n        \        WP*                  4      V n        V P-                  4       w  r\        P                  ! \.        \0        V P(                  V P2                  VV P                  WCVWg\5        V4      \5        V4      4      pW,           V,           # )zReturn the per-file header as a bytes object.

When the optional zip64 arg is None rather than a bool, we will
decide based upon the file_size and compress_size, if known,
False otherwise.
r   z<HHQQ    )r   r   _MASK_USE_DATA_DESCRIPTORCRCr   r   r4   ZIP64_LIMITr)   packcalcsizeZIP64_VERSIONr   	ZIP_BZIP2r   BZIP2_VERSIONZIP_LZMALZMA_VERSIONZIP_ZSTANDARDZSTANDARD_VERSIONr   r   _encodeFilenameFlagsstructFileHeaderstringFileHeaderr   rT   )r!   zip64dtdosdatedostimer   r   r   r4   min_versionfmtrb   r   headers   &&            r   
FileHeaderZipInfo.FileHeader  s    ^^a54<A%1
2RU:Q%2+1
*beqj9>>555.//C/-)((C ..MI

= +JJ}{/JECFKK()6??3+?+A9] ]E"I&M'K*m[9K8+lK8K=0/=K";0D0DE!+/B/BC"779-/?!114==)!//3* ]CJ	8
  5((r   c                     V P                   P                  R 4      V P                  3#   \         d6    T P                   P                  R4      T P                  \        ,          3u # i ; i)asciiutf-8)rb   encoder   UnicodeEncodeError_MASK_UTF_FILENAMEr   s   &r   r   ZipInfo._encodeFilenameFlags+  s[    	V==''0$..@@! 	V==''0$..CU2UUU	Vs   &) =A)(A)c                   V P                   p\        P                  p\        V4      ^8  Edk   V! RVR,          4      w  rEV^,           \        V4      8  d   \	        RWE3,          4      hV^8X  d   V^V^,            p V P
                  R9   d#   RpV! RVR,          4      w  V n        VR,          pV P                  R8X  d#   R	pV! RVR,          4      w  V n        VR,          pV P                  R8X  d   R
pV! RVR,          4      w  V n        M{VR8X  du   V^V^,            p V! RVR,          4      w  rV^8X  dO   W8X  dI   VR,          P                  R4      p
V
'       d   \        V
4      V n        M^ RIpVP                  R^R7       W%^,           R pEK{  R#   \        P                   d    \	        RX R24      Rhi ; i  \        P                   d   p\	        R4      ThRp?i\         d   p\	        R4      ThRp?ii ; i)r&   r   r%   z"Corrupt extra field %04x (size=%d)r   z	File sizez<Q:N   N:r   NNzCompress sizezHeader offsetzCorrupt zip64 extra field. z not found.Niup  z<BL:N   N:r   NNr   z'Empty unicode path extra field (0x7075)
stacklevelz)Corrupt unicode path extra field (0x7075)z>Corrupt unicode path extra field (0x7075): invalid utf-8 bytes)l    r   )r4   r)   r(   rT   r   r   r   header_offsetr*   decoder   rb   warningswarnUnicodeDecodeError)r!   filename_crcr4   r(   tplnr2   field
up_versionup_name_crcup_unicode_namer   es   &&           r   _decodeExtraZipInfo._decodeExtra1  s   

%jAoE59-FB!tc%j  !E!PQQV|Qr!t}F~~)MM +*0tBx*@#Bx))[8 /.4T48.D+*#Bx))[8 /.4T48.D+* vQr!t}n.4UDH.E+J!Q;+F*.r(//'*B*,>,ODM+$MM*S`aMb Q$%LEO & || F$'B(-wk&; <AEFF || Y$%PQWXX) n$%eflmmnsC   >BF #>G "G 3G &G HG$$H1H2G>>Hstrict_timestampsTc               x   \        V\        P                  4      '       d   \        P                  ! V4      p\        P                  ! V4      p\        P
                  ! VP                  4      p\        P                  ! VP                  4      pVR,          pV'       g   V^ ,          R8  d   RpMV'       g   V^ ,          R8  d   RpVf   Tp\        P                  P                  \        P                  P                  V4      ^,          4      pV^ ,          \        P                  \        P                  39   d   VR,          pK7  V'       d
   VR,          pV ! W'4      pVP                  R,          ^,          Vn        V'       d#   ^ Vn        V;P                  ^,          un        V# VP"                  Vn        V# )	a7  Construct an appropriate ZipInfo for a file on the filesystem.

filename should be the path to a file or directory on the filesystem.

arcname is the name which it will have within the archive (by default,
this will be the same as filename, but without a drive letter and with
leading path separators removed).
:rH      Nr   ;  :   NNr   r   r   r  r  rH   rH   rH   )r
           ;   r  )
isinstancer   PathLikefspathr   S_ISDIRst_modetime	localtimest_mtimepathnormpath
splitdriver   r   r   r   st_size)	r   rb   arcnamer  str   mtimer   zinfos	   &&&$     r   	from_fileZipInfo.from_file^  s8    h,,yy*HWWXRZZ(r{{+#J	 Yq\D%8-I"y|d':2I?G''""277#5#5g#>q#ABajRVVRYY//bkGsNGG'!zzF2r9EO4'  !jjEOr   c                   \         P                  P                  R4      pV'       d   \        V4      M\        P                  ! 4       p\        P
                  ! V4      R,          V n        VP                  V n        VP                  V n
        V P                  P                  R4      '       d#   RV n        V ;P                  ^,          un        V # RV n        V # )zResolve suitable defaults from the archive.

Resolve the date_time, compression attributes, and external attributes
to suitable defaults as used by :method:`ZipFile.writestr`.

Return self.
SOURCE_DATE_EPOCHNr	  Nr   i  A  )r   environr   intr  r  r   compressionr   compresslevelr   rb   endswithr   )r!   archiveepochget_times   &&  r   _for_archiveZipInfo._for_archive  s     

23!&3u:DIIK1"5$00%33==!!#&&!.D$&  "-Dr   c                &   V P                   P                  R4      '       d   R# \        P                  P                  '       dN   V P                   P                  \        P                  P
                  \        P                  P                  34      # R# )z2Return True if this archive member is a directory.r   TF)rb   r+  r   r  r   r   r   s   &r   r   ZipInfo.is_dir  sV    ==!!#&&
 77>>>==))277;;*GHHr   )r   r   r   r   r   r   r   r   r   r4   r   r   rb   r   r   r   r   r   r   )r   rb   r   r   r   r   r4   r   r   r   r   r   r   r   r   r   r   r   r   	_raw_timer   )NoNamer  r   )r
   r   r   r   r   	__slots__r"   propertyr   setterr   r   r   r  rB   r!  r/  r   r   rC   rF   s   @r   r   r     s     HI0  L # # $ $,0)dV+!Z #D # #J,
 
r   c                 ~    \        ^4       F-  pV ^,          '       d   V ^,	          R,          p K$  V ^,          p K/  	  V # )r   l    q[ )range)crcjs   & r   _gen_crcr=    s7    1X77!8z)CAIC	 
 Jr   c                    aaaaaa R oRoRo\         f#   \        \        \        \	        R4      4      4      s \         oV3R loVVVV3R loV  F  pS! V4       K  	  VV3R lpV# )ixV4igE#ixV4   c                L   < V^,	          SW,          ^,          ,          ,          # )z(Compute the CRC32 primitive on one byte.r	   )chr;  crctables   &&r   crc32_ZipDecrypter.<locals>.crc32  s    qHch$%6777r   c                    < S! V S4      oSS^,          ,           R,          oSR,          ^,           R,          oS! S^,	          S4      oR# )   r   iNr	   )crC  key0key1key2s   &r   update_keys"_ZipDecrypter.<locals>.update_keys  sE    Q~t$
2y 1$
2TRZ&r   c                   < \        4       pVP                  pV  F@  pS^,          pW4V^,          ,          ^,	          ^,          ,          pS! V4       V! V4       KB  	  \        V4      # )zDecrypt a bytes object.)	bytearrayr   bytes)r2   rc   r   rG  krJ  rK  s   &    r   	decrypter _ZipDecrypter.<locals>.decrypter  sZ    AqA!9"d**AN1I	 
 V}r   )	_crctabler   mapr=  r:  )	pwdprQ  rC  rB  rH  rI  rJ  rK  s	   &  @@@@@@r   _ZipDecrypterrW    sc    DDD XuSz23	H8' ' A 	 r   c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )LZMACompressori  c                    R V n         R # r   _compr   s   &r   r"   LZMACompressor.__init__  s	    
r   c                >   \         P                  ! R \         P                  /4      p\         P                  ! \         P                  \         P
                  ! \         P                  V4      .R7      V n        \        P                  ! R^	^\        V4      4      V,           # )r   filtersz<BBH)
lzma_encode_filter_propertiesFILTER_LZMA1rY  
FORMAT_RAW_decode_filter_propertiesr\  r)   r   rT   )r!   propss   & r   _initLZMACompressor._init  sq    ..d6G6G/HI((**4+<+<eDC
 
 {{61aU4u<<r   c                    V P                   f1   V P                  4       V P                   P                  V4      ,           # V P                   P                  V4      # r   )r\  rg  compressr!   r2   s   &&r   rj  LZMACompressor.compress  sA    ::::<$**"5"5d";;;zz""4((r   c                    V P                   f0   V P                  4       V P                   P                  4       ,           # V P                   P                  4       # r   )r\  rg  flushr   s   &r   rn  LZMACompressor.flush  s=    ::::<$**"2"2"444zz!!r   r[  N)
r
   r   r   r   r"   rg  rj  rn  r   rC   r8  s   @r   rY  rY    s     =)
" "r   rY  c                   ,   a  ] tR tRt o R tR tRtV tR# )LZMADecompressori  c                0    R V n         RV n        RV n        R # )Nr   F_decomp_unconsumedeofr   s   &r   r"   LZMADecompressor.__init__  s    r   c           
        V P                   f   V ;P                  V,          un        \        V P                  4      ^8:  d   R# \        P                  ! RV P                  R,          4      w  p\        V P                  4      ^V,           8:  d   R# \
        P                  ! \
        P                  \
        P                  ! \
        P                  V P                  ^^V,            4      .R7      V n         V P                  ^V,           R  pV =V P                   P                  V4      pV P                   P                  V n        V# )Nr   z<H:rg   r&   Nr_  )rt  ru  rT   r)   r(   ra  rq  rd  re  rc  
decompressrv  )r!   r2   psizerc   s   &&  r   ry  LZMADecompressor.decompress   s    <<$4##$)]]4)9)9#)>?FE4##$E	100..t/@/@/3/?/?!e)/LNK DL ##AIJ/D ((.<<##r   rs  N)r
   r   r   r   r"   ry  r   rC   r8  s   @r   rq  rq    s     
 r   rq  storeshrinkreduceimplodetokenizedeflate	deflate64bzip2ra  terselz77r   wavpackppmdc                 R   V \         8X  d   R# V \        8X  d   \        '       g   \        R 4      hR# V \        8X  d   \
        '       g   \        R4      hR# V \        8X  d   \        '       g   \        R4      hR# V \        8X  d   \        '       g   \        R4      hR# \        R4      h)z.Compression requires the (missing) zlib modulez-Compression requires the (missing) bz2 modulez.Compression requires the (missing) lzma modulez:Compression requires the (missing) compression.zstd modulez(That compression method is not supportedN)r   ZIP_DEFLATEDzlibRuntimeErrorr   bz2r   ra  r   r   NotImplementedError)r)  s   &r   _check_compressionr  *  s    j 		$t@B B  
		!s?A A  
	 t@B B  
	%tLN N  ""LMMr   c                    V \         8X  d_   Ve'   \        P                  ! V\        P                  R4      # \        P                  ! \        P                  \        P                  R4      # V \
        8X  d0   Ve   \        P                  ! V4      # \        P                  ! 4       # V \        8X  d   \        4       # V \        8X  d   \        P                  ! VR7      # R # )N)level)r  r  compressobjDEFLATEDZ_DEFAULT_COMPRESSIONr   r  BZ2Compressorr   rY  r   r   ZstdCompressor)r   r*  s   &&r   _get_compressorr  A  s    $$##M4==#FF : :DMM3OO	)	#$$$]33  ""	(	"	-	'""77r   c                    \        V 4       V \        8X  d   R # V \        8X  d   \        P                  ! R4      # V \
        8X  d   \        P                  ! 4       # V \        8X  d   \        4       # V \        8X  d   \        P                  ! 4       # \        P                  V 4      pV'       d   \        RW3,          4      h\        RV 3,          4      h)Nzcompression type %d (%s)zcompression type %dr  )r  r   r  r  decompressobjr   r  BZ2Decompressorr   rq  r   r   ZstdDecompressorr   r   r  )r   descrs   & r   _get_decompressorr  S  s    }%
"	,	&!!#&&	)	#""$$	(	"!!	-	'$$&& $$]3%&@MCY&YZZ%&;}>N&NOOr   c                   F   a  ] tR tRt o R tR tR	R ltR
R ltR tRt	V t
R# )_SharedFileig  c                d    Wn         W n        W0n        W@n        WPn        VP
                  V n        R # r   )_file_pos_close_lock_writingseekable)r!   filerd   closelockwritings   &&&&&&r   r"   _SharedFile.__init__h  s&    
	
r   c                    V P                   # r   )r  r   s   &r   r`   _SharedFile.tellp  s    yyr   c                   V P                   ;_uu_ 4        V P                  4       '       d   \        R 4      hV\        P                  8X  d.   V P
                  P                  V P                  V,           4       MV P
                  P                  W4       V P
                  P                  4       V n        V P                  uuRRR4       #   + '       g   i     R# ; i)z}Can't reposition in the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.N)	r  r  r   r   SEEK_CURr  rO   r  r`   )r!   ry   whences   &&&r   rO   _SharedFile.seeks  s    ZZZ}}  "J K K $

		F 23

/

)DI99 ZZZs   B)C		C	c                l   V P                   ;_uu_ 4        V P                  4       '       d   \        R 4      hV P                  P	                  V P
                  4       V P                  P                  V4      pV P                  P                  4       V n        VuuRRR4       #   + '       g   i     R# ; i)yCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.N)r  r  r   r  rO   r  rS   r`   r!   nr2   s   && r   rS   _SharedFile.read  st    ZZZ}}  "J K K JJOODII&::??1%D

)DI ZZZs   BB""B3	c                n    V P                   e'   V P                   pR V n         V P                  V4       R # R # r   )r  r  )r!   fileobjs   & r   r  _SharedFile.close  s-    ::!jjGDJKK  "r   )r  r  r  r  r  r  NrH   )r
   r   r   r   r"   r`   rO   rS   r  r   rC   r8  s   @r   r  r  g  s#     &	! !r   r  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )		_Tellablei  c                     Wn         ^ V n        R# rH   NrY   ry   r!   rY   s   &&r   r"   _Tellable.__init__  s    r   c                n    V P                   P                  V4      pV ;P                  V,          un        V# r   )rY   writery   )r!   r2   r  s   && r   r  _Tellable.write  s'    GGMM$qr   c                    V P                   # r   )ry   r   s   &r   r`   _Tellable.tell  s    {{r   c                :    V P                   P                  4        R # r   )rY   rn  r   s   &r   rn  _Tellable.flush      r   c                :    V P                   P                  4        R # r   )rY   r  r   s   &r   r  _Tellable.close  r  r   r  N)r
   r   r   r   r"   r  r`   rn  r  r   rC   r8  s   @r   r  r    s#     
 r   r  c                      a a ] tR tRt oRtRtRtRtRR ltR t	R t
RR ltRR ltR	 tRR
 ltR tR tR tR tV 3R ltR t]P,                  3R ltR tRtVtV ;t# )
ZipExtFilei  zOFile-like object for reading an archive member.
Is returned by ZipFile.open().
i   c                   Wn         W@n        WPn        VP                  V n        VP
                  V n        VP                  V n        \        V P                  4      V n
        R V n        RV n        ^ V n        RV n        W n        VP                   V n        \%        VR4      '       d#   VP&                  V n        \+        R4      V n        MRV n        R V n         VP1                  4       '       da   VP3                  4       V n        VP
                  V n        VP                  V n        V P,                  V n        V P(                  V n        RV n        RT n         T'       d   TPB                  \D        ,          '       d   TPF                  ^,	          ^,          pMTP&                  ^,	          ^,          pT PI                  4       pYv8w  d   \K        RTPL                  ,          4      hR# R#   \>         d     Li ; i)Fr   Nr   TzBad password for file %r)'_fileobj_pwd_close_fileobjr   _compress_typer   _compress_leftr   _leftr  _decompressor_eof_readbuffer_offsetnewlinesmoderb   namer_   r   _expected_crcrC  _running_crc	_seekabler  r`   _orig_compress_start_orig_compress_size_orig_file_size_orig_start_crc	_orig_crcAttributeError
_decrypterr   r   r3  _init_decrypterr  r   )r!   r  r  zipinforU  close_fileobj
check_bytehs   &&&&&&  r   r"   ZipExtFile.__init__  s   	+%33%33&&
.t/B/BC		$$	7E""!(D %c
D!%D		!!,3LLN)+2+@+@('.'8'8$'+'8'8$!%!3!3!%   #<<<%//14<
 &kkR/47
$$&A"#=@U@U#UVV  	  		s   G# ,A G# #G10G1c                    \        V P                  4      V n        V P                  P	                  ^4      pV ;P
                  ^,          un        V P                  V4      ^,          # )r  )rW  r  r  r  rS   r  )r!   r   s   & r   r  ZipExtFile._init_decrypter  sM    '		2 ##B'r!v&r**r   c                   R V P                   P                  : RV P                   P                  : 2.pV P                  '       gv   VP	                  RV P
                  : 24       V P                  \        8w  dA   VP	                  R\        P                  V P                  V P                  4      ,          4       MVP	                  R4       VP	                  R4       RP                  V4      # )r   .z name=r   	 [closed]r   r   )r   r   r   closedr   r  r  r   r   r   r>   r!   rc   s   & r   r   ZipExtFile.__repr__  s    "nn77"nn99; <{{{MM		34""j01.2243F3F373F3FHH I MM+&cwwvr   c                    V^ 8  dV   V P                   P                  RV P                  4      ^,           pV^ 8  d"   V P                   V P                  V pW n        V# \        P                  P                  W4      # )zbRead and return a line from the stream.

If limit is specified, at most limit bytes will be read.
   
)r  r   r  ioBufferedIOBasereadline)r!   limitilines   &&  r   r  ZipExtFile.readline  sj     19  %%eT\\:Q>A1u''a8   ))$66r   c                   V\        V P                  4      V P                  ,
          8  dz   V P                  V4      p\        V4      V P                  8  d-   W P                  V P                  R ,           V n        ^ V n        M"V ;P                  \        V4      ,          un        V P                  V P                  V P                  R,            # )z6Returns buffered bytes without advancing the position.Ni   )rT   r  r  rS   )r!   r  chunks   && r   peekZipExtFile.peek  s    s4##$t||33IIaLE5zDLL(#(+;+;DLLM+J#J  E
* dllS.@AAr   c                @    V P                   '       d   \        R 4      hR# )I/O operation on closed file.T)r  r   r   s   &r   readableZipExtFile.readable  s    ;;;<==r   c                   V P                   '       d   \        R4      hVe   V^ 8  d_   V P                  V P                  R pRV n        ^ V n        V P                  '       g$   W P                  V P                  4      ,          pK5  V# WP                  ,           pV\        V P                  4      8  d"   V P                  V P                  V pW0n        V# V\        V P                  4      ,
          pV P                  V P                  R pRV n        ^ V n        V^ 8  dj   V P                  '       gX   V P                  V4      pV\        V4      8  d   W@n        Wn        W$RV ,          p V# W$,          pV\        V4      ,          pKp  V# )z~Read and return up to n bytes.
If the argument is omitted, None, or negative, data is read and returned until EOF is reached.
zread from closed file.Nr   )r  r   r  r  r  _read1MAX_NrT   )r!   r  bufendr2   s   &&   r   rS   ZipExtFile.read#  sI    ;;;5669A""4<<=1C"DDLiii{{4::..J,,T%%&&""4<<4CLJ#d&&''t||}-!eDIII;;q>D3t9}#'  BQx 
 KCTNA
r   c                    V P                   f   R # \        WP                  4      V n        V P                  '       d:   V P                  V P                   8w  d   \	        RV P
                  ,          4      hR # R # )NzBad CRC-32 for file %r)r  rC  r  r  r   r  )r!   newdatas   &&r   _update_crcZipExtFile._update_crcF  s]    %!'+<+<=999**d.@.@@5		ABB A9r   c                   Ve   V^ 8  dl   V P                   V P                  R pRV n         ^ V n        V P                  '       g1   V P                  V P                  4      pV'       g   K7  W#,          p V# V# WP                  ,           pV\        V P                   4      8  d"   V P                   V P                  V pW@n        V# V\        V P                   4      ,
          pV P                   V P                  R pRV n         ^ V n        V^ 8  dc   V P                  '       gQ   V P                  V4      pV\        V4      8  d   W0n         Wn        W#RV ,          p V# V'       g   KW  W#,          p V# V# )z7Read up to n bytes with at most one read() system call.Nr   )r  r  r  r  r	  rT   )r!   r  r
  r2   r  s   &&   r   read1ZipExtFile.read1P  sD    9A""4<<=1C"DDLiii{{4::.4KCJ3J,,T%%&&""4<<4CLJ#d&&''t||}-q5iii{{1~s4y='+$#$L8OC 
 4KC
s
r   c                b   V P                   '       g   V^ 8:  d   R# V P                  \        8X  dO   V P                  P                  pV\        V4      8  d(   W P                  V\        V4      ,
          4      ,          pMV P                  V4      pV P                  \        8X  d   V P                  ^ 8*  V n         EMV P                  \        8X  d   \        WP                  4      pV P                  P                  W!4      pV P                  P                  ;'       g3    V P                  ^ 8*  ;'       d    V P                  P                  '       * V n         V P                   '       d!   W P                  P                  4       ,          pMMV P                  P                  V4      pV P                  P                  ;'       g    V P                  ^ 8*  V n         VRV P                   pV ;P                  \        V4      ,          un        V P                  ^ 8:  d   RV n         V P                  V4       V# )rH   r   NT)r  r  r  r  unconsumed_tailrT   _read2r   r  r   MIN_READ_SIZEry  rv  rn  r  r  r  s   && r   r  ZipExtFile._read1u  s    999Q ,.%%55D3t9}AD	M22;;q>D*,++q0DI  L0A))*A%%009D++// @ @,,1 @ @!//??? I yyy**0022%%006D**..JJ$2E2E2JDIKTZZ 

c$i
::?DIr   c                T   V P                   ^ 8:  d   R# \        WP                  4      p\        WP                   4      pV P                  P                  V4      pV ;P                   \        V4      ,          un         V'       g   \        hV P                  e   V P                  V4      pV# )rH   r   )	r  r   r  minr  rS   rT   EOFErrorr  r  s   && r   r  ZipExtFile._read2  s    !#%%&&&'}}!!!$s4y(N??&??4(Dr   c                   <  V P                   '       d   V P                  P                  4        \        SV `	  4        R #   \        ST `	  4        i ; ir   )r  r  r  r   )r!   r   s   &r   r  ZipExtFile.close  s7    	"""##%GMOEGMOs   ? ? Ac                T    V P                   '       d   \        R 4      hV P                  # r  )r  r   r  r   s   &r   r  ZipExtFile.seekable  s!    ;;;<==~~r   c                    V P                   '       d   \        R 4      hV P                  '       g   \        P                  ! R4      hV P                  4       pV\        P                  8X  d   TpMRV\        P                  8X  d
   W1,           pM4V\        P                  8X  d   V P                  V,           pM\        R4      hW@P                  8  d   V P                  pV^ 8  d   ^ pWC,
          pWPP                  ,           pV^ 8  d%   V\        V P                  4      8  d   W`n        ^ pEMV P                  \        8X  d   V P                   f   V^ 8w  d   RV n        V\        V P                  4      V P                  ,
          ,          pV P$                  P'                  V\        P                  4       V ;P(                  V,          un        V ;P*                  V,          un        V P(                  ^ 8*  V n        ^ pRV n        ^ V n        MV^ 8  d   V P$                  P'                  V P.                  4       V P0                  V n        V P4                  V n        V P6                  V n        V P                  V n        RV n        ^ V n        \9        V P                  4      V n        RV n        TpV P                   e   V P=                  4        V^ 8  d2   \?        V P@                  V4      pV PC                  V4       WW,          pK8  V P                  4       # )zseek on closed file.!underlying stream is not seekablezCwhence must be os.SEEK_SET (0), os.SEEK_CUR (1), or os.SEEK_END (2)Nr   F)"r  r   r  r  UnsupportedOperationr`   r   SEEK_SETr  SEEK_ENDr  r  rT   r  r  r   r  r  r  rO   r  r  r  r  r  r  r  r  r  r  r  r  MAX_SEEK_READrS   )r!   ry   r  curr_posnew_posread_offsetbuff_offsetread_lens   &&&     r   rO   ZipExtFile.seek  s`   ;;;344~~~))*MNN99;R[[ Gr{{"'Gr{{"**V3G C D D )))**GQ;G(!LL0!c$2B2B.C C&LK  J.4??3J{^_O_!%D3t//04<<??KMM{BKK8JJ+%J;.

aDIK"DDL1_MMt889 $ 4 4D!%D"&":":D--DJ"DDL!243F3F!GDDI!K*$$&Ao4--{;HIIh#Kyy{r   c                    V P                   '       d   \        R 4      hV P                  '       g   \        P                  ! R4      hV P
                  V P                  ,
          \        V P                  4      ,
          V P                  ,           pV# )ztell on closed file.r#  )
r  r   r  r  r$  r  r  rT   r  r  )r!   fileposs   & r   r`   ZipExtFile.tell  sd    ;;;344~~~))*MNN&&3c$:J:J6KKdllZr   )r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  i   @i   )NFr  r  )r
   r   r   r   r   r	  r  r'  r"   r  r   r  r  r  rS   r  r  r  r  r  r  r   r%  rO   r`   r   rC   rD   rE   s   @@r   r  r    s     
 E M M1Wh	+7 B
!FC#J"H 
 #%++ ?B r   r  c                   t   a a ] tR tRt oR t]R 4       t]R 4       t]R 4       tR t	R t
V 3R ltR	tVtV ;t# )
_ZipWriteFilei  c                    W n         W0n        Wn        \        VP                  VP
                  4      V n        ^ V n        ^ V n        ^ V n	        R# r  )
_zinfo_zip64_zipfiler  r   r   _compressor
_file_size_compress_size_crc)r!   zfr   r   s   &&&&r   r"   _ZipWriteFile.__init__   sF    *5+>+>+0+?+?A	r   c                .    V P                   P                  # r   )r7  rY   r   s   &r   r  _ZipWriteFile._fileobj
  s    }}r   c                .    V P                   P                  # r   )r5  rb   r   s   &r   r  _ZipWriteFile.name  s    {{###r   c                    R # )wbr	   r   s   &r   r  _ZipWriteFile.mode  s    r   c                    R # )Tr	   r   s   &r   writable_ZipWriteFile.writable  s    r   c                   V P                   '       d   \        R 4      h\        V\        \        34      '       d   \        V4      pM\        V4      pVP                  pV ;P                  V,          un        \        WP                  4      V n
        V P                  '       d>   V P                  P                  V4      pV ;P                  \        V4      ,          un        V P                  P                  V4       V# r   )r  r   r  rO  rN  rT   r1   nbytesr9  rC  r;  r8  rj  r:  r  r  )r!   r2   rI  s   && r   r  _ZipWriteFile.write  s    ;;;<== dUI.//YFd#D[[F6!$		*	##,,T2D3t9,D!r   c           	       < V P                   '       d   R #  \        SV `	  4        V P                  '       dt   V P                  P	                  4       pV ;P
                  \        V4      ,          un        V P                  P                  V4       V P
                  V P                  n
        MV P                  V P                  n
        V P                  V P                  n        V P                  V P                  n        V P                  '       gA   V P                  \         8  d   \#        R4      hV P
                  \         8  d   \#        R4      hV P                  P$                  \&        ,          '       d   V P                  '       d   RMRpV P                  P                  \(        P*                  ! V\,        V P                  P                  V P                  P                  V P                  P                  4      4       V P                  P/                  4       V P0                  n        MV P                  P/                  4       V P0                  n        V P                  P5                  V P                  P6                  4       V P                  P                  V P                  P9                  V P                  4      4       V P                  P5                  V P0                  P2                  4       V P0                  P:                  P=                  V P                  4       V P                  V P0                  P>                  V P                  P@                  &   RV P0                  n!        R #   RT P0                  n!        i ; i)Nz*File size too large, try using force_zip64z0Compressed size too large, try using force_zip64z<LLQQz<LLLLF)"r  r   r  r8  rn  r:  rT   r  r  r5  r   r9  r;  r   r   r6  r   r  r   r   r)   r   _DD_SIGNATUREr`   r7  	start_dirrO   r   r   filelistr   
NameToInforb   r  )r!   r
  r   r   s   &  r   r  _ZipWriteFile.close,  s7   ;;;(	+GMO&&,,.##s3x/###C(,0,?,?),0OO)"iiDKKO$(OODKK!;;;??[0&'STT&&4&'YZZ {{$$'@@@!%g'##FKK]DKKOOKK--t{{/D/D%F G*.--*<*<*>' +/--*<*<*>'""4;;#<#<=##DKK$:$:4;;$GH""4==#:#:; MM""))$++6=A[[DMM$$T[[%9%9:%*DMM"UDMM"s    C5M% A&M% 4M% GM% %M8)r:  r8  r;  r9  r5  r6  r7  )r
   r   r   r   r"   r6  r  r  r  rF  r  r  r   rC   rD   rE   s   @@r   r3  r3    sZ          $ $  &++ ++r   r3  c                   J  a  ] tR tRt o RtRtRtR]RR3RRRR/R lltR	 t	R
 t
R tR tR tR tR'R ltR tR tR t]R 4       t]P*                  R 4       tR'R ltR(RR/R lltR)R ltR*R ltR+R lt]R 4       tR tR tR+R ltR*R  lt R,R! lt!R" t"R# t#R$ t$R% t%R&t&V t'R# )-r   i[  a  Class with methods to open, read, write, close, list zip files.

z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=True,
            compresslevel=None)

file: Either the path to the file, or a file-like object.
      If it is a path, the file will be opened and closed by ZipFile.
mode: The mode can be either read 'r', write 'w', exclusive create 'x',
      or append 'a'.
compression: ZIP_STORED (no compression), ZIP_DEFLATED (requires zlib),
             ZIP_BZIP2 (requires bz2), ZIP_LZMA (requires lzma), or
             ZIP_ZSTANDARD (requires compression.zstd).
allowZip64: if True ZipFile will create files with ZIP64 extensions when
            needed, otherwise it will raise an exception when this would
            be necessary.
compresslevel: None (default for the given compression type) or an integer
               specifying the level to pass to the compressor.
               When using ZIP_STORED or ZIP_LZMA this keyword has no effect.
               When using ZIP_DEFLATED integers 0 through 9 are accepted.
               When using ZIP_BZIP2 integers 1 through 9 are accepted.
               When using ZIP_ZSTANDARD integers -7 though 22 are common,
               see the CompressionParameter enum in compression.zstd for
               details.

NrTr  metadata_encodingc               L   VR9  d   \        R4      h\        V4       W@n        RV n        ^ V n        / V n        . V n        W0n        WPn        W n	        RV n
        RV n        W`n        Wpn        V P                  '       d   VR8w  d   \        R	4      h\        V\        P                   4      '       d   \        P"                  ! V4      p\        V\$        4      '       dD   ^ V n        Wn        RR
RRRRRRRRRRRR/pW,          p	  \*        P,                  ! W4      V n        M^V n        Wn        \3        VRR4      V n        ^V n        \6        P8                  ! 4       V n        RV n        RV n         VR8X  d   V PA                  4        R# VR9   dP   RV n         V P.                  PC                  4       V n"         V P.                  PG                  V PD                  4       R# VR8X  d9    V PA                  4        V P.                  PG                  V PD                  4       R# \        R4      h  \0         d    Y9   d   Y,          p	 EKC  h i ; i  \H        \0        3 d    RT n         R# i ; i  \H        \0        3 d-    \K        T P.                  4      T n        ^ T n"        RT n         R# i ; i  \L         dG    T P.                  PG                  ^ ^4       RT n        T P.                  PC                  4       T n"         R# i ; i   T P.                  p
RT n        T PO                  T
4       h ; i)zUOpen the ZIP file with mode read 'r', write 'w', exclusive create 'x',
or append 'a'.rR  wxaz+ZipFile requires mode 'r', 'w', 'x', or 'a'FNr   z5metadata_encoding is only supported for reading filesr^   zw+bzx+bzr+brC  xbTr  z"Mode must be 'r', 'w', 'x', or 'a')rR  rU  rV  rW  )rU  rV  )(r   r  _allowZip64
_didModifyrn   rO  rN  r)  r*  r  rU  _comment_strict_timestampsrS  r  r   r  r  str_filePassedrb   r  ra   rY   rX   getattr_fileRefCnt	threadingRLockr  r  r  _RealGetContentsr`   rM  rO   r  r  r   _fpclose)r!   r  r  r)  
allowZip64r*  r  rS  modeDictr   rY   s   &&&&&&$$   r   r"   ZipFile.__init__y  s    ++JKK;'%
&*	"3!2 !!!dckGI I dBKK((99T?DdC   D MdCUC%ueT5$@H~H ggd5DG  DG#D&$7DM__&
'	s{%%'# #'/%)WW\\^DN/T^^4 4))+GGLL0 !!EFFc  +#+#5 	@ +G4 /)./ '0 +'0DG%&DN%*DN+  " 4GGLLA& '+DO%)WW\\^DN4	BDGMM"s   H' .K< K< I( 6%I	 K< %5J( K< 'II	I%!K< $I%%K< (9J%!K< $J%%K< (AK95K< 8K99K< <'L#c                    V # r   r	   r   s   &r   	__enter__ZipFile.__enter__  s    r   c                &    V P                  4        R # r   r  )r!   typer   	tracebacks   &&&&r   __exit__ZipFile.__exit__  s    

r   c                   R V P                   P                  : RV P                   P                  : 2.pV P                  e   V P                  '       d$   VP                  RV P                  ,          4       M0V P                  e#   VP                  RV P                  ,          4       VP                  RV P                  ,          4       MVP                  R4       VP                  R4       RP                  V4      # )r   r  z file=%rz filename=%rz mode=%rr  r   r   )	r   r   r   rY   r^  r   rb   r  r>   r  s   & r   r   ZipFile.__repr__  s    "nn77"nn99; <77j47723*nt}}<=MM*tyy01MM+&cwwvr   c                   V P                   p \        V4      pT'       g   \        R4      hT P                  ^8  d   \        T4       T\        ,          T n        \        Y P                  4      w  r4Y4,           T n	        T P                  ^ 8  d   \        R4      hTP                  T P                  ^ 4       T\        ,          pTP                  T4      p\        P                  ! T4      p^ pYu8  Ed   TP                  \        4      p\!        T4      \        8w  d   \        R4      h\"        P$                  ! \&        T4      pT\(        ,          \*        8w  d   \        R4      hT P                  ^8  d   \        T4       TP                  T\,        ,          4      p	\/        T	4      p
T\0        ,          pT\2        ,          '       d   T	P5                  R4      p	M%T	P5                  T P6                  ;'       g    R4      p	\9        T	4      pTP                  T\:        ,          4      Tn        TP                  T\>        ,          4      Tn         T\B        ,          Tn"        TR,          w  Tn#        Tn$        Tn%        Tn&        Tn'        Tn(        rTn)        Tn*        Tn+        TPJ                  \X        8  d$   \[        RTPJ                  ^
,          ,          4      hTR	,          w  Tn.        Tn/        Tn0        Yn1        T^	,	          R
,           T^,	          ^,          T^,          T^,	          T^,	          ^?,          T^,          ^,          3Tn2        TPg                  T
4       TPD                  T,           Tn"        T Ph                  Pk                  T4       YPl                  TPn                  &   T\        ,           T\,        ,          ,           T\:        ,          ,           T\>        ,          ,           pT P                  ^8  g   EK  \        RT4       EK   T P                  p\q        \s        T Ph                  R R7      4       F  pTTn:        TPD                  pK  	  R#   \         d    \        R4      hi ; i)z/Read in the table of contents for the ZIP file.zFile is not a zip filez Bad offset for central directoryzTruncated central directoryz&Bad magic number for central directoryr   cp437:r  r  Nzzip file version %.1f:      Nr   totalc                     V P                   # r   )r   )r   s   &r   <lambda>*ZipFile._RealGetContents.<locals>.<lambda>7  s
    u7J7Jr   )keyN);rY   rI   rX   r   rn   rm   _ECD_COMMENTr[  rQ   rM  rO   rK   rS   r  BytesIOrR   rT   r)   r(   rU   rV   rW   _CD_FILENAME_LENGTHrC  _CD_FLAG_BITSr   r   rS  r   _CD_EXTRA_FIELD_LENGTHr4   _CD_COMMENT_LENGTHr   _CD_LOCAL_HEADER_OFFSETr   r   r   r   r   r   r   r   r   r   MAX_EXTRACT_VERSIONr  r   r   r   r3  r   r  rN  r   rO  rb   reversedsortedr   )r!   rY   rZ   rp   rq   ro   r2   rw  r[   rb   orig_filename_crcflagsrV  td
end_offsetr   s   &                r   rc  ZipFile._RealGetContents  sq   WW	7 _F 566::>&M|,26::F	 #+>>A?@@
"#wwwZZoggn-G7|~- !>??mm$4g>G}%)99 !IJJzzA~gwww':;<H %hM*E)))#??73 $??4+A+A+L+LWM!Aggg&<=>AG(: ;<AI%&=>AO 5<DM2Qq0A1:[!/1UAOQ[  #66)*A+,+<+<r+A+C D D9@6AHaoqKT4K!Q$QtVrEAqD$;41?AKNN,-oo6AOMM  #*+OOAJJ' ^+g6I.JJ567123E zzA~gu%^^
fT]])JL ME *E,,JMI  	7566	7s   Q Q,c                V    V P                    Uu. uF  qP                  NK  	  up# u upi )z+Return a list of file names in the archive.)rN  rb   rk  s   & r   namelistZipFile.namelist;  s     *.--8-$-888s   &c                    V P                   # )zBReturn a list of class ZipInfo instances for files in the
archive.)rN  r   s   &r   infolistZipFile.infolist?       }}r   c                    \        R:R RR:R RR:R 2VR7       V P                   FG  pR	VP                  R
,          ,          p\        RVP                  W2P                  3,          VR7       KI  	  R# )z+Print a table of contents for the zip file.z	File Name46 zModified    z>19Sizez>12r  z%d-%02d-%02d %02d:%02d:%02dr%  z%-46s %s %12dN)rm   rN  r   rb   r   )r!   r  r   dates   &&  r   printdirZipFile.printdirD  sV    ;G	]]E05??23FFD/U^^T??$KK #r   c                &   RpV P                    FK  p V P                  VP                  R4      ;_uu_ 4       pVP                  V4      '       d   K   RRR4       KM  	  R#   + '       g   i     Kb  ; i  \         d    TP                  u u # i ; i)zRead all the files and check the CRC.

Return None if all files could be read successfully, or the name
of the offending file otherwise.rR  Ni   )rN  ra   rb   rS   r   )r!   
chunk_sizer   fs   &   r   testzipZipFile.testzipM  sz    
 
]]E& YYu~~s33q&&,, - 43	 # 433  &~~%&s4   $A4A A A4 A1+A41A44BBc                h    V P                   P                  V4      pVf   \        RV,          4      hV# )z,Return the instance of ZipInfo given 'name'.z(There is no item named %r in the archive)rO  r   KeyError)r!   r  infos   && r   getinfoZipFile.getinfo]  s9    ""4(<:TAC C r   c                    V'       d<   \        V\        4      '       g&   \        R\        V4      P                  ,          4      hV'       d	   Wn        R# RV n        R# )z)Set default password for encrypted files.pwd: expected bytes, got %sN)r  rO  	TypeErrorrm  r
   rU  )r!   rU  s   &&r   setpasswordZipFile.setpasswordf  s;    z#u--9DI<N<NNOOHDHr   c                    V P                   # )z.The comment text associated with the ZIP file.)r[  r   s   &r   r   ZipFile.commento  r  r   c                   \        V\        4      '       g&   \        R \        V4      P                  ,          4      h\        V4      \        8  d,   ^ RIpVP                  R\        ,          ^R7       VR\         pWn	        RV n
        R# )zcomment: expected bytes, got %sNz3Archive comment is too long; truncating to %d bytesr   T)r  rO  r  rm  r
   rT   r   r   r   r[  rZ  )r!   r   r   s   && r   r   r  t  sq    '5))=W@V@VVWWw</)MMO+,89  ;./Gr   c                    V P                  VRV4      ;_uu_ 4       pVP                  4       uuRRR4       #   + '       g   i     R# ; i)zMReturn file bytes for name. 'pwd' is the password to decrypt
encrypted files.rR  N)ra   rS   )r!   r  rU  rY   s   &&& r   rS   ZipFile.read  s1     YYtS#&&"779 '&&&s	   7A	force_zip64Fc               |  a  VR9  d   \        R4      hV'       d   VR8X  d   \        R4      hS P                  '       g   \        R4      h\        V\        4      '       d   TpMFVR8X  d/   \        V4      pS P                  Vn        S P                  Vn        MS P                  V4      pVR8X  d   S P                  WTR7      # S P                  '       d   \        R4      hS ;P                  ^,          un        \        S P                  VP                  S P                  S P                  V 3R l4      p VP!                  \"        4      p\%        V4      \"        8w  d   \'        R4      h\(        P*                  ! \,        V4      pV\.        ,          \0        8w  d   \'        R	4      hVP!                  V\2        ,          4      pV\4        ,          '       d   VP7                  V\4        ,          ^R
7       VP8                  \:        ,          '       d   \=        R4      hVP8                  \>        ,          '       d   \=        R4      hV\@        ,          \B        ,          '       d   VPE                  R4      p	M%TPE                  S PF                  ;'       g    R4      p	WPH                  8w  d   \'        RVPH                  : RV: R24      hVPJ                  e   VPM                  4       VPN                  ,           VPJ                  8  d   VPJ                  VP                  8X  dJ   ^ RI(p
V
PS                  RVPH                  : R2\T        PV                  PY                  \Z        4      3R7       M\'        RVPH                  : R24      hVP8                  \\        ,          pV'       ds   V'       g   S P^                  pV'       d<   \        V\`        4      '       g&   \c        R\e        V4      Pf                  ,          4      hV'       g   \i        RV,          4      hMRp\k        WbR,           WSR4      #    TPm                  4        h ; i)a%  Return file-like object for 'name'.

name is a string for the file name within the ZIP file, or a ZipInfo
object.

mode should be 'r' to read a file already in the ZIP file, or 'w' to
write to a file newly added to the archive.

pwd is the password to decrypt files (only used for reading).

When writing, if the file size is not known in advance but may exceed
2 GiB, pass force_zip64 to use the ZIP64 format, which can handle large
files.  If the size is known in advance, it is best to pass a ZipInfo
instance for name, with zinfo.file_size set.
rU  zopen() requires mode "r" or "w"z'pwd is only supported for reading filesz2Attempt to use ZIP archive that was already closed)r  r  c                     < S P                   # r   )r  r   s   r   ry  ZipFile.open.<locals>.<lambda>  s	    $--r   zTruncated file headerz Bad magic number for file header)r  z$compressed patched data (flag bit 5)zstrong encryption (flag bit 6)r   rt  zFile name in directory z and header z differ.NzOverlapped entries: z (possible zip bomb))skip_file_prefixesr  z6File %r is encrypted, password required for extractionbT>   rR  rU  )7r   rY   r  r   r)  r   r*  r   r  _open_to_writer  r`  r  r   rd  r  rS   sizeFileHeaderrT   r   r)   r(   r   _FH_SIGNATUREr   _FH_FILENAME_LENGTH_FH_EXTRA_FIELD_LENGTHrO   r   _MASK_COMPRESSED_PATCHr  _MASK_STRONG_ENCRYPTION_FH_GENERAL_PURPOSE_FLAG_BITSr   r   rS  r   r   r`   r   r   r   r   r  dirname__file___MASK_ENCRYPTEDrU  rO  r  rm  r
   r  r  r  )r!   r  r  rU  r  r   zef_filefheaderfname	fname_strr   is_encrypteds   f&&&$       r   ra   ZipFile.open  s~     z!>??DCKFGGwwwDF F dG$$ES[DME"&"2"2E#'#5#5E  LL&E3;&&u&FF=== F G G
 	Atww(;(;#}}djj:OQ=	mmN3G7|~- !899mm$4g>G}%)99 !CDDMM'*=">?E-..g&<=aH!777)*PQQ!888)*JKK458JJJ!LL1	!LL)?)?)J)J7K	/// **E34 4 !!-%"5"558I8II$$(;(;;#MM.u/B/B.E F. /,.GGOOH,E+G " I
 %.u/B/B.E F. /0 0
 !??_<L((Cz#u55#$ADIDVDV$VWW& (ACG(H I I  hs
EEE	NNsE   5BP( :P( 'P( 7(P(  /P( DP(  P( (P( <AP( ?(P( (P;c                   V'       d   V P                   '       g   \        R 4      hV P                  '       d   \        R4      h^ Vn        ^ Vn        ^ Vn        VP                  \        8X  d   V;P
                  \        ,          un        V P                  '       g   V;P
                  \        ,          un        VP                  '       g   RVn        T;'       g    VP                  R,          \        8  pV P                   '       g   V'       d   \        R4      hV P                  '       d&   V P                  P!                  V P"                  4       V P                  P%                  4       Vn        V P)                  V4       RV n        V P                  P-                  VP/                  V4      4       RV n        \1        WV4      # )zHforce_zip64 is True, but allowZip64 was False when opening the ZIP file.zzCan't write to the ZIP file while there is another write handle open on it. Close the first handle before opening another.g?z'Filesize would require ZIP64 extensionsTr&  )rY  r   r  r   r   r   r   r   _MASK_COMPRESS_OPTION_1r  r   r   r   r   r   rY   rO   rM  r`   r   _writecheckrZ  r  r   r3  )r!   r   r  r   s   &&& r   r  ZipFile._open_to_write  sM   t///   === N O O
  	(*OO66O~~~OO88O""""-E EE$ 6 DEHII>>>GGLL("ggllne&&u-.T%00r   c                    Vf   \         P                  ! 4       pM\         P                  ! V4      pV P                  WV4      # )a8  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 ZipInfo object. You can
specify a different directory using 'path'. You can specify the
password to decrypt the file using 'pwd'.
)r   getcwdr  _extract_member)r!   memberr  rU  s   &&&&r   extractZipFile.extract   s4     <99;D99T?D##F#66r   c                    Vf   V P                  4       pVf   \        P                  ! 4       pM\        P                  ! V4      pV F  pV P	                  WAV4       K  	  R# )a  Extract all members from the archive to the current working
directory. 'path' specifies a different directory to extract to.
'members' is optional and must be a subset of the list returned
by namelist(). You can specify the password to decrypt all files
using 'pwd'.
N)r  r   r  r  r  )r!   r  membersrU  r  s   &&&& r   
extractallZipFile.extractall.  sK     ?mmoG<99;D99T?DG  4 r   c                   V P                   pV'       g/   Rp\        P                  VR\        V4      ,          4      pW0n         VP	                  V4      pR VP                  V4       4       pVP                  R V 4       4      pV# )z;Replace bad characters and remove trailing dots from parts.z:<>|"?*_c              3   B   "   T F  qP                  R 4      x  K  	  R# 5i)z .N)rstripr9   rV  s   & r   r<   1ZipFile._sanitize_windows_name.<locals>.<genexpr>J  s     B+Aa88D>>+As   c              3   8   "   T F  q'       g   K  Vx  K  	  R # 5ir   r	   r  s   & r   r<   r  L  s     7'QQqq's   	
)!_windows_illegal_name_trans_tabler]  	maketransrT   	translater5   r>   )r   r  pathseptableillegals   &&&  r   _sanitize_windows_nameZipFile._sanitize_windows_name@  sr     55GMM'3W+=>E491##E*B7==+AB,,7'77r   c           	     *  a \        V\        4      '       g   V P                  V4      pVP                  P	                  R\
        P                  P                  4      p\
        P                  P                  '       dC   VP	                  \
        P                  P                  \
        P                  P                  4      p\
        P                  P                  V4      ^,          pR\
        P                  P                  \
        P                  P                  3o\
        P                  P                  P                  V3R lVP                  \
        P                  P                  4       4       4      p\
        P                  P                  R8X  d+   V P                  V\
        P                  P                  4      pV'       g"   VP                  4       '       g   \!        R4      h\
        P                  P                  W$4      p\
        P                  P#                  V4      p\
        P                  P%                  V4      pV'       d>   \
        P                  P'                  V4      '       g   \
        P(                  ! VRR7       VP                  4       '       dA   \
        P                  P+                  V4      '       g    \
        P,                  ! V4       V# V# V P1                  WR7      ;_uu_ 4       p\1        VR	4      ;_uu_ 4       p\2        P4                  ! Wg4       R
R
R
4       R
R
R
4       V#   \.         d+    \
        P                  P+                  T4      '       g   h  T# i ; i  + '       g   i     LR; i  + '       g   i     T# ; i)zOExtract the ZipInfo object 'member' to a physical
file on the path targetpath.
r   r   c              3   :   <"   T F  pVS9  g   K  Vx  K  	  R # 5ir   r	   )r9   rV  invalid_path_partss   & r   r<   *ZipFile._extract_member.<locals>.<genexpr>`  s$      #C.H&'/A&A $%1.Hs   	
\zEmpty filename.T)exist_ok)rU  rC  N)r  r   r  rb   r   r   r  r   r   r  curdirpardirr>   r5   r  r   r   r  r  existsmakedirsr   mkdirFileExistsErrorra   shutilcopyfileobj)	r!   r  
targetpathrU  r  	upperdirssourcetargetr  s	   &&&&    @r   r  ZipFile._extract_memberO  sG    &'**\\&)F //))#rww{{;77>>>oobggnnbggkkBG ''$$W-a0 "''.."''..A''++"" #CgmmBGGKK.H #C C77;;$11'277;;GGv}}.//WW\\*6
WW%%j1
 GGOOJ/	RWW^^I66KK	D1==??77==,,HHZ( :YYvY''6*d##vv. $ (  ' 77==44 5 $# (' s<   L6 8NM.	$N6/M+&M+*M+.M>9NN	c                (   VP                   V P                  9   d)   ^ RIpVP                  RVP                   ,          ^R7       V P                  R
9  d   \        R4      hV P                  '       g   \        R4      h\        VP                  4       V P                  '       go   Rp\        V P                  4      \        8  d   RpM/VP                  \        8  d   RpMVP                  \        8  d   RpV'       d   \!        VR	,           4      hR# R# )z6Check for errors before writing a file to the archive.NzDuplicate name: %rr   z&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closedFiles countFilesizezZipfile size would require ZIP64 extensionsrU  rV  rW  )rb   rO  r   r   r  r   rY   r  r   rY  rT   rN  ZIP_FILECOUNT_LIMITr   r   r   r   )r!   r   r   requires_zip64s   &&  r   r  ZipFile._writecheck  s    >>T__,MM.?AMN99O+EFFwwwFH H5../!N4==!%88!.;.!+$${2!/">#D$E F F   r   c           	        V P                   '       g   \        R4      hV P                  '       d   \        R4      h\        P	                  WV P
                  R7      pVP                  4       '       d"   ^ Vn        ^ Vn        V P                  V4       R# Ve   W5n
        MV P                  Vn
        Ve   WEn        MV P                  Vn        \        VR4      ;_uu_ 4       q`P                  VR4      ;_uu_ 4       p\        P                   ! WgR4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)zDPut the bytes from filename into the archive under the name
arcname.7Attempt to write to ZIP archive that was already closedz>Can't write to ZIP archive while an open writing handle exists)r  Nr^   rU  i    )rY   r   r  r   r!  r\  r   r   r   r  r   r)  r   r*  ra   r  r  )r!   rb   r  r   r*  r   srcdests   &&&&&   r   r  ZipFile.write  s    wwwIK K===P  !!(484K4K " M <<>>"#EEIJJu(&3#&*&6&6#('4$'+'9'9$h%%iis.C.Ct""3f5 /D%%.C.C%%%s$   D69D#	D6#D3.D66E	c           	     h   \        V\        4      '       d   VP                  R4      p\        V\        4      '       d   TpM\        V4      P	                  V 4      pV P
                  '       g   \        R4      hV P                  '       d   \        R4      hVe   W5n        Ve   WEn	        \        V4      Vn        V P                  ;_uu_ 4        V P                  VRR7      ;_uu_ 4       pVP                  V4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)zWrite a file into the archive.  The contents is 'data', which
may be either a 'str' or a 'bytes' instance; if it is a 'str',
it is encoded as UTF-8 first.
'zinfo_or_arcname' is either a ZipInfo instance or
the name of the file in the archive.r   r  z?Can't write to ZIP archive while an open writing handle exists.NrU  )r  )r  r]  r   r   r/  rY   r   r  r   r   rT   r   r  ra   r  )r!   zinfo_or_arcnamer2   r   r*  r   r  s   &&&&&  r   writestrZipFile.writestr  s     dC  ;;w'D&00$E,-::4@EwwwIK K===Q  $"/$#0 d)ZZZ5s++t

4  , Z++ ZZs$   D )D	;D DD  D1	c                F   \        V\        4      '       d%   TpVP                  4       '       g   \        R4      hM\        V\        4      '       dy   TpVP                  R4      '       g
   VR,          p\        V4      p^ Vn        ^ Vn        RV,          R,          ^,          Vn        ^ Vn	        V;P                  ^,          un        M\        R4      hV P                  ;_uu_ 4        V P                  '       d&   V P                  P                  V P                  4       V P                  P!                  4       Vn        VP$                  \&        8X  d   V;P(                  \*        ,          un        V P-                  V4       RV n        V P0                  P3                  V4       W0P4                  VP6                  &   V P                  P9                  VP;                  R4      4       V P                  P!                  4       V n        RRR4       R#   + '       g   i     R# ; i)	z+Creates a directory inside the zip archive.z/The given ZipInfo does not describe a directoryr   i @  r   zExpected type str or ZipInfoTFN)r  r   r   r   r]  r+  r   r   r   r   r  r  r  rY   rO   rM  r`   r   r   r   r   r  r  rZ  rN  r   rO  rb   r  r   )r!   zinfo_or_directory_namer  r   directory_names   &&&  r   r  ZipFile.mkdir  sv   -w77+E<<>> !RSS "/554N!**3//#%N+E"#EEI$+dNf#<"CEEO4':;;ZZZ~~~T^^,"&'',,.E""h.#::U#"DOMM  '.3OOENN+GGMM%**512!WW\\^DN ZZZs   (DHH 	c                &    V P                  4        R# )z2Call the "close()" method in case the user forgot.Nrl  r   s   &r   __del__ZipFile.__del__  s    

r   c                0   V P                   f   R# V P                  '       d   \        R4      h V P                  R9   dw   V P                  '       de   V P
                  ;_uu_ 4        V P                  '       d&   V P                   P                  V P                  4       V P                  4        RRR4       V P                   pRV n         V P                  V4       R#   + '       g   i     L6; i  T P                   pRT n         T P                  T4       i ; i)zGClose the file, and for mode 'w', 'x' and 'a' write the ending
records.NzvCan't close the ZIP file while there is an open writing handle on it. Close the writing handle before closing the zip.r  )rY   r  r   r  rZ  r  r  rO   rM  _write_end_recordrd  r  s   & r   r  ZipFile.close   s     77?=== P Q Q		yyO+ZZZ~~~T^^4**,  
 BDGMM"  Z
 BDGMM"s*   "C/ C/ &AC.C/ C,	'C/ /&Dc                   V P                    EFm  pVP                  pV^ ,          R,
          ^	,          V^,          ^,          ,          V^,          ,          pV^,          ^,          V^,          ^,          ,          V^,          ^,          ,          p. pVP                  \        8  g   VP                  \        8  d<   VP                  VP                  4       VP                  VP                  4       RpRpMVP                  pVP                  pVP                  \        8  d   VP                  VP                  4       RpMVP                  pVP                  p	^ p
V'       de   \        P                  V	R4      p	\        P                  ! RR\        V4      ,          ,           ^^\        V4      ,          .VO5!  V	,           p	\        p
VP                  \        8X  d   \!        \"        V
4      p
MKVP                  \$        8X  d   \!        \&        V
4      p
M%VP                  \(        8X  d   \!        \*        V
4      p
\!        WP,                  4      p\!        WP.                  4      pVP1                  4       w  r\        P                  ! \2        \4        VVP6                  WP8                  WP                  WCVP:                  Wv\        V4      \        V	4      \        VP<                  4      ^ VP>                  VP@                  V4      pV PB                  PE                  V4       V PB                  PE                  V4       V PB                  PE                  V	4       V PB                  PE                  VP<                  4       EKp  	  V PB                  PG                  4       p\        V P                   4      pVV PH                  ,
          pV PH                  pRpV\J        8  d   RpMV\        8  d   RpMV\        8  d   RpV'       d   V PL                  '       g   \O        VR	,           4      h\        P                  ! \P        \R        ^,^-^-^ ^ VVVV4      pV PB                  PE                  V4       \        P                  ! \T        \V        ^ V^4      pV PB                  PE                  V4       \Y        VR
4      p\Y        VR4      p\Y        VR4      p\        P                  ! \Z        \\        ^ ^ VVVV\        V P^                  4      4	      pV PB                  PE                  V4       V PB                  PE                  V P^                  4       V P`                  R8X  d   V PB                  Pc                  4        V PB                  Pe                  4        R# )rH   r   r   r   QNr  zCentral directory offsetzCentral directory sizer  r   rW  r1  )3rN  r   r   r   r   r   r   r4   r   r?   r)   r   rT   r   r   r   r   r   r   r   r   r   r   r   r   rU   rW   r   r   r   r   r   r   rY   r  r`   rM  r  rY  r   rv   rj   rt   ru   r  r   r   r[  r  truncatern  )r!   r   r   r   r   r4   r   r   r   
extra_datar   r   r   rb   r   r[   pos2centDirCountcentDirSizecentDirOffsetr  zip64endreczip64locrecrZ   s   &                       r   r  ZipFile._write_end_record  s   ]]EB!ut|)BqEQJ6A>GerkBqEQJ."Q%1*=GE,%%3U__-U001&	 *!OO	 % 3 3""[0U001 * % 3 3JK#\\*d;
#[[CE
N*qU|-&+-/9:
 ,""i/!-=$$0!,<$$5!"3[A!+/D/DEO .B.BCN"'"<"<">Hkk"2"2N"'"5"5"+-@-@'"'))]"%h-Z#emmBT"#U%8%8%:M:M"/1G GGMM'"GGMM(#GGMM*%GGMM%--(k #n ww||~4==)T^^+--*N[(7N;&5N###">#D$E F F ++"$6BAq,],K GGMM+& ++))1dA7K GGMM+&|V4Lk:6Kz:M-/?<(-T]]9KM 	fdmm$99GGr   c                    V ;P                   ^,          un         V P                   '       g'   V P                  '       g   VP                  4        R# R# R# )r  N)r`  r^  r  r  s   &&r   rd  ZipFile._fpclosev  s;    A(8(8(8HHJ )9r   )rO  rY  r[  rZ  r^  r`  r  r  r\  r  r)  r*  rn   rN  rb   rY   rS  r  rU  rM  r   )rR  N)F)NN)NNN)i  )(r
   r   r   r   r   rY   r  r   r"   ri  ro  r   rc  r  r  r  r  r  r  r6  r   r7  rS   ra   r  r  r  rB   r  r  r  r  r  r  r  r  r  rd  r   rC   r8  s   @r   r   r   [  s    4 
B(,%"%:$#^:>^RV^@L-\9
&    ^^
 
mE m^(1T75$  /bF.6B!B!,F,^@ r   c                   F   a  ] tR tRt o RtR]RR
3R ltRR ltR tR	t	V t
R# )r   i}  zDClass to create ZIP archives with Python library files and packages.rR  Tc                B    \         P                  WW#VR 7       WPn        R# ))r  r)  re  N)r   r"   	_optimize)r!   r  r  r)  re  optimizes   &&&&&&r   r"   PyZipFile.__init__  s!    $$. 	 	0!r   Nc                   \         P                  ! V4      pV'       d_   V! V4      '       gQ   V P                  '       d=   \         P                  P	                  V4      '       d   RMRp\        V: RV: R24       R# \         P                  P                  V4      w  rV\         P                  P	                  V4      '       EdZ   \         P                  P                  VR4      p\         P                  P                  V4      '       Ed   V'       d   V: RV: 2pMTpV P                  '       d   \        RVR	V4       V P                  V^ R V4      w  rV P                  '       d   \        R
V	4       V P                  W4       \        \         P                  ! V4      4      p
V
P                  R4       V
 EFO  p\         P                  P                  W4      p\         P                  P                  V4      w  r\         P                  P	                  V4      '       d[   \         P                  P                  \         P                  P                  VR4      4      '       d   V P                  WVR7       K  K  VR8X  g   K  V'       d6   V! V4      '       g(   V P                  '       d   \        RV,          4       EK	  V P                  V^ R V4      w  rV P                  '       d   \        R
V	4       V P                  W4       EKR  	  R# V P                  '       d   \        RV4       \        \         P                  ! V4      4       F  p\         P                  P                  W4      p\         P                  P                  V4      w  rVR8X  g   KL  V'       d5   V! V4      '       g'   V P                  '       d   \        RV,          4       K  V P                  V^ R V4      w  rV P                  '       d   \        R
V	4       V P                  W4       K  	  R# VRR R8w  d   \!        R4      hV P                  V^ R V4      w  rV P                  '       d   \        RV	4       V P                  W4       R# )aN  Add all files from "pathname" to the ZIP archive.

If pathname is a package directory, search the directory and
all package subdirectories recursively for all *.py and enter
the modules into the archive.  If pathname is a plain
directory, listdir *.py and enter all modules.  Else, pathname
must be a Python *.py file and the module will be put into the
archive.  Added modules are always module.pyc.
This method will compile the module.py into module.pyc if
necessary.
If filterfunc(pathname) is given, it is called with every argument.
When it is False, the file or directory is skipped.
r  r  r  z skipped by filterfuncNz__init__.pyr   zAdding package inasAdding)
filterfunc.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"zAdding file)r   r  rn   r  r   rm   r5   r>   isfile_get_codenamer  r  listdirremovesplitextwritepyr  )r!   pathnamebasenamer&  labeldirr  initnamer  r  dirlistrb   r  rootexts   &&&&           r   r.  PyZipFile.writepy  s.    99X&j22zzz"$''--"9"9vuhGHGGMM(+	77==""ww||Hm<Hww~~h''*2D9H#H:::-xxH!%!3!3HQrNH!M:::(G,

5* H!56}- 'H77<<;D " 0 0 :IDww}}T**77>>"'',,t]*KLL LL4> ) @ M %j.>.>#zzz %&E&L M$)-););D2J<D*F:::!(G4

52# !(( :::7B &rzz('; <H77<<;D " 0 0 :IDe|%j.>.>#zzz %&E&L M$)-););D2J<D*F:::!(G4

52 != }%"DF F!//2INEzzzmW-JJu&r   c                  a  R
V 3R llpVR,           pVR,           p\         P                  P                  VRR7      p\         P                  P                  V^R7      p\         P                  P                  V^R7      pS P                  R	8X  Ed   \        P
                  P                  V4      '       dI   \        P                  ! V4      P                  \        P                  ! V4      P                  8  d   T;rEM\        P
                  P                  V4      '       dJ   \        P                  ! V4      P                  \        P                  ! V4      P                  8  d   Tp
Tp	EM"\        P
                  P                  V4      '       dJ   \        P                  ! V4      P                  \        P                  ! V4      P                  8  d   Tp
Tp	EM\        P
                  P                  V4      '       dJ   \        P                  ! V4      P                  \        P                  ! V4      P                  8  d   Tp
Tp	EMFV! V4      '       dJ   \        P                  P                  ^ 8X  d   Tp
M$\        P                  P                  ^8X  d   Tp
MTp
Tp	MT;rMS P                  ^ 8X  d   Tp
Tp	MPTp	S P                  ^8X  d   Tp
M:S P                  ^8X  d   Tp
M&RP                  S P                  4      p\        V4      h\        P
                  P                  V
4      '       dD   \        P                  ! V
4      P                  \        P                  ! V4      P                  8  g   V! VS P                  R7      '       g   T;r\        P
                  P                  V	4      ^,          pV'       d
   V: RV: 2pW3# )zReturn (filename, archivename) for the path.

Given a module name path, return the correct file path and
archive name, compiling if necessary.  For example, given
/python/lib/string, return (/python/lib/string.pyc, string).
c                    < ^ RI pSP                  '       d   \        RV 4        VP                  V RVR7       R#   TP                   d!   p\        TP
                  4        Rp?R# Rp?ii ; i)rH   N	CompilingT)doraiser!  F)
py_compilern   rm   compilePyCompileErrormsg)r  r!  r<  errr!   s   &&  r   _compile)PyZipFile._get_codename.<locals>._compile  s^    zzzk4(""4"I  ,, cggs   ; A,A''A,r'  z.pycr   )optimizationz"invalid value for 'optimize': {!r})r!  r   r  r  )	importlibutilcache_from_sourcer   r   r  r)  r   r  r   r  r!  formatr   r5   )r!   r/  r0  rA  file_pyfile_pycpycache_opt0pycache_opt1pycache_opt2r  r  r?  archivenames   f&&          r   r*  PyZipFile._get_codename  s   		 e#f$ ~~77b7Q ~~77a7P ~~77a7P>>Rx((''(#,,0@0I0II"**%''....'','00BGGG4D4M4MM %"''....'','00BGGG4D4M4MM %"''....'','00BGGG4D4M4MM %" G$$yy))Q. ,++q0 , ,&G&--EG ~~"$"">>Q&(E^^q((E>EEdnnUC$S/)GGNN5))GGEN++rwww/?/H/HH$..AA&--EggmmG,Q/%-{;K##r   )r   r  )r   N)r
   r   r   r   r   r   r"   r.  r*  r   rC   r8  s   @r   r   r   }  s*     N"%: 2"P'dP$ P$r   c                   a ^ RI pRpVP                  VRR7      pVP                  RR7      pVP                  RRRR	R
7       VP                  RR^R"RR7       VP                  RRRR#RR7       VP                  RRRRR
7       VP                  RRRR
7       VP	                  V 4      p V P
                  pV P                  ek   V P                  p\        VRVR7      ;_uu_ 4       pVP                  4       pRRR4       X'       d   \        RP                  V4      4       \        R4       R# V P                  e>   V P                  p\        VRVR7      ;_uu_ 4       pVP                  4        RRR4       R# V P                  eA   V P                  w  ri\        VRVR7      ;_uu_ 4       pVP                  V	4       RRR4       R# V P                  Ee#   V'       d2   \        R\         P"                  R7       \         P$                  ! ^4       V P                  P'                  ^ 4      p
V P                  pV3R lo\        V
R 4      ;_uu_ 4       pV F  p\(        P*                  P-                  V4      pV'       g=   \(        P*                  P-                  \(        P*                  P/                  V4      4      pVR!\(        P0                  \(        P2                  39   d   R!pS! W|V4       K  	  RRR4       R# R#   + '       g   i     EL; i  + '       g   i     R# ; i  + '       g   i     R# ; i  + '       g   i     R# ; i)$rH   Nz3A simple command-line interface for zipfile module.T)descriptioncolor)requiredz-lz--list	<zipfile>zShow listing of a zipfile)metavarhelpz-ez	--extractzExtract zipfile into target dir)nargsrT  rU  z-cz--create+zCreate zipfile from sourcesz-tz--testzTest if a zipfile is validz--metadata-encodingz
<encoding>z2Specify encoding of member names for -l, -e and -trR  )rS  z.The following enclosed file is corrupted: {!r}zDone testingz/Non-conforming encodings not supported with -c.r  c           	        < \         P                  P                  V4      '       d   V P                  W\        4       R # \         P                  P                  V4      '       d   V'       d   V P                  W4       \        \         P                  ! V4      4       FG  pS! V \         P                  P                  W4      \         P                  P                  W#4      4       KI  	  R # R # r   )	r   r  r)  r  r  r   r  r+  r>   )r<  r  zippathnmaddToZips   &&& r   r[  main.<locals>.addToZip\	  s    ww~~d##5t$$HHT+ D!12BRWW\\$3RWW\\'5NP 3 %r   rU  r   )rS  z<output_dir>)z<name>z<file>)argparseArgumentParseradd_mutually_exclusive_groupadd_argument
parse_argsrS  testr   r  rm   rG  r   r  r  r  creater   stderrexitpopr   r  r0  r  r  r  )argsr]  rP  parsergroupencodingr   r<  badfiler  zip_namefilesr  rY  r[  s   &             @r   mainrn  +	  s   GK$$D$IF///>E	tX{7  9	t[<=  ? 
tZs39  ; 
tX{8  :
-|Q  ST"D%%HyyiiS#::bjjlG ;BII'RSn		iiS#::bKKM ;: 
	!llS#::bMM&! ;: 
	 Czz#HHQK;;??1%	P Xs##r''**40 gg..rwwt/DEGr299bii88 G7+  $#) 
!! ;:: ;::
 ;::. $##s1   $K8L)L BL48L		L	 L1	4M	)PathCompleteDirs)r   
BadZipfiler*   r   r  r   r   r   re   r   r   r   r   ro  ir   i   r  r   )r   binasciiimportlib.utilrD  r  r   r  r   r)   r   ra  r  r  rC  ImportErrorr  ra  r)  r   __all__	Exceptionr   r   r*   rq  r   r  r   r   r  r   r   r   r   r   r   r   r   r  r   r   r   r   ri   rM   rN   rw   rJ   rK   rL   r   r|  rh   rU   rW   rR   rV   _CD_CREATE_VERSION_CD_CREATE_SYSTEM_CD_EXTRACT_VERSION_CD_EXTRACT_SYSTEMr  _CD_COMPRESS_TYPE_CD_TIME_CD_DATE_CD_CRC_CD_COMPRESSED_SIZE_CD_UNCOMPRESSED_SIZEr~  r  r  _CD_DISK_NUMBER_START_CD_INTERNAL_FILE_ATTRIBUTES_CD_EXTERNAL_FILE_ATTRIBUTESr  r  r  r   r  r  r   r   r   r  r  _FH_EXTRACT_VERSION_FH_EXTRACT_SYSTEMr  _FH_COMPRESSION_METHOD_FH_LAST_MOD_TIME_FH_LAST_MOD_DATE_FH_CRC_FH_COMPRESSED_SIZE_FH_UNCOMPRESSED_SIZEr  r  rt   ru   rl   rv   rj   rk   _CD64_SIGNATURE_CD64_DIRECTORY_RECSIZE_CD64_CREATE_VERSION_CD64_EXTRACT_VERSION_CD64_DISK_NUMBER_CD64_DISK_NUMBER_START_CD64_NUMBER_ENTRIES_THIS_DISK_CD64_NUMBER_ENTRIES_TOTAL_CD64_DIRECTORY_SIZE_CD64_OFFSET_START_CENTDIRrL  rO  r   r\   re   rQ   r   rI   r   r   rS  r=  rW  rY  rq  r   r  r  r  r  r  r  r  r3  r   r   rn  _pathro  rp  r	   r   r   <module>r     s  
   	 	    
  JJE
 #
	 	9    
 #  
	       !12   	   $   !12      
      ! !     
 #      
   "   !12   !    
     % )  //*CD  " " ??#56      !"    !
U !
H&$ (V:x&J Jb 	 #L" ". 8wx x x	
 x x y z y { 	      !" 	#$ % *N.$P((! (!V (V"" Vr
X+B%% X+x_ _Dk$ k$\C,L {J  DNNE  
C
  D
  DsF   I I2 J J I/.I/2	I?>I?	JJ	JJ