MCPcopy Index your code
hub / github.com/python/cpython / compress

Function compress

Lib/compression/zstd/__init__.py:136–149  ·  view source on GitHub ↗

Return Zstandard compressed *data* as bytes. *level* is an int specifying the compression level to use, defaulting to COMPRESSION_LEVEL_DEFAULT ('3'). *options* is a dict object that contains advanced compression parameters. See CompressionParameter for more on options. *zstd_di

(data, level=None, options=None, zstd_dict=None)

Source from the content-addressed store, hash-verified

134
135
136def compress(data, level=None, options=None, zstd_dict=None):
137 """Return Zstandard compressed *data* as bytes.
138
139 *level* is an int specifying the compression level to use, defaulting to
140 COMPRESSION_LEVEL_DEFAULT ('3').
141 *options* is a dict object that contains advanced compression
142 parameters. See CompressionParameter for more on options.
143 *zstd_dict* is a ZstdDict object, a pre-trained Zstandard dictionary. See
144 the function train_dict for how to train a ZstdDict on sample data.
145
146 For incremental compression, use a ZstdCompressor instead.
147 """
148 comp = ZstdCompressor(level=level, options=options, zstd_dict=zstd_dict)
149 return comp.compress(data, mode=ZstdCompressor.FLUSH_FRAME)
150
151
152def decompress(data, zstd_dict=None, options=None):

Callers 15

setUpModuleFunction · 0.90
test_roundtrip_levelMethod · 0.90
test_get_frame_infoMethod · 0.90
test_compress_emptyMethod · 0.90
test_decompressor_1Method · 0.90
test_is_rawMethod · 0.90
test_train_dictMethod · 0.90

Calls 1

compressMethod · 0.45

Tested by 15

setUpModuleFunction · 0.72
test_roundtrip_levelMethod · 0.72
test_get_frame_infoMethod · 0.72
test_compress_emptyMethod · 0.72
test_decompressor_1Method · 0.72
test_is_rawMethod · 0.72
test_train_dictMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…