MCPcopy Index your code
hub / github.com/RustPython/RustPython / decompress

Function decompress

Lib/lzma.py:339–364  ·  view source on GitHub ↗

Decompress a block of data. Refer to LZMADecompressor's docstring for a description of the optional arguments *format*, *check* and *filters*. For incremental decompression, use an LZMADecompressor instead.

(data, format=FORMAT_AUTO, memlimit=None, filters=None)

Source from the content-addressed store, hash-verified

337
338
339def decompress(data, format=FORMAT_AUTO, memlimit=None, filters=None):
340 """Decompress a block of data.
341
342 Refer to LZMADecompressor's docstring for a description of the
343 optional arguments *format*, *check* and *filters*.
344
345 For incremental decompression, use an LZMADecompressor instead.
346 """
347 results = []
348 while True:
349 decomp = LZMADecompressor(format, memlimit, filters)
350 try:
351 res = decomp.decompress(data)
352 except LZMAError:
353 if results:
354 break # Leftover data is not a valid LZMA/XZ stream; ignore it.
355 else:
356 raise # Error on the first iteration; bail out.
357 results.append(res)
358 if not decomp.eof:
359 raise LZMAError("Compressed data ended before the "
360 "end-of-stream marker was reached")
361 data = decomp.unused_data
362 if not data:
363 break
364 return b"".join(results)

Callers

nothing calls this directly

Calls 4

decompressMethod · 0.95
LZMADecompressorClass · 0.50
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected