python (3.11.7)

(root)/
lib/
python3.11/
__pycache__/
zipfile.cpython-311.opt-1.pyc

eidZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZ	ddlZejZn#e$rdZejZYnwxYw	ddlZn
#e$rdZYnwxYw	ddlZn
#e$rdZYnwxYwgdZGddeZGddeZexZZdZd	Zd	ZdZd
ZdZ dZ!d
Z"dZ#dZ$dZ%dZ&dZ'dZ(e
j)e'Z*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2d
Z3dZ4dZ5dZ6e
j)e5Z7dZ8dZ9dZ:dZ;dZ<dZ=dZ>dZ?d
Z@dZAdZBdZCdZDdZEdZFd ZGd!ZHd"ZId#ZJdZKdZLd
ZMd$ZNd%ZOd&ZPd'ZQd(ZRe
j)eQZSdZTdZUdZVdZWdZXdZYdZZdZ[d
Z\dZ]dZ^dZ_d)Z`d*Zae
j)e`Zbd+Zcd,Zde
j)ecZedZfdZgdZhdZidZjdZkdZldZmd
ZndZod-Zpe
jqd.Zrd/Zsd0Ztd1Zud2Zvd3ZwGd4d5exZydazd6Z{d7Z|Gd8d9Z}Gd:d;Z~idd<dd=dd>dd>dd>dd>dd?dd@d
dAddBdd?ddCddDd#dEdFdGdHdIdJdKZdLZdgdMZdNZGdOdPZGdQdRZGdSdTejZGdUdVejZGdWdXZGdYdZeZd[Zd\ZejZ	d]ZGd^d_eZGd`daeZdgdbZGdcddZdgdeZedfkredSdS)hzP
Read and write ZIP files.

XXX references to utf-8 need further investigation.
N)
BadZipFile
BadZipfileerror
ZIP_STOREDZIP_DEFLATED	ZIP_BZIP2ZIP_LZMA
is_zipfileZipInfoZipFile	PyZipFileLargeZipFilePathceZdZdS)rN)__name__
__module____qualname__;/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/zipfile.pyrr+sDrrceZdZdZdS)rzu
    Raised when writing a zipfile, the zipfile requires ZIP64 extensions
    and those extensions are disabled.
    N)rrr__doc__rrrrr/srri-.?s<4s4H2LHsPK	z<4s4B4HL2L5H2LsPK

 @iz<4s2B4HL2L2HsPKz<4sLQLsPKz
<4sQ2H2L4QsPKiPK<HHctj}d}g}dx}}|dzt|krd||||dz\}}|dz|z}	||vr'||kr|||||	}d}|	}|dzt|kd|s|S|t|kr|||dd|S)NFrr$Tr)_EXTRA_FIELD_STRUCTunpacklenappendjoin)
extraxidsr5modifiedbufferstartixidxlenjs
          r_strip_extrarBs
 
'FH
FMEA
a%3u::

F5QU+,,	T
EDL$;;Ezz

eEAI.///EH
a%3u::

E



eEFFm$$$88FrcL	t|rdSn#t$rYnwxYwdS)NTF)_EndRecDataOSErrorfps r_check_zipfilerHsD
r??	4	



5s
!!cd}	t|drt|}n7t|d5}t|}dddn#1swxYwYn#t$rYnwxYw|S)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.
    FreadrFrbN)hasattrrHopenrE)filenameresultrGs   rr
r
s
F
8V$$	,#x000FFh%%
,'++
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,



Ms41AAAAAAA
A*)A*c
	||tz
dn#t$r|cYSwxYw|t}t	|tkr|Stjt|\}}}}|tkr|S|dks|dkrtd||tz
tz
d|t}t	|tkr|Stjt|\
}}}	}
}}}
}}}|tkr|S||t<||t<||t<|
|t <||t"<||t$<||t&<|S)zM
    Read the ZIP64 end-of-archive records and use that to update endrec
    r"rr!z3zipfiles that span multiple disks are not supported)seeksizeEndCentDir64LocatorrErJr6structr5structEndArchive64LocatorstringEndArchive64LocatorrsizeEndCentDir64structEndArchive64stringEndArchive64_ECD_SIGNATURE_ECD_DISK_NUMBER_ECD_DISK_START_ECD_ENTRIES_THIS_DISK_ECD_ENTRIES_TOTAL	_ECD_SIZE_ECD_OFFSET)fpinoffsetendrecdatasigdisknoreloffdisksszcreate_versionread_versiondisk_numdisk_dirdircount	dircount2dirsize	diroffsets                 r
_EndRecData64rqs		&22A6666



99,--D
4yy+++
!'/H$!O!OC
'''

{{eaiiNOOO	IIf..1AA1EEE99%&&D
4yy$$$
	
($//0C^\8X)Wi
   
!F>'F&F?%-F!"!*FF9#F;Ms!00c|dd|}	|tdn#t$rYdSwxYw|}t|tkr|ddtkr|dddkrrtjt|}t|}|d||tz
t|t|St|dz
tz
d}||d|}|t}|dkr|||tz}t|tkrdSttjt|}|t}||tz|tz|z}|||||zt|||z|z
|SdS)	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.rr"Nr$sri)rQtellsizeEndCentDirrErJr6stringEndArchiverSr5structEndArchivelistr7rqmaxrfind_ECD_COMMENT_SIZE)	r`filesizercrbmaxCommentStartr=recDatacommentSizecomments	         rrDrDs	IIaOOOyy{{H
		>/1%%%%tt99;;DD		^##QqS	%%%RSS	[  /66F||	

c

h/000TN?F;;;(g.?CCOIIoq!!!99;;DJJ'((EzzuU>112w<<>))4fm$4g>>??./u^+E.,@,LLM

g

o-...T?U#:X#E#%%	%4sA		
AAc\eZdZdZdZddZdZddZd	Zd
Z	e
dddd
ZdZdS)rz>Class with attributes describing each file in the ZIP archive.)
orig_filenamerN	date_time
compress_type_compresslevelrr9
create_systemriextract_versionreserved	flag_bitsvolume
internal_attr
external_attr
header_offsetCRC
compress_size	file_size	_raw_timeNoNamer!r!rrrcX||_|td}|dkr
|d|}tjdkr.tj|vr |tjd}||_||_|ddkrtdt|_
d|_d|_d|_
tjdkrd|_nd|_t"|_t"|_d|_d|_d|_d|_d|_d|_d|_dS)Nr/rz+ZIP does not support timestamps before 1980rwin32r#)rfindchrossepreplacerNr
ValueErrorrrrrr9sysplatformrDEFAULT_VERSIONrirrrrrrrr)selfrNr	null_bytes    r__init__zZipInfo.__init__ts %MM#a&&))	>>),H6S==RVx//''44H 
"Q<$JKKK("
<7""!"D"#D-.
rcd|jjd|jg}|jtkr;|dt|j|jz|jdz	}|jdz}|r*|dtj
|z|r|d|z|}|r|jr|d|jz|r|j
r=|jtks|j|j
kr|d	|j
z|d
d|S)N<z
 filename= compress_type=%sr-rz filemode=%rz external_attr=%#xz
 file_size=%rz compress_size=%r>)	__class__rrNrrr7compressor_namesgetrstatfilemodeis_dirrrr8)rrOhiloisdirs     r__repr__zZipInfo.__repr__s{'+~'>'>'>

NO++MM-*..t/A/3/ACCC
D
D
D
2
%

&
(
	>MM.4=+<+<<===
	5MM.3444

	<	<MM/DN:;;;	D$,	D

:
-
-
^t1
1
1MM-0BBCCC

cwwvrNc|j}|ddz
dz|ddzz|dz}|ddz|d	dzz|ddzz}|jtzrdx}x}}n|j}|j}|j}|j}d}	||tkp
|tk}|r=d}
|tj	|
dtj
|
d	z
||z}d}d}t}	|jtkrtt|	}	n%|jt krtt"|	}	t|	|j|_t|	|j|_|\}}tj	t*t,|j|j||j|||||t1|t1|

}
|
|z|zS)
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.
        rrr(r!r%r"r#r*r$Nz<HHQQ)rr_MASK_USE_DATA_DESCRIPTORrrrr9ZIP64_LIMITrSpackcalcsize
ZIP64_VERSIONrrry
BZIP2_VERSIONr	LZMA_VERSIONrri_encodeFilenameFlagsstructFileHeaderstringFileHeaderrr6)rzip64dtdosdatedostimerrrr9min_versionfmtrNrheaders              r
FileHeaderzZipInfo.FileHeaders^a54<A%1
2RU:Q%2+1
*beqj9>55	'.//C/-))(C .MI
=+J}{/JE	(CFK()6?3+?+?+A9m]]]E"I&M'K**m[99KK

8
+
+lK88K";0DEE!+t/BCC"7799)-/?!14=)!/'3*I ]]CJJ	88
 5((rc	|jd|jfS#t$r,|jd|jtzfcYSwxYw)Nasciiutf-8)rNencoderUnicodeEncodeError_MASK_UTF_FILENAMErs rrzZipInfo._encodeFilenameFlagssm	V=''00$.@@!	V	V	V=''00$.CU2UUUUU	Vs #3AAc|j}tj}t|dkr*|d|dd\}}|dzt|krt	d||fz|dkr|d|dz}	|jdvr'd}|d|dd\|_|dd}|jd	kr'd
}|d|dd\|_|dd}|jd	krd}|d|dd\|_n'#tj$rt	d|d
dwxYw||dzd}t|dk(dSdS)Nr$r2z"Corrupt extra field %04x (size=%d)r!)lrz	File sizez<Qrrz
Compress sizez
Header offsetzCorrupt zip64 extra field. z not found.)	r9rSr5r6rrrrr)rr9r5tplnrcfields       r_decodeExtrazZipInfo._decodeExtras
%jjAooVE5!9--FB!tc%jj   !ER!PQQQV||Qr!tV}F~)MMM +*0&tBQBx*@*@#ABBx)[88 /.4fT48.D.D+*#ABBx)[88 /.4fT48.D.D+*|FFF$&;(-&;&;&;<<AEFF"Q$%%LE/%jjAoooooos
=B
D$D,Tstrict_timestampsct|tjrtj|}tj|}t	j|j}tj|j	}|dd}|s|ddkrd}n|s|ddkrd}||}tj
tj
|d}|dtj
tjfvr*|dd}|dtj
tjfv*|r|d	z
}|||}|jd
zdz|_|rd|_|xjdzc_n|j|_|S)a_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).
        rr&rr;)rr;rNr!rrr-)
isinstancerPathLikefspathrS_ISDIRst_modetime	localtimest_mtimepathnormpath
splitdriveraltseprrst_size)	clsrNarcnamerstrmtimerzinfos	         r	from_filezZipInfo.from_fileszh,,	+y**H
WX

RZ((r{++!A#J	 	3Yq\D%8%8-II"	3y|d':':2I?G'""27#5#5g#>#>q#ABBajRVRY///abbkGajRVRY///	sNGGY''!zF2r9	)EO4' jEOrc$|jddkS)z2Return True if this archive member is a directory.rrNrs rrzZipInfo.is_dir.s}R C''r)rrN)
rrrr	__slots__rrrrrclassmethodrrrrrrrZsHHI.&&&&V,.).).).)`VVV!!!:#D####[#J(((((rrcPtdD]}|dzr	|dz	dz}|dz}|S)Nrr!l q[)range)crcrAs  r_gen_crcr8sC
1XX7	!8z)CCAICCJrcdddt/tttt	datfdfd|D]
}|fd}|S)NixV4igE#ixV4c,|dz	||zdzzS)z(Compute the CRC32 primitive on one byte.rr)chrcrctables  rcrc32z_ZipDecrypter.<locals>.crc32Rs qHcBh$%6777rcj|dzzdzdzdzdzdz	dS)Nrrir!r)crkey0key1key2s rupdate_keysz"_ZipDecrypter.<locals>.update_keysVsRuQ~~t$
2y 1$
2uTRZ&&rct}|j}|D].}dz}|||dzzdz	dzz}|||/t|S)zDecrypt a bytes object.r"r!rr)	bytearrayr7bytes)rcrOr7rkrrs     r	decrypterz _ZipDecrypter.<locals>.decrypter`so		AqA
1!9"d**AKNNNF1IIIIV}}r)	_crctablerxmaprr)	pwdpr	rrrrrrs	   @@@@@@r
_ZipDecrypterrHsDDDXuSzz2233	H88888''''''''A						rc&eZdZdZdZdZdZdS)LZMACompressorcd|_dSr)_comprs rrzLZMACompressor.__init__ps



rctjdtji}tjtjtjtj|g|_tjdddt||zS)Nidfiltersz<BBHr(r$)
lzma_encode_filter_propertiesFILTER_LZMA1r
FORMAT_RAW_decode_filter_propertiesrrSrr6)rpropss  r_initzLZMACompressor._initsss.d6G/HII(*4+<eDDC

{61aU44u<<rc|j/||j|zS|j|Sr)rrcompress)rrcs  rrzLZMACompressor.compresszsC:::<<$*"5"5d";";;;z""4(((rc|j.||jzS|jSr)rrflushrs rr!zLZMACompressor.flushs?:::<<$*"2"2"4"444z!!!rN)rrrrrrr!rrrrrnsP===)))
"""""rrceZdZdZdZdS)LZMADecompressorc0d|_d|_d|_dS)NrF)_decomp_unconsumedeofrs rrzLZMADecompressor.__init__src
|j|xj|z
c_t|jdkrdStjd|jdd\}t|jd|zkrdStjt
jtjt
j	|jdd|zg|_|jd|zd}|`|j
|}|jj|_|S)Nr$rz<Hr"r)r%r&r6rSr5rr#rrr
decompressr')rrcpsizerOs    rr)zLZMADecompressor.decompresss<$4#$$))s]4)9!A#)>??FE4#$$E	11s0.t/@/3/?!e)/LNNKDL#AIJJ/D ((..<#
rN)rrrrr)rrrr#r#s2
rr#storeshrinkreduceimplodetokenizedeflate	deflate64bzip2rterselz77awavpackbppmdc|tkrdS|tkrtstddS|tkrt
stddS|tkrtstddStd)Nz.Compression requires the (missing) zlib modulez-Compression requires the (missing) bz2 modulez.Compression requires the (missing) lzma modulez(That compression method is not supported)	rrzlibRuntimeErrorrbz2r	rNotImplementedError)compressions r_check_compressionr@sj  		$	$	B@BB
B	B	B
		!	!	A?AA
A	A	A
	 	 	B@BB
B	B	B""LMMMrcN|tkrL| tj|tjdStjtjtjdS|t
kr)|t
j|St
jS|tkrtSdS)N)
rr;compressobjDEFLATEDZ_DEFAULT_COMPRESSIONrr=
BZ2Compressorr	r)r
compresslevels  r_get_compressorrHs$$$#M4=#FFF :DM3OOO	)	#	#$$]333 """	(	"	"trclt||tkrdS|tkrtjdS|t
krt
jS|tkrtSt|}|rtd||fztd|fz)NrBzcompression type %d (%s)zcompression type %d)
r@rrr;
decompressobjrr=BZ2Decompressorr	r#rrr>)rdescrs  r_get_decompressorrMs}%%%
""t	,	&	&!#&&&	)	#	#"$$$	(	"	"!!! $$]33	P%&@MSXCY&YZZZ%&;}>N&NOOOrc0eZdZdZdZd	dZd
dZdZdS)_SharedFilecd||_||_||_||_||_|j|_dSr)_file_pos_close_lock_writingseekable)rfileposcloselockwritings      rrz_SharedFile.__init__s2
	





rc|jSr)rRrs rrtz_SharedFile.tells
yrrc
|j5|rtd|j|||j|_|jcdddS#1swxYwYdS)Nz}Can't reposition in the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)rTrUrrQrQrtrR)rrawhences   rrQz_SharedFile.seeks
Z		}}
K "JKKK
JOOFF+++
))DI9																		sA#A88A<?A<rc<|j5|rtd|j|j|j|}|j|_|cdddS#1swxYwYdS)NyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)rTrUrrQrQrRrJrtrnrcs   rrJz_SharedFile.reads
Z		}}
K "JKKK
JOODI&&&:??1%%D
))DI																		sA<BBBc^|j%|j}d|_||dSdSr)rQrS)rfileobjs  rrYz_SharedFile.closes8:!jGDJKK     "!rNrr)rrrrrtrQrJrYrrrrOrOsi&&&				!!!!!rrOc,eZdZdZdZdZdZdZdS)	_Tellablec"||_d|_dSNr)rGrarrGs  rrz_Tellable.__init__srcZ|j|}|xj|z
c_|Sr)rGwritera)rrcrbs   rrmz_Tellable.writes*GMM$qrc|jSr)rars rrtz_Tellable.tells
{rc8|jdSr)rGr!rs rr!z_Tellable.flush

rc8|jdSr)rGrYrs rrYz_Tellable.close"rprN)rrrrrmrtr!rYrrrrhrhs_
rrhceZdZdZdZdZdZ		ddZdZd	Z	ddZ
dd
ZdZddZ
dZdZdZdZfdZdZddZdZxZS)
ZipExtFilezZFile-like object for reading an archive member.
       Is returned by ZipFile.open().
    i@iiNFc&||_||_||_|j|_|j|_|j|_t|j|_
d|_d|_d|_
d|_||_|j|_t%|dr!|j|_t+d|_nd|_d|_	|rD||_|j|_|j|_|j|_d|_n#t<$rYnwxYwd|_|r[|j tBzr|j"dz	dz}n
|jdz	dz}|#}||krtId	|j%zdSdS)
NFrrrTrrrzBad password for file %r)&_fileobj_pwd_close_fileobjr_compress_typer_compress_leftr_leftrM
_decompressor_eof_readbuffer_offsetnewlinesmoderNnamerLr
_expected_crcr_running_crc	_seekablerVrt_orig_compress_start_orig_compress_size_orig_file_size_orig_start_crcAttributeError
_decrypterrrr_init_decrypterr<r)rrdrzipinfor
close_fileobj
check_bytehs        rrzZipExtFile.__init__4s
	+%3%3&
.t/BCC	
	$	7E""	&!(D %c

D!%D	!!
&,3LLNN)+2+@('.'8$'+'8$!%			D			W #<<
8%/14<

&kR/47
$$&&AJ"#=@U#UVVV		W		WsAD
D('D(ct|j|_|jd}|xjdzc_||dS)Nrr*)rrvrrurJry)rrs  rrzZipExtFile._init_decryptergsU'	22##B''r!v&&r**rcd|jjd|jjg}|jsq|d|jd|j|jtkr;|dt
|j|jzn|d|dd|S)	Nr.z name=z mode=r	 [closed]rr)rrrclosedr7rrrxrrrr8rrOs  rrzZipExtFile.__repr__rs"n777"n99;<{	'MMM			499EFFF"j00

1.2243F373FHHHIII
MM+&&&

cwwvrrc|dkrF|jd|jdz}|dkr|j|j|}||_|Stj||S)zrRead and return a line from the stream.

        If limit is specified, at most limit bytes will be read.
        r
r!)r}rr~ioBufferedIOBasereadline)rlimitr>lines    rrzZipExtFile.readlinesm199 %%eT\::Q>A1uu'a8  ))$666rr!cV|t|j|jz
krn||}t||jkr$||j|jdz|_d|_n|xjt|zc_|j|j|jdzS)z6Returns buffered bytes without advancing the position.Nri)r6r}r~rJ)rrbchunks   rpeekzZipExtFile.peekss4#$$t|333IIaLLE5zzDL((#(4+;DLMM+J#J  E

*dlS.@ @AArc2|jrtddS)NI/O operation on closed file.T)rrrs rreadablezZipExtFile.readables ;	><===trc|jrtd||dkrO|j|jd}d|_d|_|js$|||jz
}|j$|S||jz}|t|jkr|j|j|}||_|S|t|jz
}|j|jd}d|_d|_|dkro|jsh||}|t|kr||_||_||d|z
}n$||z
}|t|z}|dkr|jh|S)zRead and return up to n bytes.
        If the argument is omitted, None, or negative, data is read and returned until EOF is reached.
        zread from closed file.Nrr)rrr}r~r|_read1MAX_Nr6)rrbbufendrcs     rrJzZipExtFile.readsx;	756669A"4<==1C"DDLi
/t{{4:...i
/J$,T%&&&&"4<#34CDLJ#d&'''t|}}-!eeDIe;;q>>D3t99}}#'  tBQBx4KC
TNA!eeDIe
rc|jdSt||j|_|jr'|j|jkrt	d|jzdSdS)NzBad CRC-32 for file %r)rrrr|rr)rnewdatas  r_update_crczZipExtFile._update_crcsh%F!'4+<==9	C*d.@@@5	ABBB	C	C@@rcn||dkrT|j|jd}d|_d|_|js)||j}|r||z
}n|j)|S||jz}|t|jkr|j|j|}||_|S|t|jz
}|j|jd}d|_d|_|dkrZ|jsS||}|t|kr||_||_||d|z
}n|r||z
}n|jS|S)z7Read up to n bytes with at most one read() system call.Nrr)r}r~r|rrr6)rrbrrcrs     rread1zZipExtFile.read1sk
9A"4<==1C"DDLi
{{4:..4KC	i

J$,T%&&&&"4<#34CDLJ#d&'''t|}}-q55i	
{{1~~s4yy=='+D$#$DL48OC4KCi	

rcl|js|dkrdS|jtkrH|jj}|t|kr(|||t|z
z
}n||}|jtkr|jdk|_n|jtkr}t||j
}|j||}|jjp|jdko|jj|_|jr||j
z
}n6|j|}|jjp
|jdk|_|d|j}|xjt|zc_|jdkrd|_|||S)NrrT)r|rxrr{unconsumed_tailr6_read2rryry
MIN_READ_SIZEr)r'r!rzrras   rrzZipExtFile._read1s9	Q3,..%5D3t99}}AD		M222;;q>>D*,,+q0DII

 L
0
0At)**A%00q99D+/@,1@!/??
Iy
3*00222%0066D*.J$2E2JDIKTZK 

c$ii

:??DIrc,|jdkrdSt||j}t||j}|j|}|xjt
|zc_|st|j||}|S)Nrr)	ryryrminrurJr6EOFErrorrras   rrzZipExtFile._read2s!##34%&&4&''}!!!$$s4yy(	N?&??4((Drc	|jr|jtdS#twxYwr)rwrurYsuperrrs rrYzZipExtFile.close(sR	"
&
##%%%GGMMOOOOOEGGMMOOOOs A"A'c<|jrtd|jSNr)rrrrs rrVzZipExtFile.seekable/s#;	><===~rrc^|jrtd|jstjd|}|dkr|}n,|dkr||z}n |dkr|j|z}ntd||jkr|j}|dkrd}||z
}||jz}|dkr"|t|j	kr
||_d}n|dkr|j
|j|j
|_|j|_|j|_d|_	d|_t%|j|_d|_|}|j||dkr5t1|j|}||||z}|dk5|S)	Nzseek on closed file.!underlying stream is not seekablerr!r"zCwhence must be os.SEEK_SET (0), os.SEEK_CUR (1), or os.SEEK_END (2)rF)rrrrUnsupportedOperationrtrr~r6r}rurQrrrrryrzrMrxr{r|rrr
MAX_SEEK_READrJ)rrar^curr_posnew_posread_offsetbuff_offsetread_lens        rrQzZipExtFile.seek4s;	53444~	O)*MNNN99;;Q;;GG
q[['GG
q[[*V3GGCDD
DT)))*GQ;;G(!DL0!c$2B.C.C C C&DLKK
1__Mt8999 $ 4D"&":D-DJ"DDL!243F!G!GDDI!K*$$&&&Aoo4-{;;HIIh8#KAoo
yy{{rc|jrtd|jstjd|j|jz
t|jz
|j	z}|S)Nztell on closed file.r)
rrrrrrrzr6r}r~)rfileposs  rrtzZipExtFile.tellfsc;	53444~	O)*MNNN&3c$:J6K6KKdlZr)NFrfr!re)rrrrrrrrrrrrrrJrrrrrYrVrQrt
__classcell__rs@rrsrs&sX

EMM37$0W0W0W0Wf	+	+	+7777 BBBB
!!!!FCCC###J"""H 
0000drrscFeZdZdZedZdZdZfdZxZ	S)
_ZipWriteFilec||_||_||_t|j|j|_d|_d|_d|_	dSrj)
_zinfo_zip64_zipfilerHrr_compressor
_file_size_compress_size_crc)rzfrrs    rrz_ZipWriteFile.__init__psP
*5+>+0+?AA			rc|jjSr)rrGrs rruz_ZipWriteFile._fileobjzs
}rcdS)NTrrs rwritablez_ZipWriteFile.writable~strc|jrtdt|ttfrt|}nt
|}|j}|xj|z
c_t||j
|_
|jr7|j|}|xj
t|z
c_
|j||Sr)rrrrrr6
memoryviewnbytesrrrrrrrurm)rrcrs   rrmz_ZipWriteFile.writes;	><===dUI.//	!YYFFd##D[F6!$	**		-#,,T22D3t99,
D!!!
rc	L|jrdS	t|jrb|j}|xjt
|z
c_|j||j|j	_
n|j|j	_
|j|j	_
|j|j	_|js>|jt krt#d|jt krt#d|j	jt&zr|jrdnd}|jt)j|t,|j	j
|j	j
|j	j|j|j_n|j|j_|j|j	j|j|j	|j|j|jj|jj|j	|j	|jj|j	j <d|j_!dS#d|j_!wxYw)Nz*File size too large, try using force_zip64z0Compressed size too large, try using force_zip64z<LLQQz<LLLLF)"rrrYrr!rr6rurmrrrrrrrrr<rrrSr
_DD_SIGNATURErtr	start_dirrQrrfilelistr7
NameToInforNrU)rrrrs   rrYz_ZipWriteFile.closesE;	F(	+GGMMOOO
<&,,..##s3xx/##
##C(((,0,?)),0O)"iDKO$(ODK!;
[?[00&'STTT&44&'YZZZ{$'@@
<!%9gg'
##FK]DKOK-t{/D%F%FGGG*.-*<*<*>*>
''+/-*<*<*>*>
'
""4;#<===
##DK$:$:4;$G$GHHH
""4=#:;;;
M"))$+666=A[DM$T[%9:%*DM"""UDM"****sI;JJ#)
rrrrpropertyrurrmrYrrs@rrros  X &++++++++++++++++++rrc,eZdZdZdZdZdeddfddddZdZdZ	d	Z
d
ZdZdZ
d%d
ZdZdZdZedZejdZd%dZd&dddZd'dZd(dZd)dZedZdZdZ		d)dZ	d(dZd*d Z d!Z!d"Z"d#Z#d$Z$dS)+rai 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) or ZIP_LZMA (requires lzma).
    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.

    NrT)rmetadata_encodingc|dvrtdt|||_d|_d|_i|_g|_||_||_||_	d|_
d|_||_||_
|j
r|dkrtdt|tjrtj|}t|t$r[d|_||_d	d
ddd
d
dd}||}			t+j||	|_n#t0$r|	|vr
||	}	Y5wxYwn$d|_||_t3|dd|_d|_t7j|_d|_d|_	|dkr| dS|dvrd|_	|j!|_"	|j#|j"dS#tHt0f$rd|_YdSwxYw#tHt0f$r+tK|j|_d|_"d|_YdSwxYw|dkr	| |j#|j"dS#tL$rD|j#ddd|_|j!|_"YdSwxYwtd#|j}
d|_|'|
xYw)z]Open the ZIP file with mode read 'r', write 'w', exclusive create 'x',
        or append 'a'.)rwxaz+ZipFile requires mode 'r', 'w', 'x', or 'a'FrNrrz5metadata_encoding is only supported for reading filesrKw+bx+br+bwbxb)rrrrrrrTr!r)rrrr"z"Mode must be 'r', 'w', 'x', or 'a')(rr@_allowZip64
_didModifydebugrrr?rGrr_comment_strict_timestampsrrrrrstr_filePassedrNrrMrGrEgetattr_fileRefCnt	threadingRLockrTrrU_RealGetContentsrtrrQrrhr_fpclose)rrWrr?
allowZip64rGrrmodeDictrrGs           rrzZipFile.__init__ss+++JKKK;'''%

&*	
"3!2!	IdckkGII
IdBK((	#9T??DdC  	8 D DM"U%$T$@@H~H
 gdH55DGG8++#+H#5 	
 DDG#D&$77DM_&&

'	s{{%%'''''###'/%)W\\^^DN/T^44444*G4///)./'0+++'00DG%&DN%*DNNNN+4))+++GLL00000!444GLLA&&&'+DO%)W\\^^DNNNN4!!EFFF	BDGMM"s8DD-+D-K%K%+H

G++HK%HK%
8IK%I	K%3JA
KK%KK%%&Lc|Srrrs r	__enter__zZipFile.__enter__=src.|dSrrY)rtypevalue	tracebacks    r__exit__zZipFile.__exit__@s

rcd|jjd|jjg}|jg|jr|d|jzn$|j|d|jz|d|jzn|d|dd|S)	Nrrz file=%rz filename=%rz mode=%rrrr)	rrrrGrr7rNrr8rs  rrzZipFile.__repr__Cs"n777"n99;<7
>

j4723333*

nt}<===MM*ty01111MM+&&&

cwwvrcV|j}	t|}n#t$rtdwxYw|std|jdkrt||t}|t}|t|_	|t|z
|z
}|ttkr|ttzz}|jdkr||z}td|||||z|_|jdkrtd||jd||}t%j|}d}||kr|t(}	t+|	t(krtdt-jt0|	}	|	t2t4krtd|jdkrt|	||	t6}
|	t8}|t:zr|
d	}
n|
|jpd
}
tA|
}||	tB|_"||	tF|_$|	tJ|_&|	dd\|_'|_(|_)|_*|_+|_,}
}|_-|_.|_/|j)t`krtcd|j)d
zz|	dd\|_2|_3|_4|
|_5|dz	dz|dz	dz|dz|
dz	|
dz	dz|
dzdzf|_6|7|j&|z|_&|j89|||j:|j;<|t(z|	t6z|	tBz|	tFz}|jdkrtd|||kdSdS)z/Read in the table of contents for the ZIP file.zFile is not a zip filer!r"zgiven, inferred, offsetrz Bad offset for central directoryzTruncated central directoryz&Bad magic number for central directoryrcp437rzzip file version %.1fr)r,r/r(rr%rr*r totalN)<rGrDrErrprintr^r__ECD_COMMENTr
_ECD_LOCATIONrYrXrVrRrrQrJrBytesIOsizeCentralDirr6rSr5structCentralDir
_CD_SIGNATUREstringCentralDir_CD_FILENAME_LENGTH
_CD_FLAG_BITSrdecoderr_CD_EXTRA_FIELD_LENGTHr9_CD_COMMENT_LENGTHr_CD_LOCAL_HEADER_OFFSETrrirrrrrrrrMAX_EXTRACT_VERSIONr>rrrrrrrr7rrN)rrGrbsize_cd	offset_cdconcatinferredrcrcentdirrNflagsrtds               rrzZipFile._RealGetContentsQs
W	7 __FF	7	7	75666	7	75666:>>&MMM#;'	|,

&09<.!%777'*AABF:>>	)H+Y&III"V+>A?@@@
"""www
Z

googgn--G7||~-- !>???m$4g>>G}%)999 !IJJJzA~~gwww':;<<HM*E))
N#??733$??4+A+LWMM!!Aggg&<=>>AG(: ;<<AI%&=>AO5<AbDM
2Q
q0A1:
[!/1a
UAOQ[ #666)*A+,+<r+A+CDDD9@B6AHaoqAKT4K!Q$QtVrEAqD$;41?AK
NNo6AOM  ###*+DOAJ'^+g6I.JJ567123EzA~~gu%%%[goooooos3c$d|jDS)z+Return a list of file names in the archive.cg|]	}|j
Srr).0rcs  r
<listcomp>z$ZipFile.namelist.<locals>.<listcomp>s888$
888rrrs rnamelistzZipFile.namelists88$-8888rc|jS)zJReturn a list of class ZipInfo instances for files in the
        archive.r rs rinfolistzZipFile.infolist}rctddz||jD]5}d|jddz}td|j||jfz|6dS)z+Print a table of contents for the zip file.z%-46s %19s %12s)z	File NamezModified    SizerWz%d-%02d-%02d %02d:%02d:%02dNr&z
%-46s %s %12d)rrrrNr)rrWrdates    rprintdirzZipFile.printdirs
"GG				]		E05?2A23FFD/U^T5?$KK




		rcd}|jD]z}	||jd5}||r	||dddn#1swxYwYb#t$r|jcYcSwxYwdS)z%Read all the files and check the CRC.irN)rrMrNrJr)r
chunk_sizerfs    rtestzipzZipFile.testzips
]	&	&E
&YYu~s33q&&,,&&,,
&
&
&~%%%%%
&	&	&s4A,,A A, A$	$A,'A$	(A,,BBcb|j|}|td|z|S)z,Return the instance of ZipInfo given 'name'.Nz(There is no item named %r in the archive)rrKeyError)rrinfos   rgetinfozZipFile.getinfos@""4((<:TACC
Crc|r9t|ts$tdt|jz|r	||_dSd|_dS)z)Set default password for encrypted files.pwd: expected bytes, got %sN)rr	TypeErrorrrr)rrs  rsetpasswordzZipFile.setpasswordsX	Pz#u--	P9DII<NNOOO	DHHHDHHHrc|jS)z.The comment text associated with the ZIP file.)rrs rrzZipFile.commentr$rc(t|ts$tdt|jzt|tkr2ddl}|dtzd|dt}||_	d|_
dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesr"
stacklevelT)rrr4rrr6ZIP_MAX_COMMENTwarningswarnrr)rrr;s   rrzZipFile.comments'5))	X=W

@VVWWWw<</))OOOMMO+,89

;
;
;../G
rc||d|5}|cdddS#1swxYwYdS)zReturn file bytes for name.rNrMrJ)rrrrGs    rrJzZipFile.reads
YYtS#
&
&	"7799																		s
9==Fforce_zip64c4|dvrtd|r|dkrtdjstdt|tr|}nC|dkr(t|}j|_j|_n|}|dkr	||Sj
rtdxjdz
c_tj|j
jjfd	}	|t"}t%|t"krt'd
t)jt,|}|t.t0krt'd||t2}|t4r ||t4|jt8zrt;d|jt<zrt;d
|t>t@zr|!d}	n|!j"pd}	|	|j#krt'd|j#d|d|jtHz}
|
rY|sj%}|r9t|tLs$tOdtQ|j)z|stUd|znd}tW||||dS#|,xYw)auReturn 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.
        >rrzopen() requires mode "r" or "w"rz'pwd is only supported for reading filesz2Attempt to use ZIP archive that was already closedr?r`r!cjSr)rUrsr<lambda>zZipFile.open.<locals>.<lambda>s	$-rzTruncated file headerz Bad magic number for file headerz$compressed patched data (flag bit 5)zstrong encryption (flag bit 6)rrzFile name in directory z and header z differ.r3z6File %r is encrypted, password required for extractionNT)-rrGrrr?rrGrr1_open_to_writerUrrOrrrTrJsizeFileHeaderr6rrSr5r
_FH_SIGNATUREr_FH_FILENAME_LENGTH_FH_EXTRA_FIELD_LENGTHr_MASK_COMPRESSED_PATCHr>_MASK_STRONG_ENCRYPTION_FH_GENERAL_PURPOSE_FLAG_BITSrrrr_MASK_ENCRYPTEDrrr4rrr<rsrY)rrrrr@rzef_filefheaderfname	fname_stris_encrypteds`          rrMzZipFile.opensr z!!>???	HDCKKFGGGw	FDFF
FdG$$		'EE
S[[DMME"&"2E#'#5E  LL&&E3;;&&u+&FFF=	GFGG
G
	
Atw(;#}dj:O:O:O:OQQ0	mmN33G7||~-- !8999m$4g>>G}%)999 !CDDDMM'*=">??E-.
?

g&<=>>>!77
R)*PQQQ!88
L)*JKKK458JJ
L!LL11		!LL)?)J7KK	E/// j***EEE3444
!?_<L	
#(CXz#u55X#$ADIIDV$VWWWI&(ACG(HIIIIheS$???	NNs
G4LLc|r|jstd|jrtdd|_d|_d|_|jtkr|xjtzc_|j	s|xjtzc_|jsd|_|p|jdztk}|js|rtd|j	r|j|j|j|_||d|_|j||d|_t1|||S)NzHforce_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.rg?z'Filesize would require ZIP64 extensionsT)rrrUrrrrr	_MASK_COMPRESS_OPTION_1rrrrrrrGrQrrtr_writecheckrrmrr)rrr@rs    rrDzZipFile._open_to_writeKs{	t/	 
=	ONOO
O
 	(**OO66OO~	9OO88OO"	."-EE$ 6 D	JE	JHIII>	)GLL((("gllnn

e&&u--...
T5%000rc|tj}ntj|}||||S)a#Extract a member from the archive to the current working directory,
           using its full name. Its file information is extracted as accurately
           as possible. `member' may be a filename or a ZipInfo object. You can
           specify a different directory using `path'.
        )rgetcwdr_extract_member)rmemberrrs    rextractzZipFile.extractus;<9;;DD9T??D##FD#666rc||}|tj}ntj|}|D]}||||dS)zExtract 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().
        N)r!rrWrrX)rrmembersrrs     r
extractallzZipFile.extractallsi?mmooG<9;;DD9T??D	5	5G  $4444	5	5rc&|j}|s4d}t|dt|z}||_||}d||D}|d|D}|S)z;Replace bad characters and remove trailing dots from parts.z:<>|"?*_c3@K|]}|dVdS)rN)rstriprrs  r	<genexpr>z1ZipFile._sanitize_windows_name.<locals>.<genexpr>s,AAQ188C==AAAAAArc3K|]}||V	dSrrrbs  rrcz1ZipFile._sanitize_windows_name.<locals>.<genexpr>s'77QQ7q777777r)!_windows_illegal_name_trans_tabler	maketransr6	translatesplitr8)rrpathseptableillegals     r_sanitize_windows_namezZipFile._sanitize_windows_names5	:GMM'3W+=>>E49C1##E**AA'--*@*@AAA,,77'77777rcrt|ts||}|jdt
jj}t
jjr4|t
jjt
jj}t
j	|d}dt
jj
t
jjft
jjfd|
t
jjD}t
jjdkr%||t
jj}t
j||}t
j|}t
j|}|r3t
j|stj||r5t
j|stj||S|||5}t-|d5}t/j||dddn#1swxYwYdddn#1swxYwY|S)	zbExtract the ZipInfo object 'member' to a physical
           file on the path targetpath.
        rr!rc3$K|]
}|v|VdSrr)rrinvalid_path_partss  rrcz*ZipFile._extract_member.<locals>.<genexpr>s>#C#C&'/A&A&A$%&A&A&A&A#C#Cr\rrN)rrr1rNrrrrrrcurdirpardirr8rhrlrdirnameexistsmakedirsrrmkdirrMshutilcopyfileobj)	rrY
targetpathrr	upperdirssourcetargetros	        @rrXzZipFile._extract_members&'**	*\\&))F/))#rw{;;
7>	CoobgnbgkBBG'$$W--a0 "'."'.A'+""#C#C#C#CgmmBGK.H.H#C#C#CCC
7;$11'27;GGGW\\*g66
W%%j11
GOOJ//		#RW^^I66	#K	"""==??	7==,,
%$$$
YYv3Y
'
'	/6
*d
#
#	/'-vv...	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/s6"J,3J	J,J	J,J	J,,J03J0c|j|jvr#ddl}|d|jzd|jdvrtd|jstdt|j|j	s[d}t|jtkrd	}n%|j
tkrd
}n|jtkrd}|rt!|dzdSdS)
z6Check for errors before writing a file to the archive.rNzDuplicate name: %rr#r8rrrz&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closedFiles countFilesizezZipfile size would require ZIP64 extensions)rNrr;r<rrrGr@rrr6rZIP_FILECOUNT_LIMITrrrr)rrr;requires_zip64s    rrUzZipFile._writechecks>T_,,OOOMM.?AMNNN9O++EFFFw	HFHH
H5.///
	F!N4=!!%888!.;..!+${22!/
F">#D$EFFF
	F
	F
F
FrcF|jstd|jrtdt|||j}|r%d|_d|_|	|dS|||_
n|j|_
|||_n|j
|_t|d5}||d5}tj||ddddn#1swxYwYddddS#1swxYwYdS)	zLPut 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 existsrrNrKri )rGrrUrrrrrrrwrr?rrGrMrxry)rrNrrrGrsrcdests        rrmz
ZipFile.writesw	KIKK
K=	P
!!(G484K"MM<<>>	6"#EEIJJu(&3##&*&6#('4$$'+'9$h%%
6diis.C.C
6t"3f555
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6s6DC>2D>D	DD	DDDct|tr|d}t|tst|t	jt	jdd}|j|_|j|_	|j
ddkrd|_|xjdzc_n
d	|_n|}|jstd
|jrtd|||_|||_	t||_|j5||d
5}||dddn#1swxYwYddddS#1swxYwYdS)aWrite 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.rNr&)rNrrriAr-rSrz?Can't write to ZIP archive while an open writing handle exists.r)r)rrrrrrr?rrGrrNrrGrrUr6rrTrMrm)rzinfo_or_arcnamercrrGrrs       rwritestrzZipFile.writestrsdC  	(;;w''D*G44	%%5&*nTY[[&A&A"1"&EGGGE"&"2E#'#5E ~b!S((&3###t+###&1##$Ew	KIKK
K=	Q
$"/E$#0E d))
Z	!	!5s++
!t

4   
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!s6 E28EE2E	E2!E	"E22E69E6ct|tr&|}|stdnt|tra|}|ds|dz
}t|}d|_d|_d|zdzdz|_d|_	|xjdzc_ntd|j5|jr|j
|j|j
|_|jt&kr|xjt*zc_||d|_|j|||j|j<|j
|d	|j
|_d
d
d
d
S#1swxYwYd
S)z+Creates a directory inside the zip archive.z/The given ZipInfo does not describe a directoryrri@rr-zExpected type str or ZipInfoTFN)rrrrrendswithrrrrr4rTrrGrQrrtrrr	rrTrUrrr7rrNrmr)rzinfo_or_directory_namerrdirectory_names     rrwz
ZipFile.mkdir-s-w77	<+E<<>>
T !RSSS
T
/
5
5	<4N!**3//
&#%N++E"#EEI$+dNf#<"CEEO4':;;;
Z	,	,~
-T^,,,"&',,..E"h..#::U###"DOM  '''.3DOEN+GMM%**511222!W\\^^DN	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,sC:GGGc.|dS)z2Call the "close()" method in case the user forgot.Nrrs r__del__zZipFile.__del__Ps

rc|jdS|jrtd	|jdvr`|jrY|j5|jr|j|j|	dddn#1swxYwY|j}d|_|
|dS#|j}d|_|
|wxYw)zOClose 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)rGrUrrrrTrrQr_write_end_recordrrks  rrYz
ZipFile.closeTs/7?F=	QPQQ
Q		yO+++Z--~5T^444**,,,---------------
BDGMM"BDGMM"s.B/;A?3B/?BB/BB//%CcR	|jD]}|j}|ddz
dz|ddzz|dz}|ddz|d	dzz|ddzz}g}|jtks|jtkr9||j||jd
}d
}n|j}|j}|jtkr||jd
}n|j}|j}	d}
|rQt|	d}	tj
dd
t|zzddt|zg|R|	z}	t}
|j
tkrtt |
}
n%|j
t"krtt$|
}
t|
|j}t|
|j}|\}
}tj
t,t.||j||j||j
|||j||t|
t|	t|jd|j|j|}|j||j|
|j|	|j|j|j }t|j}||j!z
}|j!}d}|tDkrd}n|tkrd}n
|tkrd}|r|j#stI|dztj
tJtLddddd||||}|j|tj
tNtPd|d}|j|tS|d}tS|d
}tS|d
}tj
tTtVdd||||t|j,		}|j||j|j,|j-dkr|j.|j/dS)Nrrr(r!r%r"r#r*r$rrr2QrrzCentral directory offsetzCentral directory sizer,rrr)0rrrrrr7rr9rBrSrr6rrrryrr	rrrirr
rrrrrrrrGrmrtrrrrrWrXrTrUrrwrvrrtruncater!)rrrrrr9rrr
extra_datarrrirNrrpos2centDirCountcentDirSize
centDirOffsetrzip64endreczip64locrecrbs                        rrzZipFile._write_end_recordjsw]3	)3	)EB!ut|)BqEQJ6A>GerkBqEQJ."Q%1*=GE,,%33U_---U0111&	 *

!O	 % 3
"[00U0111 *

 % 3
JK
,)*d;;
#[CE

N*qU|-&+---/9:
,"i//!-==$00!,<<!+u/DEEO e.BCCN"'"<"<">">Hik"2"2N"'"5"+U-@'7"')]I"%h--Z#emBTBT"#U%8%:M"/11G
GMM'"""GMM(###GMM*%%%GMM%-((((w||~~4=))T^+
---*NN
[
(
(7NN
;
&
&5N	;#
F">#D$EFFF +"$6BAq,],,K
GMM+&&& +))1dA77K
GMM+&&&|V44Lk:66K
z::M-/?<(-T]9K9KMM	


f

dm$$$9G

rcr|xjdzc_|js|js|dSdSdS)Nr!)rrrYrks  rrzZipFile._fpclosesPA	(8	HHJJJJJ				rr)rN)F)NN)NNN)r)%rrrrrGrerrrrrrr!r#r)r-r1r5rrsetterrJrMrDrZr]rrlrXrUrmrrwrrYrrrrrrrsx,
B(,%"%:$#^:>RV^^^^^@M&M&M&`999
&&&X
^

^

`E`````D(1(1(1(1T77775555"[(((TFFF.'+046666D48'!'!'!'!R!,!,!,!,F,\\\|rrc0eZdZdZdeddfdZd
dZd	ZdS)r
zDClass to create ZIP archives with Python library files and packages.rTrcRt|||||||_dS)N)rr?r)rr	_optimize)rrWrr?roptimizes      rrzPyZipFile.__init__s5t$K$.		0	0	0!rrNc`tj|}|rL||sA|jr8tj|rdnd}t|d|ddStj|\}}tj|rtj|d}tj|r|r|d|}n|}|jrtd|d	||	|d
d|\}}	|jrtd|	|
||	ttj|}
|

d|
D]5}tj||}tj|\}
}tj|rVtjtj|dr||||
|dkru|r%||s|jrtd|z|	|d
d|\}}	|jrtd|	|
||	7dS|jrtd|ttj|D]}tj||}tj|\}
}|dkru|r%||s|jrtd|zq|	|d
d|\}}	|jrtd|	|
||	dS|dddkrt!d|	|d
d|\}}	|jrtd|	|
||	dS)aAdd 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.
        rrW z skipped by filterfuncNz__init__.pyrzAdding package inasrAdding)
filterfunc.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"zAdding file)rrrrrrrhr8isfile
_get_codenamermsortedlistdirremovesplitextwritepyr<)rpathnamebasenamerlabeldirrinitnamerOrdirlistrNrrootexts               rrzPyZipFile.writepys[9X&&	jj22	z
I"$'--"9"9EvuuuhhhGHHHFGMM(++	T
7=="";	'w||Hm<<Hw~~h''1
3$*2((DD9HH#H:I-xxHHH!%!3!3HQrTNH!M!Mw:-(G,,,

5'*** H!5!566}--- '33H7<<(;;D " 0 0 : :ID#w}}T**37>>"',,t]*K*KLL@ LLx4>)@@@%%jj.>.>%#zN %&E&L M M M$)-););D2J<D*F*Fw:5!(G444

5'222#33(:C7BBB &rz(';'; < <33H7<<(;;D " 0 0 : :ID#e||%%jj.>.>%#zN %&E&L M M M$)-););D2J<D*F*Fw:5!(G444

5'22233}%%"DFFF!//2IINE7z
.mW---JJug&&&&&rc8d
fd	}|dz}|dz}tj|d}tj|d}tj|d}jdkrtj|r:t	j|jt	j|jkr|x}	}
ntj|r:t	j|jt	j|jkr|}
|}	ntj|r:t	j|jt	j|jkr|}
|}	n^tj|r:t	j|jt	j|jkr|}
|}	n||r5tj
jd	kr|}
ntj
jdkr|}
n|}
|}	n|x}
}	njd	kr|}
|}	nG|}	jdkr|}
n7jdkr|}
n)d
j}t|tj|
r4t	j|
jt	j|jks||js|x}
}	tj|	d}|r|d|}|
|fS)aReturn (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).
        rcddl}jrtd|	||d|n,#|j$r}t|jYd}~dSd}~wwxYwdS)Nr	CompilingT)doraiserF)
py_compilerrcompilePyCompileErrormsg)rWrrerrrs    r_compilez)PyZipFile._get_codename.<locals>._compile1sz
)k4(((
""4"IIII,


cguuuuu
4s7
A AA rz.pycr)optimizationr!r"rz"invalid value for 'optimize': {!r})rrrf)	importlibutilcache_from_sourcerrrrrrrrrformatrrh)
rrrrfile_pyfile_pycpycache_opt0pycache_opt1pycache_opt2rrOrarchivenames
`            rrzPyZipFile._get_codename*s												e#f$ ~77b7QQ ~77a7PP ~77a7PP>Rx((!
.'(##,0@0@0III"**%%'....
.',''0BGG4D4D4MMM%"'....
.',''0BGG4D4D4MMM%"'....
.',''0BGG4D4D4MMM%"8G$$	.y)Q.. ,+q00 , ,&GG&--EGG~""$"">Q&&(EE^q(((EE>EEdnUUC$S//)GNN5))
.GENN+rww/?/?/HHHx$.AAA.&--EGgmmG,,Q/	<%-XX{{;K{##r)rN)rrrrrrrrrrrr
r
seNN"%: 2""""P'P'P'P'dP$P$P$P$P$rr
cHtjt|ddS)a2
    Given a path with elements separated by
    posixpath.sep, generate all parents of that path.

    >>> list(_parents('b/d'))
    ['b']
    >>> list(_parents('/b/d/'))
    ['/b']
    >>> list(_parents('b/d/f/'))
    ['b/d', 'b']
    >>> list(_parents('b'))
    []
    >>> list(_parents(''))
    []
    r!N)	itertoolsislice	_ancestry)rs r_parentsr}s IdOOQ555rc#K|tj}|r?|tjkr3|Vtj|\}}|r|tjk-dSdSdSdS)aR
    Given a path with elements separated by
    posixpath.sep, generate all elements of that path

    >>> list(_ancestry('b/d'))
    ['b/d', 'b']
    >>> list(_ancestry('/b/d/'))
    ['/b/d', '/b']
    >>> list(_ancestry('b/d/f/'))
    ['b/d/f', 'b/d', 'b']
    >>> list(_ancestry('b'))
    ['b']
    >>> list(_ancestry(''))
    []
    N)ra	posixpathrrh)rtails  rrrs ;;y}%%D
+49=((


_T**
d+49=((((++++((rcPtjt|j|S)zZ
    Return items in minuend not in subtrahend, retaining order
    with O(1) lookup.
    )rfilterfalseset__contains__)minuend
subtrahends  r_differencers 
 Z!=wGGGrcdeZdZdZedZfdZdZdZfdZ	e
dZxZS)CompleteDirszk
    A ZipFile subclass that ensures that implied directories
    are always included in the namelist.
    ctjtt|}d|D}tt
||S)Nc34K|]}|tjzVdSr)rr)rr
s  rrcz-CompleteDirs._implied_dirs.<locals>.<genexpr>s)661y}$666666r)rchain
from_iterablerr_deduper)namesparentsas_dirss   r
_implied_dirszCompleteDirs._implied_dirssL///He0D0DEE66g666{7E22333rctt|}|t||zSr)rrr!rxr)rrrs  rr!zCompleteDirs.namelists?lD))2244tD..u556666rcDt|Sr)rr!rs r	_name_setzCompleteDirs._name_sets4==??###rcP|}|dz}||vo||v}|r|n|S)zx
        If the name represents a directory, return that name
        as a directory (with the trailing slash).
        r)r)rrrrt	dir_matchs     rresolve_dirzCompleteDirs.resolve_dirs?
  *%:'U*:	#-ww-rc	t|S#t$r?|dr||vrt|cYSwxYw)z6
        Supplement getinfo for implied dirs.
        rr)rr1r/rrr)rrrs  rr1zCompleteDirs.getinfos{	*77??4(((	*	*	*==%%
T^^5E5E)E)ED))))))	*s $AA-,A-ct|tr|St|ts||Sd|jvrt}||_|S)zl
        Given a source (filename or zipfile), return an
        appropriate CompleteDirs subclass.
        r)rrrrr)rr|s  rmakezCompleteDirs.makes\fl++	M&'**	3v;;fk!!C
r)
rrrrstaticmethodrr!rrr1rrrrs@rrrs
44\4
77777$$$...	*	*	*	*	*[rrc,eZdZdZfdZfdZxZS)
FastLookupzV
    ZipFile subclass to ensure implicit
    dirs exist and are resolved rapidly.
    ctjt5|jcdddS#1swxYwYt	t
||_|jSr)
contextlibsuppressr_FastLookup__namesrrr!rs rr!zFastLookup.namelists

 
0
0	 	 <	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 Z..7799|/33ctjt5|jcdddS#1swxYwYt	t
||_|jSr)rrr_FastLookup__lookuprrrrs rrzFastLookup._name_sets

 
0
0	!	!=	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!j$//99;;
}r)rrrrr!rrrs@rrrs[
rrc2tj|d||fS)Nr#)r
text_encoding)encodingargskwargss   r_extract_text_encodingr	s
Ha(($66rceZdZdZdZddZddddZd	Zed
Z	edZ
edZed
ZedZ
dZdZdZdZdZdZdZdZdZdZdZeZedZdS)ru,
    A pathlib-compatible interface for zip files.

    Consider a zip file with this structure::

        .
        ├── a.txt
        └── b
            ├── c.txt
            └── d
                └── e.txt

    >>> data = io.BytesIO()
    >>> zf = ZipFile(data, 'w')
    >>> zf.writestr('a.txt', 'content of a')
    >>> zf.writestr('b/c.txt', 'content of c')
    >>> zf.writestr('b/d/e.txt', 'content of e')
    >>> zf.filename = 'mem/abcde.zip'

    Path accepts the zipfile object itself or a filename

    >>> root = Path(zf)

    From there, several path operations are available.

    Directory iteration (including the zip file itself):

    >>> a, b = root.iterdir()
    >>> a
    Path('mem/abcde.zip', 'a.txt')
    >>> b
    Path('mem/abcde.zip', 'b/')

    name property:

    >>> b.name
    'b'

    join with divide operator:

    >>> c = b / 'c.txt'
    >>> c
    Path('mem/abcde.zip', 'b/c.txt')
    >>> c.name
    'c.txt'

    Read text:

    >>> c.read_text()
    'content of c'

    existence:

    >>> c.exists()
    True
    >>> (b / 'missing.txt').exists()
    False

    Coercion to string:

    >>> import os
    >>> str(c).replace(os.sep, posixpath.sep)
    'mem/abcde.zip/b/c.txt'

    At the root, ``name``, ``filename``, and ``parent``
    resolve to the zipfile. Note these attributes are not
    valid and will raise a ``ValueError`` if the zipfile
    has no filename.

    >>> root.name
    'abcde.zip'
    >>> str(root.filename).replace(os.sep, posixpath.sep)
    'mem/abcde.zip'
    >>> str(root.parent)
    'mem'
    z>{self.__class__.__name__}({self.root.filename!r}, {self.at!r})rcRt||_||_dS)aX
        Construct a Path from a ZipFile or filename.

        Note: When the source is an existing ZipFile object,
        its type (__class__) will be mutated to a
        specialized type. If the caller wishes to retain the
        original type, the caller should either create a
        separate ZipFile object or pass a filename.
        N)rrrat)rrrs   rrz
Path.__init__V	s"OOD))	rrNrqcl|rt||d}|s|dkrt||j|j||}d|vr|s|rtd|St|i|\}}}tj
||g|Ri|S)z
        Open this entry as text or binary following the semantics
        of ``pathlib.Path.open()`` by passing arguments through
        to io.TextIOWrapper().
        rrrqbz*encoding args invalid for binary operation)rIsADirectoryErrorruFileNotFoundErrorrrMrrrr
TextIOWrapper)rrrrrzip_modestreamrs        rrMz	Path.openc	s;;==	*#D)))7{{}}	*S#D)))s;;$;;
Ov
O !MNNNM!7!H!H!H$B4BBB6BBBrcLtj|jp|jjSr)pathlib
PurePosixPathrrrNrs r_basez
Path._basew	s$TW%B	0BCCCrc4|jSr)rrrs rrz	Path.namez	zz||  rc4|jSr)rsuffixrs rrzPath.suffix~	szz||""rc4|jSr)rsuffixesrs rrz
Path.suffixes	szz||$$rc4|jSr)rstemrs rrz	Path.stem	rrcntj|jj|jSr)rrrrNjoinpathrrs rrNz
Path.filename	s'|DI.//88AAArct|i|\}}}|jd|g|Ri|5}|cdddS#1swxYwYdS)Nr)rrMrJ)rrrrstrms     r	read_textzPath.read_text	s!7!H!H!H$
TYsH
6t
6
6
6v
6
6	$99;;																		sAAAc|d5}|cdddS#1swxYwYdS)NrKr>)rrs  r
read_byteszPath.read_bytes	s~
YYt__	99;;																		s7;;ctj|jd|jdkSNr)rrtrra)rrs  r	_is_childzPath._is_child	s4 !4!4559L9LLLrc8||j|Sr)rr)rrs  r_nextz
Path._next	s~~di,,,rcF|jp|jdSr")rrrs rrzPath.is_dir	s!7{3dg..s333rcT|o|Sr)rurrs ris_filezPath.is_file	s {{}}2T[[]]!22rcB|j|jvSr)rrrrs rruzPath.exists	sw$)--////rc|stdt|j|j}t
|j|S)NzCan't listdir a file)rrrr%rr!filterr#)rsubss  riterdirzPath.iterdir	sR{{}}	534444:ty113344dnd+++rcJtj|jj|jSr)rr8rrNrrs r__str__zPath.__str__	s~di0$':::rc8|j|S)Nr)_Path__reprrrs rrz
Path.__repr__	s{!!t!,,,rctj|jg|R}||j|Sr)rr8rr%rr)rothernexts   rrz
Path.joinpath	s=~dg....zz$)//55666rc|js|jjStj|jd}|r|dz
}||Sr")rrNparentrrtrar%)r	parent_ats  rr6zPath.parent	sYw	(=''%dgnnS&9&9::		Izz)$$$r)r)r)rrrrr1rrMrrrrrrrNrr r#r%rr(rur-r/rr__truediv__r6rrrrr	sKKZNFCCCCCC(DDD!!X!##X#%%X%!!X!BBXB
MMM---444333000,,,;;;---777K
%%X%%%rrcddl}d}||}|d}|dddd	
|ddd
dd|ddddd|dddd
|ddd
||}|j}|jz|j}t|d|5}|}dddn#1swxYwY|r"td
|tddS|jH|j}t|d|5}|ddddS#1swxYwYdS|j
L|j
\}}	t|d|5}||	ddddS#1swxYwYdS|j|r/td t j!t!jd"|jd}
|j}fd#t|
d$5}|D]}t(j|}
|
s<t(jt(j|}
|
d%t(jt(jfvrd%}
|||
	ddddS#1swxYwYdSdS)&Nrz3A simple command-line interface for zipfile module.)descriptionT)requiredz-lz--list	<zipfile>zShow listing of a zipfile)metavarhelpz-ez	--extractr")r<z<output_dir>zExtract zipfile into target dir)nargsr=r>z-cz--create+)z<name>z<file>zCreate zipfile from sourcesz-tz--testzTest if a zipfile is validz--metadata-encodingz
<encoding>z2Specify encoding of member names for -l, -e and -tr)rz.The following enclosed file is corrupted: {!r}zDone testingz/Non-conforming encodings not supported with -c.r'r!c	tj|r|||tdStj|r|r|||t
tj|D]M}|tj||tj||LdSdSr)	rrrrmrrrrr8)rrzippathnmaddToZips    rrDzmain.<locals>.addToZip	sw~~d##
Pw55555t$$
P,HHT7+++ D!1!122PPBHRW\\$33RW\\'25N5NPPPP	
P
PPPrrr)argparseArgumentParseradd_mutually_exclusive_groupadd_argument
parse_argsrtestrr-rrrxr)rZr]createrstderrexitpoprrrrtrrrs)rrEr:parsergrouprrrbadfilerrzip_namefilesrrBrDs              @rmainrT	sOOOGK

$
$
$
=
=F///>>E	tX{7999	t[<=???
tZs39;;;
tX{8:::
-|QSSST""D%Hyi
S#
:
:
:	#bjjllG	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	TBII'RRSSS
n	
	i
S#
:
:
:	bKKMMM																		
	!lV
S#
:
:
:	"bMM&!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"
	 	Cz
#
#
#
#HQKKK;??1%%	P	P	P	P	PXs
#
#	,r
,
,'**400F g..rwt/D/DEEGr29bi888 GT7++++

,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,)
!	 sI.DDD/FFFG$$G(+G( B
K;;K?K?__main__r)rbinasciiimportlib.utilrrrrrrxrrSrrrrrr;rImportErrorr=r__all__	Exceptionrrrrrrr:rrrr	rrrrrrwrvrrurYrZr[r\r]r^r_r{rrr
rr	r_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
rr_CD_DISK_NUMBER_START_CD_INTERNAL_FILE_ATTRIBUTES_CD_EXTERNAL_FILE_ATTRIBUTESrrLrTrrIrJrrrrErF_FH_EXTRACT_VERSION_FH_EXTRACT_SYSTEMrK_FH_COMPRESSION_METHOD_FH_LAST_MOD_TIME_FH_LAST_MOD_DATE_FH_CRC_FH_COMPRESSED_SIZE_FH_UNCOMPRESSED_SIZErGrHrTrUrRrWrXrV_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_CENTDIRrStructr4rBrHr
rqrDobjectrr
rrrr#rr@rHrMrOrhrrsrrr
rrdictfromkeysrrrrrrrTrrrr<module>r~s;
								











KKKJEEDNEEEJJJJ
CCCKKKKDDD
								9 
#
	


  !122
	
$  !122


!! 
#  
"  !122
 !
%))&/*CDD"""6?#566!"
#fmE*** (((V:::zV(V(V(V(V(vV(V(V(z
	 ###L"""""""".8wxxx	
xx
yzy{	 	!"#(NNN&



 PPP$%!%!%!%!%!%!%!%!P(FFFFF"FFFR
P+P+P+P+P+B%P+P+P+hIIIIIIIIXk$k$k$k$k$k$k$k$\666&+++,-/HHH999997999x&7777
y%y%y%y%y%y%y%y%xC,C,C,C,LzDFFFFFs5AAAA""A,+A,0A55A?>A?