💾 Archived View for tris.fyi › pydoc › _bz2 captured on 2023-04-26 at 13:33:23. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-01-08)

-=-=-=-=-=-=-

Back to module index

Go to module by name

_bz2

This module has no docstring.

Classes

BZ2Compressor

Create a compressor object for compressing data incrementally.

  compresslevel
    Compression level, as a number between 1 and 9.

For one-shot compression, use the compress() function instead.
compress(self, data, /)

  Provide data to the compressor object.

  Returns a chunk of compressed data if possible, or b'' otherwise.

  When you have finished providing data to the compressor, call the
  flush() method to finish the compression process.
flush(self, /)

  Finish the compression process.

  Returns the compressed data left in internal buffers.

  The compressor object may not be used after this method is called.

BZ2Decompressor

Create a decompressor object for decompressing data incrementally.

For one-shot decompression, use the decompress() function instead.
decompress(self, /, data, max_length=-1)

  Decompress *data*, returning uncompressed data as bytes.

  If *max_length* is nonnegative, returns at most *max_length* bytes of
  decompressed data. If this limit is reached and further output can be
  produced, *self.needs_input* will be set to ``False``. In this case, the next
  call to *decompress()* may provide *data* as b'' to obtain more of the output.

  If all of the input data was decompressed and returned (either because this
  was less than *max_length* bytes, or because *max_length* was negative),
  *self.needs_input* will be set to True.

  Attempting to decompress data after the end of stream is reached raises an
  EOFError.  Any data found after the end of the stream is ignored and saved in
  the unused_data attribute.
eof = <member 'eof' of '_bz2.BZ2Decompressor' objects>
  True if the end-of-stream marker has been reached.
needs_input = <member 'needs_input' of '_bz2.BZ2Decompressor' objects>
  True if more input is needed before more decompressed data can be produced.
unused_data = <member 'unused_data' of '_bz2.BZ2Decompressor' objects>
  Data found after the end of the compressed stream.