Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_constants(self):
self.assertEqual(zstd.MAX_COMPRESSION_LEVEL, 22)
self.assertEqual(zstd.FRAME_HEADER, b"\x28\xb5\x2f\xfd")
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))
check_func=lambda v: v >= 1 and v <= zstandard.MAX_COMPRESSION_LEVEL,
check_message='Option level must be between 1 and {} (inclusive)'.format(
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 = {}
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()
check_func=lambda v: v >= 1 and v <= zstandard.MAX_COMPRESSION_LEVEL,
check_message='Option level must be between 1 and {} (inclusive)'
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 = {}