a #eT@sbdZddlZddlZddlZdZGdddeZGdddejZGdd d Z Gd d d Z dS) z6.0.4Nlc@seZdZdZdS)LargePredictionSizez1 Raised when Buffer is larger than ZIP64 N)__name__ __module__ __qualname____doc__rr/webodm/app/vendor/zipfly.pyrsrc@s8eZdZdZddZddZddZdd Zd d Zd S) ZipflyStreamu The RawIOBase ABC extends IOBase. It deals with the reading and writing of bytes to a stream. FileIO subclasses RawIOBase to provide an interface to files in the machine’s file system. cCsd|_d|_dS)Nr)_buffer_sizeselfrrr__init__szZipflyStream.__init__cCsdS)NTrr rrrwritableszZipflyStream.writablecCs$|jrtd|j|7_t|S)NzZipFly stream was closed!)closed RuntimeErrorr len)rbrrrwrite"szZipflyStream.writecCs"|j}d|_|jt|7_|S)Nr )r r r)rchunkrrrget(szZipflyStream.getcCs|jSN)r r rrrsize.szZipflyStream.sizeN) rrrrrrrrrrrrrr s r c @s\eZdZdgdejddddddf d d Zd d Zd dZddZddZ ddZ ddZ dS)ZipFlywiTNrfsnzutf-8c Cs|dvrtd|tjfvr$td|dvr4tdt|trHt|d}d|_||_||_||_ | |_ ||_ ||_ ||_ ||_||_| |_tdd|_d S) zb @param store size : int : size of all files in paths without compression )rzZipFly requires 'w' modezNot compression supportedrzNot compression level supportedzWritten using WebODMZ0x8eN)rzipfile ZIP_STORED isinstancestrintcommentmodepaths filesystemarcname compression chunksize allowZip64 compresslevel storesizeencodeZezs) rr%r&r*r)r+r,r-r'r(r.rrrr4s(   zZipFly.__init__cCs:t|tst|}t|tjkr0|dtj}||_dSr)r!bytesr"r.rrZIP_MAX_COMMENTr$)rr$rrr set_comment`s   zZipFly.set_commentcsfdd}|S)Ncs jSrreadr*rentryrrr get_chunkosz ZipFly.reader..get_chunkr)rr5r6rr4rreadermsz ZipFly.readercCs|D]}q|jS)z FOR UNIT TESTING (not used) using to get the buffer size this size is different from the size of each file added ) generator _buffer_size)rirrr buffer_sizeuszZipFly.buffer_sizec Cs|jstdtdd}tddt|j}|j}t|jtrH|j}t| |j }d}t t|jD]r}|j }|j |j|vr|j }|j||}|ddvr|dt|}|t| |j tddtd d7}qjt |||||jg} | tkrtd | S) NzZIP64 extensions requiredZ0x16rZ0x5er)/Z0x1Z0x2z}t fdddD]}|||VqWdn1s0YWdq(1s0Yq(jj|_Wdn1s80Y|V|_|dS) N)r%r)r+z 'z' key is required rb)r%cs jSrr2rerrrr z"ZipFly.generator..r )r rZipFiler%r)r+r&r'rr(ZipInfo from_fileopeniterrrr1r$rr9close)rstreamzfpathZz_infodrrrGrr8s:     L (  zZipFly.generatorcCs|jSr)r9r rrrget_sizeszZipFly.get_size) rrrrr rr1r7r;rEr8rTrrrrr2s" ,  >Urc@s$eZdZddZddZddZdS) ZipStreamcCs||_d|_dSr)r&r8)rr&rrrrszZipStream.__init__cCs(|jdur$t|jd|d}||_dS)Nr)r&r%r*)r8rr&)rr*Zzflyrrr lazy_loads zZipStream.lazy_loadcCs||t|jSr)rVnextr8)rcountrrrr3"s zZipStream.readN)rrrrrVr3rrrrrUsrU) __version__iostatrrA Exceptionr RawIOBaser rrUrrrrsg