/snap/core18/2999/usr/lib/python3.6/__pycache__
NameSizeModeActions
abc.cpython-36.pyc75150644editdlrm
aifc.cpython-36.pyc259430644editdlrm
antigravity.cpython-36.pyc7790644editdlrm
argparse.cpython-36.pyc604560644editdlrm
ast.cpython-36.pyc117040644editdlrm
asynchat.cpython-36.pyc68150644editdlrm
asyncore.cpython-36.pyc158380644editdlrm
base64.cpython-36.pyc170590644editdlrm
bdb.cpython-36.pyc170330644editdlrm
binhex.cpython-36.pyc120860644editdlrm
bisect.cpython-36.pyc26760644editdlrm
bz2.cpython-36.pyc112820644editdlrm
calendar.cpython-36.pyc258820644editdlrm
cgi.cpython-36.pyc284160644editdlrm
cgitb.cpython-36.pyc100800644editdlrm
chunk.cpython-36.pyc49000644editdlrm
cmd.cpython-36.pyc125750644editdlrm
code.cpython-36.pyc98360644editdlrm
codecs.cpython-36.pyc339000644editdlrm
codeop.cpython-36.pyc62700644editdlrm
colorsys.cpython-36.pyc33110644editdlrm
compileall.cpython-36.pyc82780644editdlrm
configparser.cpython-36.pyc452440644editdlrm
contextlib.cpython-36.pyc111580644editdlrm
copy.cpython-36.pyc70790644editdlrm
copyreg.cpython-36.pyc42440644editdlrm
cProfile.cpython-36.pyc42940644editdlrm
crypt.cpython-36.pyc22420644editdlrm
csv.cpython-36.pyc118550644editdlrm
datetime.cpython-36.pyc545110644editdlrm
decimal.cpython-36.pyc3510644editdlrm
difflib.cpython-36.pyc596420644editdlrm
dis.cpython-36.pyc141810644editdlrm
doctest.cpython-36.pyc755890644editdlrm
dummy_threading.cpython-36.pyc11020644editdlrm
enum.cpython-36.pyc234530644editdlrm
filecmp.cpython-36.pyc83050644editdlrm
fileinput.cpython-36.pyc131520644editdlrm
fnmatch.cpython-36.pyc28740644editdlrm
formatter.cpython-36.pyc175790644editdlrm
fractions.cpython-36.pyc184260644editdlrm
ftplib.cpython-36.pyc283570644editdlrm
functools.cpython-36.pyc240620644editdlrm
genericpath.cpython-36.pyc37260644editdlrm
getopt.cpython-36.pyc62170644editdlrm
getpass.cpython-36.pyc41770644editdlrm
gettext.cpython-36.pyc143060644editdlrm
glob.cpython-36.pyc42590644editdlrm
gzip.cpython-36.pyc162260644editdlrm
hashlib.cpython-36.pyc66920644editdlrm
heapq.cpython-36.pyc142920644editdlrm
hmac.cpython-36.pyc48360644editdlrm
imaplib.cpython-36.pyc421380644editdlrm
imghdr.cpython-36.pyc41500644editdlrm
imp.cpython-36.pyc96960644editdlrm
inspect.cpython-36.pyc797390644editdlrm
io.cpython-36.pyc33870644editdlrm
ipaddress.cpython-36.pyc623860644editdlrm
keyword.cpython-36.pyc17650644editdlrm
linecache.cpython-36.pyc37780644editdlrm
locale.cpython-36.pyc340300644editdlrm
lzma.cpython-36.pyc119920644editdlrm
macpath.cpython-36.pyc56410644editdlrm
macurl2path.cpython-36.pyc18670644editdlrm
mailbox.cpython-36.pyc637520644editdlrm
mailcap.cpython-36.pyc72090644editdlrm
mimetypes.cpython-36.pyc155530644editdlrm
modulefinder.cpython-36.pyc153660644editdlrm
netrc.cpython-36.pyc38360644editdlrm
nntplib.cpython-36.pyc337800644editdlrm
ntpath.cpython-36.pyc131900644editdlrm
nturl2path.cpython-36.pyc14990644editdlrm
numbers.cpython-36.pyc121420644editdlrm
opcode.cpython-36.pyc54130644editdlrm
operator.cpython-36.pyc139130644editdlrm
optparse.cpython-36.pyc480540644editdlrm
os.cpython-36.pyc296280644editdlrm
pathlib.cpython-36.pyc420070644editdlrm
pdb.cpython-36.pyc460940644editdlrm
pickle.cpython-36.pyc426910644editdlrm
pickletools.cpython-36.pyc660200644editdlrm
pipes.cpython-36.pyc78080644editdlrm
pkgutil.cpython-36.pyc162610644editdlrm
platform.cpython-36.pyc291970644editdlrm
plistlib.cpython-36.pyc280550644editdlrm
poplib.cpython-36.pyc133290644editdlrm
posixpath.cpython-36.pyc104560644editdlrm
pprint.cpython-36.pyc158240644editdlrm
profile.cpython-36.pyc139010644editdlrm
pstats.cpython-36.pyc218570644editdlrm
pty.cpython-36.pyc38610644editdlrm
pyclbr.cpython-36.pyc83650644editdlrm
pydoc.cpython-36.pyc837750644editdlrm
py_compile.cpython-36.pyc65440644editdlrm
queue.cpython-36.pyc87550644editdlrm
quopri.cpython-36.pyc57730644editdlrm
random.cpython-36.pyc193300644editdlrm
re.cpython-36.pyc140580644editdlrm
reprlib.cpython-36.pyc54000644editdlrm
rlcompleter.cpython-36.pyc57800644editdlrm
runpy.cpython-36.pyc79820644editdlrm
sched.cpython-36.pyc65640644editdlrm
secrets.cpython-36.pyc21620644editdlrm
selectors.cpython-36.pyc176970644editdlrm
shelve.cpython-36.pyc94580644editdlrm
shlex.cpython-36.pyc69700644editdlrm
shutil.cpython-36.pyc307040644editdlrm
signal.cpython-36.pyc25150644editdlrm
site.cpython-36.pyc165600644editdlrm
sitecustomize.cpython-36.pyc2120644editdlrm
smtpd.cpython-36.pyc266830644editdlrm
smtplib.cpython-36.pyc353400644editdlrm
sndhdr.cpython-36.pyc69130644editdlrm
socket.cpython-36.pyc220130644editdlrm
socketserver.cpython-36.pyc242500644editdlrm
sre_compile.cpython-36.pyc102780644editdlrm
sre_constants.cpython-36.pyc59720644editdlrm
sre_parse.cpython-36.pyc203580644editdlrm
ssl.cpython-36.pyc369390644editdlrm
stat.cpython-36.pyc38510644editdlrm
statistics.cpython-36.pyc181740644editdlrm
string.cpython-36.pyc79640644editdlrm
stringprep.cpython-36.pyc100300644editdlrm
struct.cpython-36.pyc3120644editdlrm
subprocess.cpython-36.pyc354850644editdlrm
sunau.cpython-36.pyc169380644editdlrm
symbol.cpython-36.pyc25170644editdlrm
symtable.cpython-36.pyc104280644editdlrm
sysconfig.cpython-36.pyc159160644editdlrm
tabnanny.cpython-36.pyc69750644editdlrm
tarfile.cpython-36.pyc630850644editdlrm
telnetlib.cpython-36.pyc180970644editdlrm
tempfile.cpython-36.pyc253090644editdlrm
textwrap.cpython-36.pyc136840644editdlrm
this.cpython-36.pyc12650644editdlrm
threading.cpython-36.pyc372340644editdlrm
timeit.cpython-36.pyc116030644editdlrm
token.cpython-36.pyc33200644editdlrm
tokenize.cpython-36.pyc186470644editdlrm
trace.cpython-36.pyc194950644editdlrm
traceback.cpython-36.pyc196460644editdlrm
tracemalloc.cpython-36.pyc172290644editdlrm
tty.cpython-36.pyc10720644editdlrm
turtle.cpython-36.pyc1317510644editdlrm
types.cpython-36.pyc82010644editdlrm
typing.cpython-36.pyc733060644editdlrm
uu.cpython-36.pyc34980644editdlrm
uuid.cpython-36.pyc209180644editdlrm
warnings.cpython-36.pyc132580644editdlrm
wave.cpython-36.pyc178850644editdlrm
weakref.cpython-36.pyc191430644editdlrm
webbrowser.cpython-36.pyc157970644editdlrm
xdrlib.cpython-36.pyc83020644editdlrm
zipapp.cpython-36.pyc55340644editdlrm
zipfile.cpython-36.pyc497280644editdlrm
_bootlocale.cpython-36.pyc9800644editdlrm
_collections_abc.cpython-36.pyc287970644editdlrm
_compat_pickle.cpython-36.pyc65660644editdlrm
_compression.cpython-36.pyc41040644editdlrm
_dummy_thread.cpython-36.pyc48510644editdlrm
_markupbase.cpython-36.pyc79910644editdlrm
_osx_support.cpython-36.pyc96840644editdlrm
_pydecimal.cpython-36.pyc1634020644editdlrm
_pyio.cpython-36.pyc713860644editdlrm
_sitebuiltins.cpython-36.pyc34350644editdlrm
_strptime.cpython-36.pyc159630644editdlrm
_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.pyc187790644editdlrm
_threading_local.cpython-36.pyc64250644editdlrm
_weakrefset.cpython-36.pyc78280644editdlrm
__future__.cpython-36.pyc41670644editdlrm
__phello__.foo.cpython-36.pyc1190644editdlrm
Edit: /snap/core18/2999/usr/lib/python3.6/__pycache__/zipfile.cpython-36.pyc (49728B)
3 Nqih12@sdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z y ddl Z Wne k r|ddlZ YnXyddlZejZWne k rdZe jZYnXy ddlZWne k rdZYnXy ddlZWne k rdZYnXddddddd d d d d dg ZGdddeZGdddeZeZZdfZdhZdjZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&e j'e%Z(dZ)dZ*dZ+dZ,dZ-d Z.d!Z/d"Z0dZ1d#Z2d$Z3d%Z4e j'e3Z5dZ6dZ7dZ8dZ9dZ:d Z;d!Zd#Z?d&Z@d'ZAdZBd(ZCdZDd)ZEdZFd*ZGd+ZHd,ZId-ZJe j'eIZKdZLdZMdZNdZOdZPd ZQd!ZRd"ZSdZTd#ZUd&ZVd'ZWd.ZXd/ZYe j'eXZZd0Z[d1Z\e j'e[Z]dZ^dZ_dZ`dZadZbd Zcd!Zdd"ZedZfd#Zgd2Zhe jid3Zjd4d5Zkd6d7Zld8d Zmd9d:Znd;d<ZoGd=d d epZqGd>d?d?ZrGd@dAdAZsGdBdCdCZtdDdEdFdFdFdFdGdHdIdJdGdKdLdMdNdOdPdQZudRdSZvdTdUZwdVdWZxGdXdYdYZyGdZd[d[ZzGd\d]d]ej{Z|Gd^d_d_ej{Z}Gd`d d Z~Gdad d e~ZdkdbdcZeddkredS)lzP 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 LargeZipFilec@s eZdZdS)rN)__name__ __module__ __qualname__rr/usr/lib/python3.6/zipfile.pyr+sc@seZdZdZdS)r zu Raised when writing a zipfile, the zipfile requires ZIP64 extensions and those extensions are disabled. N)rrr__doc__rrrrr /s -.?s<4s4H2LHsPK z<4s4B4HL2L5H2LsPK z <4s2B4HL2L2HsPKz<4sLQLsPKz <4sQ2H2L4QsPKiPKzClass with attributes describing each file in the ZIP archive. orig_filenamer? date_time compress_typerar1 create_systemrVextract_versionreserved flag_bitsvolume internal_attr external_attr header_offsetCRC compress_size file_size _raw_time _end_offsetNoNamerrcCs||_|jtd}|dkr(|d|}tjdkrJtj|krJ|jtjd}||_||_|ddkrjtdt |_ d|_ d|_ t jdkrd|_nd|_t|_t|_d|_d|_d|_d|_d|_d|_dS)Nr/iz+ZIP does not support timestamps before 1980r+Zwin32r)rbfindchrossepreplacer?rc ValueErrorrrdrar1sysplatformreDEFAULT_VERSIONrVrfrgrhrirjrkrq)selfr?rcZ null_byterrr__init__hs0   zZipInfo.__init__cCsd|jj|jfg}|jtkr8|jdtj|j|j|jd?}|jd@}|rd|jdt j ||rv|jd||j }| s|j r|jd|j | s|j r|jtks|j |j kr|jd|j |jd d j|S) Nz<%s filename=%rz compress_type=%sriz filemode=%rz external_attr=%#xz file_size=%rz compress_size=%r>) __class__rr?rdrr/compressor_namesgetrkstatfilemodeis_dirrornr0)r~r@hiloisdirrrr__repr__s(         zZipInfo.__repr__NcCs||j}|ddd>|dd>B|dB}|dd>|d d>B|ddB}|jd @rfd}}}n|j}|j}|j}|j}d} |d kr|tkp|tk}|rd } |tj| dtj | d ||}|tks|tkr|st d d}d}t } |j t krtt| } n|j tkrtt| } t| |j|_t| |j|_|j\} } tjtt|j|j| |j |||||t| t| } | | |S)z-Return the per-file header as a bytes object.rir$rr!rrr&r rNzy|jjd|jfStk r8|jjd|jdBfSXdS)Nasciizutf-8i)r?encoderhUnicodeEncodeError)r~rrrrszZipInfo._encodeFilenameFlagscCsj|j}tj}xVt|dkrd|d|dd\}}|dkrR|dkrZ|d|dd}nV|dkrv|d|dd }n:|d kr|d |dd }n|d krf}ntd||fd }|jdkrt||krtd|||_|d7}|jdkrt||krtd|||_|d7}|jdkrRt||kr:td|j}|||_|d7}||dd}qWdS)Nr z|_|rd|_|jdO_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"Nrrtir) isinstancerwPathLikefspathrS_ISDIRst_modetime localtimest_mtimepathnormpath splitdriverxaltseprkrost_size)clsr?arcnamestrmtimerczinforrr from_file s(       zZipInfo.from_filecCs|jddkS)z2Return True if this archive member is a directory.rrt)r?)r~rrrr/szZipInfo.is_dir)rbr?rcrdrar1rerVrfrgrhrirjrkrlrmrnrorprqrsrrrrr)rrr)N)N) rrrr __slots__rrrrr classmethodrrrrrrr Ns: + .0 !c@s<eZdZdZddZdZddZddZd d Zd d Z dS) _ZipDecrypteraClass to handle decryption of files stored within a ZIP archive. ZIP supports a password-based form of encryption. Even though known plaintext attacks have been found against it, it is still useful to be able to get data out of such a file. Usage: zd = _ZipDecrypter(mypwd) plain_char = zd(cypher_char) plain_text = map(zd, cypher_text) cCshd}dgd}xTtdD]H}|}x6tdD]*}|d@rH|d?d@|A}q*|d?d@}q*W|||<qW|S)zGenerate a CRC-32 table. ZIP encryption uses the CRC32 one-byte primitive for scrambling some internal keys. We noticed that a direct implementation is faster than relying on binascii.crc32(). l q[rrri)range)Zpolytabler4crcr5rrr_GenerateCRCTableAs  z_ZipDecrypter._GenerateCRCTableNcCs|d?d@|j||Ad@AS)z(Compute the CRC32 primitive on one byte.ri)crctable)r~Zchrrrr_crc32Usz_ZipDecrypter._crc32cCsBtjdkrtjt_d|_d|_d|_x|D]}|j|q,WdS)NixV4igE#ixV4)rrrkey0key1key2 _UpdateKeys)r~pwdprrrrYs   z_ZipDecrypter.__init__cCsX|j||j|_|j|jd@d@|_|jddd@|_|j|jd?d@|j|_dS)Nrlirr)rrrr)r~crrrrbsz_ZipDecrypter._UpdateKeyscCs>t|tst|jdB}|||dAd?d@A}|j||S)zDecrypt a single character.rrrr)rintAssertionErrorrr)r~rkrrr__call__hs   z_ZipDecrypter.__call__) rrrrrrrrrrrrrrr4s  rc@s,eZdZddZddZddZddZd S) LZMACompressorcCs d|_dS)N)_comp)r~rrrrsszLZMACompressor.__init__cCsFtjdtji}tjtjtjtj|gd|_tjdddt ||S)Nid)filtersz|jjd|jd}|dkr>|j|j|}||_|Stjj||S)zrRead and return a line from the stream. If limit is specified, at most limit bytes will be read. r r)rrurioBufferedIOBasereadline)r~limitr4linerrrrRszZipExtFile.readlinecCsr|t|j|jkr\|j|}t||jkrJ||j|jd|_d|_n|jt|8_|j|j|jdS)z6Returns buffered bytes without advancing the position.Nri)r.rrr;)r~rchunkrrrpeekbs zZipExtFile.peekcCsdS)NTr)r~rrrreadableoszZipExtFile.readablecCs |dks|dkrL|j|jd}d|_d|_x|jsF||j|j7}q.W|S||j}|t|jkr~|j|j|}||_|S|t|j}|j|jd}d|_d|_x^|dko|j r|j|}|t|kr||_||_||d|7}P||7}|t|8}qW|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.. Nrr+)rrr_read1MAX_Nr.)r~rbufendrUrrrr;rs4   zZipExtFile.readcCs@|jdkrdSt||j|_|jr<|j|jkr      zZipExtFile.read1cCs"|js|dkrdS|jtkrH|jj}|t|krR||j|t|7}n |j|}|jtkrj|jdk|_nx|jtkrt ||j }|jj ||}|jj p|jdko|jj |_|jr||jj 7}n |jj |}|jj p|jdk|_|d|j}|jt|8_|jdkrd|_|j||S)Nrr+T)rrrrZunconsumed_tailr._read2rrr^ MIN_READ_SIZErrrrr)r~rrUrrrrs2           zZipExtFile._read1cCsj|jdkrdSt||j}t||j}|jj|}|jt|8_|sLt|jdk rft t |j|}|S)Nrr+) rr^r"minrr;r.EOFErrorrbytesmap)r~rrUrrrr!s     zZipExtFile._read2c s&z|jr|jjWdtjXdS)N)rrrsuper)r~)rrrrszZipExtFile.closei@)NFr)r)rr)r)rrrrrr"rrrrrr;rr rr!r __classcell__rr)rrrs    ! %$rcs@eZdZddZeddZddZddZfd d ZZ S) _ZipWriteFilecCs4||_||_||_t|j|_d|_d|_d|_dS)Nr) _zinfo_zip64_zipfilerrd _compressor _file_size_compress_size_crc)r~zfrrrrrrs z_ZipWriteFile.__init__cCs|jjS)N)r-r9)r~rrrrsz_ZipWriteFile._fileobjcCsdS)NTr)r~rrrwritable sz_ZipWriteFile.writablecCsf|jrtdt|}|j|7_t||j|_|jrV|jj|}|jt|7_|j j ||S)NzI/O operation on closed file.) rrzr.r/r r1r.rr0rr)r~rUnbytesrrrrs  z_ZipWriteFile.writecsX|jr dStj|jrN|jj}|jt|7_|jj||j|j _ n |j |j _ |j |j _ |j |j _|j jd@r|jrdnd}|jjtj|t|j j |j j |j j|jj|j_nn|js|j tkrtd|jtkrtd|jj|j_|jj|j j|jj|j j|j|jj|jjd|j_|jjj|j |j |jj|j j <dS)Nrzd d!d"d#Zd?d$d%Zd@d&d'ZdAd(d)Zed*d+Zd,d-Zd.d/ZdBd0d1ZdCd2d3Zd4d5Z d6d7Z!d8d9Z"d:d;Z#dS)Dr a Class with methods to open, read, write, close, list zip files. z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=True) 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. NrTcCsF|dkrtdt|||_d|_d|_i|_g|_||_||_d|_ d |_ t |t j rdt j|}t |trd|_||_d d d d d ddd}||}x^ytj|||_Wn(tk r||kr||}wYnXPqWnd|_||_t|dd|_d|_tj|_d|_d|_y|dkr*|jn|dkrd|_y|jj|_Wn2t tfk r|t!|j|_d|_d|_Yn6Xy|jj"|jWn t tfk rd|_YnXnf|dkry|j|jj"|jWn6t#k r|jj"ddd|_|jj|_YnXntdWn$|j}d|_|j$|YnXdS)z]Open the ZIP file with mode read 'r', write 'w', exclusive create 'x', or append 'a'.r:wxaz+ZipFile requires mode 'r', 'w', 'x', or 'a'FrNr+r<zw+bzx+bzr+bwbZxb)r:r;r<r=zr+bzw+bzx+brr Trz"Mode must be 'r', 'w', 'x', or 'a')r:r;r<r=)r;r<)%rzr _allowZip64 _didModifydebugr8r7rr r_commentrrwrrstr _filePassedr?rr>r9r8getattr _fileRefCnt threadingRLockr _seekabler_RealGetContentsrYr6AttributeErrorrrBr_fpclose)r~rr r allowZip64ZmodeDictrr9rrrr\s             zZipFile.__init__cCs|S)Nr)r~rrr __enter__szZipFile.__enter__cCs |jdS)N)r)r~typevalue tracebackrrr__exit__szZipFile.__exit__cCsd|jj|jjfg}|jdk rd|jr8|jd|jn|jdk rR|jd|j|jd|jn |jd|jddj|S)Nz<%s.%sz file=%rz filename=%rz mode=%rz [closed]rr) rrrr9rDr/r?r r0)r~r@rrrrs    zZipFile.__repr__cCs|j}y t|}Wntk r.tdYnX|ssz*ZipFile._RealGetContents..T)keyreverseN)7r9r7r8rrAprintrOrP _ECD_COMMENTrBrQr6rBr;rBytesIOsizeCentralDirr.rCr-structCentralDir _CD_SIGNATUREstringCentralDir_CD_FILENAME_LENGTHdecoder _CD_EXTRA_FIELD_LENGTHr1_CD_COMMENT_LENGTHra_CD_LOCAL_HEADER_OFFSETrlrVrerfrgrhrdrmrnroMAX_EXTRACT_VERSIONrrirjrkrprcrr7r/r8r?sortedrq)r~r9rTZsize_cdZ offset_cdconcatZinferredrUrTcentdirr?flagsr<tdZ end_offsetrrrrrJsx               4        zZipFile._RealGetContentscCsdd|jDS)z+Return a list of file names in the archive.cSsg|] }|jqSr)r?).0rUrrr sz$ZipFile.namelist..)r7)r~rrrnamelistszZipFile.namelistcCs|jS)zJReturn a list of class ZipInfo instances for files in the archive.)r7)r~rrrinfolistszZipFile.infolistcCsPtdd |dx:|jD]0}d|jdd}td |j||jf|dqWdS) z+Print a table of contents for the zip file.z%-46s %19s %12s File Name Modified Size)rz%d-%02d-%02d %02d:%02d:%02dNr"z %-46s %s %12d)rorprq)rXr7rcr?ro)r~rrZdaterrrprintdir!s  zZipFile.printdircCs^d}xT|jD]J}y.|j|jd}x|j|r0q$WWdQRXWq tk rT|jSXq WdS)z%Read all the files and check the CRC.rrr:Ni)r7r>r?r;r)r~Z chunk_sizerfrrrtestzip*s  zZipFile.testzipcCs$|jj|}|dkr td||S)z,Return the instance of ZipInfo given 'name'.Nz(There is no item named %r in the archive)r8rKeyError)r~r inforrrgetinfo7s   zZipFile.getinfocCs8|r"t|t r"tdt|j|r.||_nd|_dS)z)Set default password for encrypted files.zpwd: expected bytes, got %sN)rr% TypeErrorrOrr)r~rrrr setpassword@s zZipFile.setpasswordcCs|jS)z.The comment text associated with the ZIP file.)rB)r~rrrraIszZipFile.commentcCs^t|tstdt|jt|tkrNddl}|jdtdd|dt}||_ d|_ dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesr) stacklevelT) rr%rxrOrr.ZIP_MAX_COMMENTwarningswarnrBr@)r~rar|rrrraNs    c Cs"|j|d| }|jSQRXdS)zReturn file bytes for name.r:N)r>r;)r~r rr9rrrr;[sz ZipFile.readF) force_zip64c s|d"krtd|r2t|t r2tdt|j|rF|dkrFtdjsTtdt|trd|}n$|dkr~t|}j|_ n j |}|dkrj ||dSj rtdj d 7_ tj|jjjfd d }y|jt}t|tkrtd tjt|}|ttkr td |j|t}|trF|j|t|jd@rZtd|jd@rntd|jd@r|jd} n |jd} | |j krtd|j |f|j!dk r|j"|j#|j!krtd|j d|jd @} d} | r|sj$}|st%d|t&|} |jd} t't(| | dd} |jd@rX|j)d?d@}n|j*d?d@}| d|krt%d |t+|||| d!S|j,YnXdS)#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. r:r;zopen() requires mode "r" or "w"zpwd: expected bytes, got %sz'pwd is only supported for reading filesz2Attempt to use ZIP archive that was already closed)r~zyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.rcsjS)N)rr)r~rrrUszZipFile.open..zTruncated file headerz Bad magic number for file header z$compressed patched data (flag bit 5)@zstrong encryption (flag bit 6)izutf-8rSz/File name in directory %r and header %r differ.NzOverlapped entries: z (possible zip bomb)z6File %r is encrypted, password required for extractionrrrrrr&zBad password for file %rT>r;r:)-rzrr%rxrOrr9r rrdrw_open_to_writerrFrrlrLrr;sizeFileHeaderr.rrCr-r _FH_SIGNATUREr_FH_FILENAME_LENGTH_FH_EXTRA_FIELD_LENGTHrhrr`rbrqrYrnrrrr]r&rprmrr)r~r r rr~rZzef_fileZfheaderfnameZ fname_strZ is_encryptedZzdrhZ check_byter)r~rr>`s                   z ZipFile.opencCs|r|j rtd|jr"tdt|ds2d|_d|_d|_d|_|jt kr\|jdO_|j sp|jdO_|j s|d |_ |jo|p|jd t k}|j r|j j|j|j j|_|j|d |_|j j|j|d |_t|||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.rorrrirg?Ti)r?rzrr=rornrmrhrdrrIrkrr9rBr6rYrl _writecheckr@rrr*)r~rr~rrrrrs4     zZipFile._open_to_writecCs*|dkrtj}n tj|}|j|||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'. N)rwgetcwdr_extract_member)r~memberrrrrrextracts  zZipFile.extractcCsL|dkr|j}|dkr"tj}n tj|}x|D]}|j|||q2WdS)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)rmrwrrr)r~rmembersrrrrr extractall s   zZipFile.extractallcCs^|j}|s(d}tj|dt|}||_|j|}dd|j|D}|jdd|D}|S)z;Replace bad characters and remove trailing dots from parts.z:<>|"?*_css|]}|jdVqdS).N)rstrip)rkr<rrr (sz1ZipFile._sanitize_windows_name..css|]}|r|VqdS)Nr)rkr<rrrr*s)!_windows_illegal_name_trans_tablerC maketransr. translatesplitr0)rrpathseprZillegalrrr_sanitize_windows_names zZipFile._sanitize_windows_namecsNt|ts|j|}|jjdtjj}tjjrB|jtjjtjj}tjj |d}dtjj tjj ftjjj fdd|j tjjD}tjjdkr|j|tjj}tjj ||}tjj|}tjj|}|rtjj| rtj||jrtjj|s tj||S|j||d(}t|d}tj||Wd QRXWd QRX|S) zbExtract the ZipInfo object 'member' to a physical file on the path targetpath. rtrrc3s|]}|kr|VqdS)Nr)rkr<)invalid_path_partsrrr>sz*ZipFile._extract_member..\)rr>N)rr rwr?ryrwrrxrrcurdirpardirr0rrrdirnameexistsmakedirsrrmkdirr>shutil copyfileobj)r~rZ targetpathrrZ upperdirssourcetargetr)rrr-s.  &        zZipFile._extract_membercCs|j|jkr(ddl}|jd|jdd|jdkr:td |jsHtd t|j|j sd}t |j t krpd }n|j tkrd }n|jtkrd }|rt|ddS)z6Check for errors before writing a file to the archive.rNzDuplicate name: %rr)rzr;r<r=z&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closedz Files countZFilesizez Zipfile sizez would require ZIP64 extensions)r;r<r=)r?r8r|r}r rzr9rrdr?r.r7ZIP_FILECOUNT_LIMITrorrlr )r~rr|requires_zip64rrrrWs(     zZipFile._writecheckcCs0|jstd|jrtdtj||}|jr>d|_d|_n|dk rN||_n|j |_|jr|j |j rz|jj |j |jj|_|jtkr|jdO_|j|d|_|jj|||j|j<|jj|jd|jj|_ WdQRXnCan't write to ZIP archive while an open writing handle existsrNrTFr<r;iri )r9rzrr rrrnrmrdrrrIrBr6rYrlrrhrr@r7r/r8r?rrr>rr)r~r?rrdrsrcdestrrrrns8      z ZipFile.writecCst|tr|jd}t|tspt|tjtjddd}|j|_|jddkrhd|_ |j dO_ qtd|_ n|}|j st d |j rt d |dk r||_t ||_|j*|j|d d }|j|WdQRXWdQRXdS)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.zutf-8Nr")r?rcrrtiAriz7Attempt to write to ZIP archive that was already closedz?Can't write to ZIP archive while an open writing handle exists.r;)r riAi)rrCrr rrrrdr?rkr9rzrr.rorr>r)r~Zzinfo_or_arcnamerUrdrrrrrwritestrs.    zZipFile.writestrcCs |jdS)z2Call the "close()" method in case the user forgot.N)r)r~rrr__del__szZipFile.__del__cCs||jdkrdS|jrtdzB|jdkr\|jr\|j"|jrJ|jj|j|j WdQRXWd|j}d|_|j |XdS)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;r<r=)r;r<r=) r9rrzr r@rrIrBr6_write_end_recordrL)r~r9rrrrs z ZipFile.closecCsvxP|jD]D}|j}|ddd>|dd>B|dB}|dd>|d d>B|ddB}g}|jtksv|jtkr|j|j|j|jd }d }n |j}|j}|jtkr|j|jd }n|j}|j} d} |rt| d} t j d d t |dd t |f|| } t } |j tkr(tt| } n|j tkr>tt| } t| |j} t| |j} yZ|j\} }t j tt| |j| |j||j |||j||t | t | t |jd|j|j|}Wnltk rttt| |j| |j|j |j |||j||t |j!t | t |jd|j|j|ft"j#dYnX|j$j%||j$j%| |j$j%| |j$j%|jq W|j$j&}t |j}||j'}|j'}d}|t(krd}n|tkrd}n|tkrd}|r.|j)st*|dt j t+t,t-ddddd|||| }|j$j%|t j t.t/d|d}|j$j%|t0|d}t0|d }t0|d }t j t1t2dd||||t |j3 }|j$j%||j$j%|j3|j$j4dS)Nrir$rr!rrr&r lzrrrrrrrrrrrrrLrrrrr Hs<WQ     u +  * * $fc@s4eZdZdZdedd fddZdd d Zd d ZdS)r zDClass to create ZIP archives with Python library files and packages.r:TrcCstj|||||d||_dS)N)r rrM)r r _optimize)r~rr rrMoptimizerrrrFs zPyZipFile.__init__rNcCstj|}|rF|| rF|jrBtjj|r.dnd}td||fdStjj|\}}tjj|rntjj|d}tjj|r|rd||f}n|}|jrtd|d||j |d d|\}} |jrtd | |j || tj |} | j dx| D]} tjj|| } tjj | \} }tjj| rRtjjtjj| dr|j| ||d q|d kr|r||  r|jrtd| q|j | d d|\}} |jrtd | |j || qWn|jrtd|xtj |D]} tjj|| } tjj | \} }|d kr|r0||  r0|jrtd| q|j | d d|\}} |jrZtd | |j || qWnP|ddd krtd|j |d d|\}} |jrtd| |j || 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. rrz%s %r skipped by filterfuncNz __init__.pyz%s/%szAdding package inasrrZAdding) filterfuncz.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"z Adding filerrrr)rwrrArrrXrr0isfile _get_codenamerlistdirremovesplitextwritepyr)r~pathnamebasenamerZlabeldirr ZinitnamerrZdirlistr?rrootZextrrrrLsx                zPyZipFile.writepyc sdfdd }|d}|d}tjj|dd}tjj|dd}tjj|dd}jdkr\tjj|rtj|jtj|jkr|} } ntjj|rtj|jtj|jkr|} |} ntjj|rtj|jtj|jkr|} |} nvtjj|rtj|jtj|jkr|} |} nD||rRt j j d kr4|} nt j j dkrH|} n|} |} n|} } njd krr|} |} n<|} jdkr|} n&jdkr|} nd j j} t | tjj| otj| jtj|jks||jd s|} } tjj| d} |rd || f} | | 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). rcs^ddl}jrtd|y|j|d|dWn,|jk rX}zt|jdSd}~XnXdS)NrZ CompilingT)doraiserF) py_compilerArXcompilePyCompileErrormsg)rrrerr)r~rr_compiles  z)PyZipFile._get_codename.._compilez.pyz.pycr) optimizationrrz"invalid value for 'optimize': {!r})rz%s/%sr)rr) importlibutilcache_from_sourcerrwrrrrr{rhrformatrzr) r~rrrZfile_pyZfile_pycZ pycache_opt0Z pycache_opt1Z pycache_opt2rrrZ archivenamer)r~rrs`             zPyZipFile._get_codenamer)rN)rrrrrrrrrrrrr Cs  Rc sddl}|jd}|dkr(tjdd}| s:|ddkrLt|tjd|ddkrt|dkrvt|tjdt|dd }|jWdQRXn||ddkr t|dkrt|tjdt|dd }|j }WdQRX|rtd j |td n|ddkrbt|d kr8t|tjdt|dd }|j |dWdQRXn|ddkrt|d krt|tjdfd dt|ddh}x`|ddD]P}t j j|}|st j jt j j|}|dt jt jfkrd}|||qWWdQRXdS)NraE Usage: zipfile.py -l zipfile.zip # Show listing of a zipfile zipfile.py -t zipfile.zip # Test if a zipfile is valid zipfile.py -e zipfile.zip target # Extract zipfile into target dir zipfile.py -c zipfile.zip src ... # Create zipfile from sources r-l-c-e-trr:z.The following enclosed file is corrupted: {!r}z Done testingrcsptjj|r|j||tnPtjj|rl|r8|j||x2tj|D]$}|tjj||tjj||qDWdS)N)rwrrrrrrr0)r2rzippathZnm)addToZiprrrs   zmain..addToZipr;r)rrrr)textwrapZdedentr{argvrXexitr.r rrrtrrrwrrrrr)argsrZUSAGEr2Zbadfilerrr)rrmainsT           r__main__liiiii)N)rrrwreimportlib.utilrr{rrrrCZbinasciirG ImportErrorZdummy_threadingrr rr__all__ Exceptionrr rrrrr{rrrrr}rrrrdr\r[rrZrJrKrLrMrNrOrPr`rYrQr\r^r[r]Z_CD_CREATE_VERSIONZ_CD_CREATE_SYSTEMZ_CD_EXTRACT_VERSIONZ_CD_EXTRACT_SYSTEMZ _CD_FLAG_BITSZ_CD_COMPRESS_TYPEZ_CD_TIMEZ_CD_DATEZ_CD_CRCZ_CD_COMPRESSED_SIZEZ_CD_UNCOMPRESSED_SIZEr_rarbZ_CD_DISK_NUMBER_STARTZ_CD_INTERNAL_FILE_ATTRIBUTESZ_CD_EXTERNAL_FILE_ATTRIBUTESrcrrrrZ_FH_EXTRACT_VERSIONZ_FH_EXTRACT_SYSTEMZ_FH_GENERAL_PURPOSE_FLAG_BITSZ_FH_COMPRESSION_METHODZ_FH_LAST_MOD_TIMEZ_FH_LAST_MOD_DATEZ_FH_CRCZ_FH_COMPRESSED_SIZEZ_FH_UNCOMPRESSED_SIZErrrDrErArIrHrFZ_CD64_SIGNATUREZ_CD64_DIRECTORY_RECSIZEZ_CD64_CREATE_VERSIONZ_CD64_EXTRACT_VERSIONZ_CD64_DISK_NUMBERZ_CD64_DISK_NUMBER_STARTZ_CD64_NUMBER_ENTRIES_THIS_DISKZ_CD64_NUMBER_ENTRIES_TOTALZ_CD64_DIRECTORY_SIZEZ_CD64_OFFSET_START_CENTDIRr5ZStructr,r6r:r rWr7objectr rrrrrrrrrrrr*r r rrrrrrsB              <<g= fJ/ B