\d1tdZddlZddlZejZGddejZGddejZdS)z7Internal classes used by the gzip, lzma and bz2 modulesNc*eZdZdZdZdZdZdZdS) BaseStreamzMode-checking helper functions.c2|jrtddS)NzI/O operation on closed file)closed ValueErrorselfs :J:\tools\MySQL Workbench 8.0 CE\python\Lib\_compression.py_check_not_closedzBaseStream._check_not_closed s% ; =;<< < = =cV|stjddS)NzFile not open for reading)readableioUnsupportedOperationrs r _check_can_readzBaseStream._check_can_read1}} G)*EFF F G Gr cV|stjddS)NzFile not open for writing)writablerrrs r _check_can_writezBaseStream._check_can_writerr c|stjd|stjddS)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)rrrseekablers r _check_can_seekzBaseStream._check_can_seeksl}} G)+FGG G}} F)+EFF F F Fr N)__name__ __module__ __qualname____doc__r rrrr r rr sa))===GGGGGGFFFFFr rcjeZdZdZdZddZfdZdZdZdd Z d Z d Z e j fd Zd ZxZS)DecompressReaderz5Adapts the decompressor API to a RawIOBase reader APIcdS)NTrrs r rzDecompressReader.readable$str rc ||_d|_d|_d|_||_||_|jdi|j|_||_dS)NFrr)_fp_eof_pos_size_decomp_factory _decomp_args _decompressor_trailing_error)r fpdecomp_factorytrailing_error decomp_argss r __init__zDecompressReader.__init__'s`   .'1T1FFD4EFF .r cRd|_tSN)r)superclose)r __class__s r r3zDecompressReader.close;s!ww}}r c4|jSr1)r#rrs r rzDecompressReader.seekable?sx  """r c4t|5}|d5}|t|}||dt|<dddn #1swxYwYdddn #1swxYwYt|S)NB) memoryviewcastreadlen)r bview byte_viewdatas r readintozDecompressReader.readintoBs ]] )dDIIcNN )i99S^^,,D$(Ijs4yyj ! ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )4yys4B7A) B)A- -B0A- 1BBBr"cv|dkr|S|r|jrdSd} |jjrr|jjp|jt}|sn|jdi|j |_ |j ||}nj#|j $rYnbwxYw|jj r1|jt}|stdnd}|j ||}|rn|sd|_|j|_dS|xjt!|z c_|S)Nrr TzACompressed file ended before the end-of-stream marker was reachedr)readallr$r)eof unused_datar#r: BUFFER_SIZEr'r( decompressr* needs_inputEOFErrorr%r&r;)r sizer?rawblocks r r:zDecompressReader.readHs !88<<>> ! ty 3 !% E .:7 HMM+66%9T%9&)&)'&)&)"-884HHDD+E%1##x}}[99H#K&(JKKKK #H)44XtDD 1 2 DIDJ3 SYY  s;B B$#B$cg}|tjx}r6|||tjx}6d|S)Nr )r:sysmaxsizeappendjoin)r chunksr?s r rBzDecompressReader.readallqsgii ,,,d MM$   ii ,,,d xxr c|jdd|_d|_|jdi|j|_dS)NrFr)r#seekr$r%r'r(r)rs r _rewindzDecompressReader._rewind|sH  a  1T1FFD4EFFr cf|tjkrn|tjkr |j|z}n|tjkrU|jdkr?|tjr |tj |j|z}n"td |||jkr| n ||jz}|dkrH|ttj|}|sn|t|z}|dkH|jS)NrzInvalid value for whence: {}) rSEEK_SETSEEK_CURr%SEEK_ENDr&r:DEFAULT_BUFFER_SIZErformatrSminr;)r offsetwhencer?s r rRzDecompressReader.seeks& R[  r{ " "Y'FF r{ " "zA~~ii 677ii 677Z&(FF;BB6JJKK K DI   LLNNNN di Fqjj99S!7@@AAD  c$ii F qjj yr c|jS)z!Return the current file position.)r%rs r tellzDecompressReader.tells yr )r)r")rrrrrr/r3rr@r:rBrSrrUrRr^ __classcell__)r4s@r rr!s??....(### ''''R   GGG #%+<r r) rrrLrXrEBufferedIOBaser RawIOBaserrr r rbs== $ FFFFF"FFF0AAAAAr|AAAAAr