Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4849)

Side by Side Diff: Doc/library/lzma.rst

Issue 14736: Add {encode,decode}_filter_properties() functions to lzma module
Patch Set: Created 1 year ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Lib/lzma.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`lzma` --- Compression using the LZMA algorithm 1 :mod:`lzma` --- Compression using the LZMA algorithm
2 ==================================================== 2 ====================================================
3 3
4 .. module:: lzma 4 .. module:: lzma
5 :synopsis: A Python wrapper for the liblzma compression library. 5 :synopsis: A Python wrapper for the liblzma compression library.
6 .. moduleauthor:: Nadeem Vawda <nadeem.vawda@gmail.com> 6 .. moduleauthor:: Nadeem Vawda <nadeem.vawda@gmail.com>
7 .. sectionauthor:: Nadeem Vawda <nadeem.vawda@gmail.com> 7 .. sectionauthor:: Nadeem Vawda <nadeem.vawda@gmail.com>
8 8
9 .. versionadded:: 3.3 9 .. versionadded:: 3.3
10 10
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 ------------- 226 -------------
227 227
228 .. function:: check_is_supported(check) 228 .. function:: check_is_supported(check)
229 229
230 Returns true if the given integrity check is supported on this system. 230 Returns true if the given integrity check is supported on this system.
231 231
232 :const:`CHECK_NONE` and :const:`CHECK_CRC32` are always supported. 232 :const:`CHECK_NONE` and :const:`CHECK_CRC32` are always supported.
233 :const:`CHECK_CRC64` and :const:`CHECK_SHA256` may be unavailable if you are 233 :const:`CHECK_CRC64` and :const:`CHECK_SHA256` may be unavailable if you are
234 using a version of :program:`liblzma` that was compiled with a limited 234 using a version of :program:`liblzma` that was compiled with a limited
235 feature set. 235 feature set.
236
237
238 .. function:: encode_filter_properties(filter)
239
240 Return a :class:`bytes` object encoding the options (properties) of the
241 filter specified by *filter* (a dictionary).
242
243 *filter* is interpreted as a filter specifier, as described in
244 :ref:`filter-chain-specs`.
245
246 The returned data does not include the filter ID itself, only the options.
247
248 This function is primarily of interest to users implementing custom file
249 formats.
250
251
252 .. function:: decode_filter_properties(filter_id, encoded_props)
253
254 Return a dictionary describing a filter with ID *filter_id*, and options
255 (properties) decoded from the :class:`bytes` object *encoded_props*.
256
257 The returned dictionary is a filter specifier, as described in
258 :ref:`filter-chain-specs`.
259
260 This function is primarily of interest to users implementing custom file
261 formats.
236 262
237 263
238 .. _filter-chain-specs: 264 .. _filter-chain-specs:
239 265
240 Specifying custom filter chains 266 Specifying custom filter chains
241 ------------------------------- 267 -------------------------------
242 268
243 A filter chain specifier is a sequence of dictionaries, where each dictionary 269 A filter chain specifier is a sequence of dictionaries, where each dictionary
244 contains the ID and options for a single filter. Each dictionary must contain 270 contains the ID and options for a single filter. Each dictionary must contain
245 the key ``"id"``, and may contain additional keys to specify filter-dependent 271 the key ``"id"``, and may contain additional keys to specify filter-dependent
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 366
341 Creating a compressed file using a custom filter chain:: 367 Creating a compressed file using a custom filter chain::
342 368
343 import lzma 369 import lzma
344 my_filters = [ 370 my_filters = [
345 {"id": lzma.FILTER_DELTA, "dist": 5}, 371 {"id": lzma.FILTER_DELTA, "dist": 5},
346 {"id": lzma.FILTER_LZMA2, "preset": 7 | lzma.PRESET_EXTREME}, 372 {"id": lzma.FILTER_LZMA2, "preset": 7 | lzma.PRESET_EXTREME},
347 ] 373 ]
348 with lzma.LZMAFile("file.xz", "w", filters=my_filters) as f: 374 with lzma.LZMAFile("file.xz", "w", filters=my_filters) as f:
349 f.write(b"blah blah blah") 375 f.write(b"blah blah blah")
OLDNEW
« no previous file with comments | « no previous file | Lib/lzma.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7