(data)
return b"".join(results)
Decompress a block of data.

    For incremental decompression, use a BZ2Decompressor object instead.
Decompress a block of data.
Decompress a block of data .
def decompress(data):
    """Decompress a block of data.

    For incremental decompression, use a BZ2Decompressor object instead.
    """
    results = []
    while data:
        decomp = BZ2Decompressor()
        try:
            res = decomp.decompress(data)
        except OSError:
            if results:
                break  # Leftover data is not a valid bzip2 stream; ignore it.
            else:
                raise  # Error on the first iteration; bail out.
        results.append(res)
        if not decomp.eof:
            raise ValueError("Compressed data ended before the "
                             "end-of-stream marker was reached")
        data = decomp.unused_data
    return b"".join(results)
def decompress ( data ) : results = [ ] while data : decomp = BZ2Decompressor ( ) try : res = decomp . decompress ( data ) except OSError : if results : break # Leftover data is not a valid bzip2 stream; ignore it. else : raise # Error on the first iteration; bail out. results . append ( res ) if not decomp . eof : raise ValueError ( "Compressed data ended before the " "end-of-stream marker was reached" ) data = decomp . unused_data return b"" . join ( results )