MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / decompress

Function decompress

tools/python-3.11.9-amd64/Lib/lzma.py:331–356  ·  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

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

Callers

nothing calls this directly

Calls 4

decompressMethod · 0.95
LZMADecompressorClass · 0.85
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected