@@ -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
@@ -412,6 +391,106 @@ These filters support one option, ``start_offset``. This specifies the address
412391that should be mapped to the beginning of the input data. The default is 0.
413392
414393
394+ Constants
395+ ---------
396+
397+ The following module-level constants are provided for use as the *format *,
398+ *check *, *preset * and *filters * arguments of the classes and functions above.
399+
400+ Container formats:
401+
402+ .. data :: FORMAT_XZ
403+
404+ The ``.xz `` container format.
405+
406+ .. data :: FORMAT_ALONE
407+
408+ The legacy ``.lzma `` container format. This format is more limited than
409+ ``.xz `` -- it does not support integrity checks or multiple filters.
410+
411+ .. data :: FORMAT_RAW
412+
413+ A raw data stream, not using any container format. This format specifier
414+ does not support integrity checks, and requires that you always specify a
415+ custom filter chain (for both compression and decompression). Additionally,
416+ data compressed in this manner cannot be decompressed using
417+ :const: `FORMAT_AUTO `.
418+
419+ .. data :: FORMAT_AUTO
420+
421+ Used for decompression only. The container format is detected
422+ automatically, so that both ``.xz `` and ``.lzma `` files can be decompressed.
423+
424+ Integrity checks:
425+
426+ .. data :: CHECK_NONE
427+
428+ No integrity check. This is the default (and the only acceptable value) for
429+ :const: `FORMAT_ALONE ` and :const: `FORMAT_RAW `.
430+
431+ .. data :: CHECK_CRC32
432+
433+ A 32-bit Cyclic Redundancy Check.
434+
435+ .. data :: CHECK_CRC64
436+
437+ A 64-bit Cyclic Redundancy Check. This is the default for
438+ :const: `FORMAT_XZ `.
439+
440+ .. data :: CHECK_SHA256
441+
442+ A 256-bit Secure Hash Algorithm.
443+
444+ .. data :: CHECK_UNKNOWN
445+
446+ The integrity check used by a stream could not yet be determined. This may
447+ be the value of the :attr: `LZMADecompressor.check ` attribute until enough of
448+ the input has been decoded.
449+
450+ .. data :: CHECK_ID_MAX
451+
452+ The largest supported integrity-check ID.
453+
454+ Compression presets:
455+
456+ .. data :: PRESET_DEFAULT
457+
458+ The default compression preset, equivalent to preset level ``6 ``.
459+
460+ .. data :: PRESET_EXTREME
461+
462+ A flag that may be bitwise OR-ed with a preset level (``0 `` to ``9 ``) to
463+ select a slower but more thorough variant of that preset.
464+
465+ Filter IDs and options:
466+
467+ .. data :: FILTER_LZMA1
468+ FILTER_LZMA2
469+
470+ The LZMA1 and LZMA2 compression filters. :const: `FILTER_LZMA1 ` is for use
471+ with :const: `FORMAT_ALONE `, while :const: `FILTER_LZMA2 ` is for use with
472+ :const: `FORMAT_XZ ` and :const: `FORMAT_RAW `.
473+
474+ .. data :: FILTER_DELTA
475+
476+ The delta filter.
477+
478+ .. data :: MODE_FAST
479+ MODE_NORMAL
480+
481+ Compression modes that may be used as the ``mode `` option of a filter
482+ specifier (see :ref: `filter-chain-specs `).
483+
484+ .. data :: MF_HC3
485+ MF_HC4
486+ MF_BT2
487+ MF_BT3
488+ MF_BT4
489+
490+ Match finders that may be used as the ``mf `` option of a filter specifier
491+ (see :ref: `filter-chain-specs `).
492+
493+
415494Examples
416495--------
417496
0 commit comments