@@ -155,35 +155,14 @@ Compressing and decompressing data in memory
155155 :func: `compress `.
156156
157157 The *format * argument specifies what container format should be used.
158- Possible values are:
159-
160- * :const: `FORMAT_XZ `: The ``.xz `` container format.
161- This is the default format.
162-
163- * :const: `FORMAT_ALONE `: The legacy ``.lzma `` container format.
164- This format is more limited than ``.xz `` -- it does not support integrity
165- checks or multiple filters.
166-
167- * :const: `FORMAT_RAW `: A raw data stream, not using any container format.
168- This format specifier does not support integrity checks, and requires that
169- you always specify a custom filter chain (for both compression and
170- decompression). Additionally, data compressed in this manner cannot be
171- decompressed using :const: `FORMAT_AUTO ` (see :class: `LZMADecompressor `).
158+ Possible values are :const: `FORMAT_XZ ` (the default),
159+ :const: `FORMAT_ALONE ` and :const: `FORMAT_RAW `.
172160
173161 The *check * argument specifies the type of integrity check to include in the
174162 compressed data. This check is used when decompressing, to ensure that the
175- data has not been corrupted. Possible values are:
176-
177- * :const: `CHECK_NONE `: No integrity check.
178- This is the default (and the only acceptable value) for
179- :const: `FORMAT_ALONE ` and :const: `FORMAT_RAW `.
180-
181- * :const: `CHECK_CRC32 `: 32-bit Cyclic Redundancy Check.
182-
183- * :const: `CHECK_CRC64 `: 64-bit Cyclic Redundancy Check.
184- This is the default for :const: `FORMAT_XZ `.
185-
186- * :const: `CHECK_SHA256 `: 256-bit Secure Hash Algorithm.
163+ data has not been corrupted. Possible values are :const: `CHECK_NONE `,
164+ :const: `CHECK_CRC32 `, :const: `CHECK_CRC64 ` (the default for
165+ :const: `FORMAT_XZ `) and :const: `CHECK_SHA256 `.
187166
188167 If the specified check is not supported, an :class: `LZMAError ` is raised.
189168
@@ -359,12 +338,12 @@ options. Valid filter IDs are as follows:
359338
360339* Branch-Call-Jump (BCJ) filters:
361340
362- * :const: `FILTER_X86 `
363- * :const: `FILTER_IA64 `
364- * :const: `FILTER_ARM `
365- * :const: `FILTER_ARMTHUMB `
366- * :const: `FILTER_POWERPC `
367- * :const: `FILTER_SPARC `
341+ * :const: `! FILTER_X86 `
342+ * :const: `! FILTER_IA64 `
343+ * :const: `! FILTER_ARM `
344+ * :const: `! FILTER_ARMTHUMB `
345+ * :const: `! FILTER_POWERPC `
346+ * :const: `! FILTER_SPARC `
368347
369348A filter chain can consist of up to 4 filters, and cannot be empty. The last
370349filter in the chain must be a compression filter, and any other filters must be
@@ -401,6 +380,106 @@ These filters support one option, ``start_offset``. This specifies the address
401380that should be mapped to the beginning of the input data. The default is 0.
402381
403382
383+ Constants
384+ ---------
385+
386+ The following module-level constants are provided for use as the *format *,
387+ *check *, *preset * and *filters * arguments of the classes and functions above.
388+
389+ Container formats:
390+
391+ .. data :: FORMAT_XZ
392+
393+ The ``.xz `` container format.
394+
395+ .. data :: FORMAT_ALONE
396+
397+ The legacy ``.lzma `` container format. This format is more limited than
398+ ``.xz `` -- it does not support integrity checks or multiple filters.
399+
400+ .. data :: FORMAT_RAW
401+
402+ A raw data stream, not using any container format. This format specifier
403+ does not support integrity checks, and requires that you always specify a
404+ custom filter chain (for both compression and decompression). Additionally,
405+ data compressed in this manner cannot be decompressed using
406+ :const: `FORMAT_AUTO `.
407+
408+ .. data :: FORMAT_AUTO
409+
410+ Used for decompression only. The container format is detected
411+ automatically, so that both ``.xz `` and ``.lzma `` files can be decompressed.
412+
413+ Integrity checks:
414+
415+ .. data :: CHECK_NONE
416+
417+ No integrity check. This is the default (and the only acceptable value) for
418+ :const: `FORMAT_ALONE ` and :const: `FORMAT_RAW `.
419+
420+ .. data :: CHECK_CRC32
421+
422+ A 32-bit Cyclic Redundancy Check.
423+
424+ .. data :: CHECK_CRC64
425+
426+ A 64-bit Cyclic Redundancy Check. This is the default for
427+ :const: `FORMAT_XZ `.
428+
429+ .. data :: CHECK_SHA256
430+
431+ A 256-bit Secure Hash Algorithm.
432+
433+ .. data :: CHECK_UNKNOWN
434+
435+ The integrity check used by a stream could not yet be determined. This may
436+ be the value of the :attr: `LZMADecompressor.check ` attribute until enough of
437+ the input has been decoded.
438+
439+ .. data :: CHECK_ID_MAX
440+
441+ The largest supported integrity-check ID.
442+
443+ Compression presets:
444+
445+ .. data :: PRESET_DEFAULT
446+
447+ The default compression preset, equivalent to preset level ``6 ``.
448+
449+ .. data :: PRESET_EXTREME
450+
451+ A flag that may be bitwise OR-ed with a preset level (``0 `` to ``9 ``) to
452+ select a slower but more thorough variant of that preset.
453+
454+ Filter IDs and options:
455+
456+ .. data :: FILTER_LZMA1
457+ FILTER_LZMA2
458+
459+ The LZMA1 and LZMA2 compression filters. :const: `FILTER_LZMA1 ` is for use
460+ with :const: `FORMAT_ALONE `, while :const: `FILTER_LZMA2 ` is for use with
461+ :const: `FORMAT_XZ ` and :const: `FORMAT_RAW `.
462+
463+ .. data :: FILTER_DELTA
464+
465+ The delta filter.
466+
467+ .. data :: MODE_FAST
468+ MODE_NORMAL
469+
470+ Compression modes that may be used as the ``mode `` option of a filter
471+ specifier (see :ref: `filter-chain-specs `).
472+
473+ .. data :: MF_HC3
474+ MF_HC4
475+ MF_BT2
476+ MF_BT3
477+ MF_BT4
478+
479+ Match finders that may be used as the ``mf `` option of a filter specifier
480+ (see :ref: `filter-chain-specs `).
481+
482+
404483Examples
405484--------
406485
0 commit comments