@@ -152,35 +152,14 @@ Compressing and decompressing data in memory
152152 :func: `compress `.
153153
154154 The *format * argument specifies what container format should be used.
155- Possible values are:
156-
157- * :const: `FORMAT_XZ `: The ``.xz `` container format.
158- This is the default format.
159-
160- * :const: `FORMAT_ALONE `: The legacy ``.lzma `` container format.
161- This format is more limited than ``.xz `` -- it does not support integrity
162- checks or multiple filters.
163-
164- * :const: `FORMAT_RAW `: A raw data stream, not using any container format.
165- This format specifier does not support integrity checks, and requires that
166- you always specify a custom filter chain (for both compression and
167- decompression). Additionally, data compressed in this manner cannot be
168- decompressed using :const: `FORMAT_AUTO ` (see :class: `LZMADecompressor `).
155+ Possible values are :const: `FORMAT_XZ ` (the default),
156+ :const: `FORMAT_ALONE ` and :const: `FORMAT_RAW `.
169157
170158 The *check * argument specifies the type of integrity check to include in the
171159 compressed data. This check is used when decompressing, to ensure that the
172- data has not been corrupted. Possible values are:
173-
174- * :const: `CHECK_NONE `: No integrity check.
175- This is the default (and the only acceptable value) for
176- :const: `FORMAT_ALONE ` and :const: `FORMAT_RAW `.
177-
178- * :const: `CHECK_CRC32 `: 32-bit Cyclic Redundancy Check.
179-
180- * :const: `CHECK_CRC64 `: 64-bit Cyclic Redundancy Check.
181- This is the default for :const: `FORMAT_XZ `.
182-
183- * :const: `CHECK_SHA256 `: 256-bit Secure Hash Algorithm.
160+ data has not been corrupted. Possible values are :const: `CHECK_NONE `,
161+ :const: `CHECK_CRC32 `, :const: `CHECK_CRC64 ` (the default for
162+ :const: `FORMAT_XZ `) and :const: `CHECK_SHA256 `.
184163
185164 If the specified check is not supported, an :class: `LZMAError ` is raised.
186165
@@ -398,6 +377,106 @@ These filters support one option, ``start_offset``. This specifies the address
398377that should be mapped to the beginning of the input data. The default is 0.
399378
400379
380+ Constants
381+ ---------
382+
383+ The following module-level constants are provided for use as the *format *,
384+ *check *, *preset * and *filters * arguments of the classes and functions above.
385+
386+ Container formats:
387+
388+ .. data :: FORMAT_XZ
389+
390+ The ``.xz `` container format.
391+
392+ .. data :: FORMAT_ALONE
393+
394+ The legacy ``.lzma `` container format. This format is more limited than
395+ ``.xz `` -- it does not support integrity checks or multiple filters.
396+
397+ .. data :: FORMAT_RAW
398+
399+ A raw data stream, not using any container format. This format specifier
400+ does not support integrity checks, and requires that you always specify a
401+ custom filter chain (for both compression and decompression). Additionally,
402+ data compressed in this manner cannot be decompressed using
403+ :const: `FORMAT_AUTO `.
404+
405+ .. data :: FORMAT_AUTO
406+
407+ Used for decompression only. The container format is detected
408+ automatically, so that both ``.xz `` and ``.lzma `` files can be decompressed.
409+
410+ Integrity checks:
411+
412+ .. data :: CHECK_NONE
413+
414+ No integrity check. This is the default (and the only acceptable value) for
415+ :const: `FORMAT_ALONE ` and :const: `FORMAT_RAW `.
416+
417+ .. data :: CHECK_CRC32
418+
419+ A 32-bit Cyclic Redundancy Check.
420+
421+ .. data :: CHECK_CRC64
422+
423+ A 64-bit Cyclic Redundancy Check. This is the default for
424+ :const: `FORMAT_XZ `.
425+
426+ .. data :: CHECK_SHA256
427+
428+ A 256-bit Secure Hash Algorithm.
429+
430+ .. data :: CHECK_UNKNOWN
431+
432+ The integrity check used by a stream could not yet be determined. This may
433+ be the value of the :attr: `LZMADecompressor.check ` attribute until enough of
434+ the input has been decoded.
435+
436+ .. data :: CHECK_ID_MAX
437+
438+ The largest supported integrity-check ID.
439+
440+ Compression presets:
441+
442+ .. data :: PRESET_DEFAULT
443+
444+ The default compression preset, equivalent to preset level ``6 ``.
445+
446+ .. data :: PRESET_EXTREME
447+
448+ A flag that may be bitwise OR-ed with a preset level (``0 `` to ``9 ``) to
449+ select a slower but more thorough variant of that preset.
450+
451+ Filter IDs and options:
452+
453+ .. data :: FILTER_LZMA1
454+ FILTER_LZMA2
455+
456+ The LZMA1 and LZMA2 compression filters. :const: `FILTER_LZMA1 ` is for use
457+ with :const: `FORMAT_ALONE `, while :const: `FILTER_LZMA2 ` is for use with
458+ :const: `FORMAT_XZ ` and :const: `FORMAT_RAW `.
459+
460+ .. data :: FILTER_DELTA
461+
462+ The delta filter.
463+
464+ .. data :: MODE_FAST
465+ MODE_NORMAL
466+
467+ Compression modes that may be used as the ``mode `` option of a filter
468+ specifier (see :ref: `filter-chain-specs `).
469+
470+ .. data :: MF_HC3
471+ MF_HC4
472+ MF_BT2
473+ MF_BT3
474+ MF_BT4
475+
476+ Match finders that may be used as the ``mf `` option of a filter specifier
477+ (see :ref: `filter-chain-specs `).
478+
479+
401480Examples
402481--------
403482
0 commit comments