How to use the zstandard.MAX_COMPRESSION_LEVEL function in zstandard

To help you get started, we’ve selected a few zstandard examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github indygreg / python-zstandard / tests / test_module_attributes.py View on Github external
def test_constants(self):
        self.assertEqual(zstd.MAX_COMPRESSION_LEVEL, 22)
        self.assertEqual(zstd.FRAME_HEADER, b"\x28\xb5\x2f\xfd")
github elemental-lf / benji / src / benji / data_backends / compression / zstd.py View on Github external
            check_func=lambda v: v >= 1 and v <= zstandard.MAX_COMPRESSION_LEVEL,
            check_message='Option level must be between 1 and {} (inclusive)'.format(zstandard.MAX_COMPRESSION_LEVEL))
github elemental-lf / benji / src / benji / transform / zstd.py View on Github external
                                               check_func=lambda v: v >= 1 and v <= zstandard.MAX_COMPRESSION_LEVEL,
                                               check_message='Option level must be between 1 and {} (inclusive)'.format(
github elemental-lf / benji / src / backy2 / data_backends / compression / zstd.py View on Github external
def __init__(self, *, materials):
        self.level = Config.get_from_dict(materials,
                                          'level',
                                          self.DEFAULT_LEVEL,
                                          types=int,
                                          check_func=lambda v: v >= 1 and v <= zstandard.MAX_COMPRESSION_LEVEL,
                                          check_message='Option level must be between 1 and {} (inclusive)'
                                                            .format(zstandard.MAX_COMPRESSION_LEVEL)
                                          )

        self.compressors = {}
        self.decompressors = {}
github elemental-lf / benji / src / benji / transform / zstd.py View on Github external
def __init__(self, *, config: Config, name: str, module_configuration: ConfigDict) -> None:
        super().__init__(config=config, name=name, module_configuration=module_configuration)

        self.level: str = Config.get_from_dict(module_configuration,
                                               'level',
                                               types=int,
                                               check_func=lambda v: v >= 1 and v <= zstandard.MAX_COMPRESSION_LEVEL,
                                               check_message='Option level must be between 1 and {} (inclusive)'.format(
                                                   zstandard.MAX_COMPRESSION_LEVEL))

        dict_data_file: str = Config.get_from_dict(module_configuration, 'dictDataFile', None, types=str)
        if dict_data_file:
            with open(dict_data_file, 'rb') as f:
                dict_data_content = f.read()
            self._dict_data = zstandard.ZstdCompressionDict(dict_data_content, dict_type=zstandard.DICT_TYPE_FULLDICT)
            self._dict_data.precompute_compress(self.level)
        else:
            self._dict_data = None

        self._local = threading.local()
github elemental-lf / benji / src / backy2 / data_backends / compression / zstd.py View on Github external
                                          check_func=lambda v: v >= 1 and v <= zstandard.MAX_COMPRESSION_LEVEL,
                                          check_message='Option level must be between 1 and {} (inclusive)'
github elemental-lf / benji / src / benji / data_backends / compression / zstd.py View on Github external
def __init__(self, *, materials):
        self.level = Config.get_from_dict(
            materials,
            'level',
            self.DEFAULT_LEVEL,
            types=int,
            check_func=lambda v: v >= 1 and v <= zstandard.MAX_COMPRESSION_LEVEL,
            check_message='Option level must be between 1 and {} (inclusive)'.format(zstandard.MAX_COMPRESSION_LEVEL))

        self.compressors = {}
        self.decompressors = {}