U e5d@sdZddlZddlZdddZdddZGdd d ejZGd d d ejZGd d d ejZGdddeejZGdddeej Z ddZ dS)aPython 'bz2_codec' Codec - bz2 compression encoding. This codec de/encodes from bytes to bytes and is therefore usable with bytes.transform() and bytes.untransform(). Adapted by Raymond Hettinger from zlib_codec.py which was written by Marc-Andre Lemburg (mal@lemburg.com). NstrictcCs|dks tt|t|fSNr)AssertionErrorbz2compressleninputerrorsr +/usr/lib64/python3.8/encodings/bz2_codec.py bz2_encodes r cCs|dks tt|t|fSr)rr decompressrrr r r bz2_decodes rc@s eZdZdddZdddZdS) CodecrcCs t||SN)r selfr r r r r encodesz Codec.encodecCs t||Sr)rrr r r decodesz Codec.decodeN)r)r)__name__ __module__ __qualname__rrr r r r rs rc@s(eZdZd ddZd ddZddZd S) IncrementalEncoderrcCs |dks t||_t|_dSr)rr r BZ2Compressor compressobjrr r r r __init__s zIncrementalEncoder.__init__FcCs.|r|j|}||jS|j|SdSr)rrflush)rr finalcr r r r#s zIncrementalEncoder.encodecCst|_dSr)rrrrr r r reset*szIncrementalEncoder.resetN)r)F)rrrrrr"r r r r rs  rc@s(eZdZd ddZd ddZddZd S) IncrementalDecoderrcCs |dks t||_t|_dSr)rr rBZ2Decompressor decompressobjrr r r r.s zIncrementalDecoder.__init__FcCs*z|j|WStk r$YdSXdS)N)r%rEOFError)rr rr r r r3szIncrementalDecoder.decodecCst|_dSr)rr$r%r!r r r r"9szIncrementalDecoder.resetN)r)F)rrrrrr"r r r r r#-s  r#c@seZdZeZdS) StreamWriterNrrrbytescharbuffertyper r r r r(<sr(c@seZdZeZdS) StreamReaderNr)r r r r r,?sr,c CstjdttttttddS)NrF)namerrincrementalencoderincrementaldecoder streamwriter streamreader_is_text_encoding)codecs CodecInfor rrr#r(r,r r r r getregentryDsr5)r)r) __doc__r3rr rrrr#r(r,r5r r r r s