a
´iÉ ã @ s’ d Z ddlZddlZddd„Zddd„ZG dd „ d ejƒZG d
d„ dejƒZG dd
„ d
ejƒZG dd„ deejƒZG dd„ deej ƒZ dd„ Z
dS )a Python '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).
é NÚstrictc C s t | ¡t| ƒfS ©N)Úbz2ÚcompressÚlen©ÚinputÚerrors© r
ú+/usr/lib64/python3.9/encodings/bz2_codec.pyÚ
bz2_encode s r c C s t | ¡t| ƒfS r )r Ú
decompressr r r
r
r Ú
bz2_decode s r c @ s e Zd Zddd„Zddd„ZdS ) ÚCodecr c C s
t ||ƒS r )r ©Úselfr r r
r
r Úencode s zCodec.encodec C s
t ||ƒS r )r r r
r
r Údecode s zCodec.decodeN)r )r )Ú__name__Ú
__module__Ú__qualname__r r r
r
r
r r s
r c @ s( e Zd Zd
dd„Zddd„Zdd„ Zd S )ÚIncrementalEncoderr c C s || _ t ¡ | _d S r )r r Ú
BZ2CompressorÚcompressobj©r r r
r
r Ú__init__ s zIncrementalEncoder.__init__Fc C s. |r| j |¡}|| j ¡ S | j |¡S d S r )r r Úflush)r r ÚfinalÚcr
r
r r # s zIncrementalEncoder.encodec C s t ¡ | _d S r )r r r ©r r
r
r Úreset* s zIncrementalEncoder.resetN)r )F)r r r r r r r
r
r
r r s
r c @ s( e Zd Zd
dd„Zddd„Zdd„ Zd S )ÚIncrementalDecoderr c C s || _ t ¡ | _d S r )r r ÚBZ2DecompressorÚ
decompressobjr r
r
r r . s zIncrementalDecoder.__init__Fc C s( z| j |¡W S ty" Y dS 0 d S )NÚ )r# r
ÚEOFError)r r r r
r
r r 3 s zIncrementalDecoder.decodec C s t ¡ | _d S r )r r" r# r r
r
r r 9 s zIncrementalDecoder.resetN)r )F)r r r r r r r
r
r
r r! - s
r! c @ s e Zd ZeZdS )ÚStreamWriterN©r r r ÚbytesÚcharbuffertyper
r
r
r r&