Sindbad~EG File Manager
�
�� h�b � � � d dl Z d dlZd dlmZ d dlmZ n# e$ r G d� d� � ZY nw xY w ddlT ddlmZm Z m
Z
n1# e$ r) ddlT ddlmZm Z m
Z
d Zn# e$ r ed
� � �w xY wY nw xY wdZ
dZd
Zdd�Zdd�Zd� Zd� Zd� ZdZ G d� de j � � Zd ZdZdZ G d� dej � � Zddddddd�d�ZdS )� N)�maxsize)�PathLikec � � e Zd ZdS )r N)�__name__�
__module__�__qualname__� � �q/builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/venv/lib64/python3.11/site-packages/pyzstd/__init__.pyr r s � � � � � ��r
r � )�*)�_train_dict�_finalize_dict�_ZSTD_DStreamInSizeTa pyzstd module: Neither C implementation nor CFFI implementation can be imported. If pyzstd module is dynamically linked to zstd library, make sure not to remove zstd library, and the run-time zstd library's version can't be lower than that at compile-time.z0.15.3z�Python bindings to Zstandard (zstd) compression library, the API is similar to
Python's bz2/lzma/zlib modules.
Documentation: https://pyzstd.readthedocs.io
GitHub: https://github.com/animalize/pyzstd
PyPI: https://pypi.org/project/pyzstd)�ZstdCompressor�RichMemZstdCompressor�ZstdDecompressor�EndlessZstdDecompressor�
CParameter�
DParameter�Strategy� ZstdError�compress�richmem_compress�
decompress�compress_stream�decompress_stream�ZstdDict�
train_dict�
finalize_dict�get_frame_info�get_frame_size�ZstdFile�open�zstd_version�zstd_version_info�zstd_support_multithread�compressionLevel_valuesc �b � t ||� � }|� | t j � � S )a� Compress a block of data, return a bytes object.
Compressing b'' will get an empty content frame (9 bytes or more).
Parameters
data: A bytes-like object, data to be compressed.
level_or_option: When it's an int object, it represents compression level.
When it's a dict object, it contains advanced compression
parameters.
zstd_dict: A ZstdDict object, pre-trained dictionary for compression.
)r r �FLUSH_FRAME��data�level_or_option� zstd_dict�comps r r r 3 s* � � �/�9�5�5�D��=�=��~�9�:�:�:r
c �L � t ||� � }|� | � � S )aB Compress a block of data, return a bytes object.
Use rich memory mode, it's faster than compress() in some cases, but
allocates more memory.
Compressing b'' will get an empty content frame (9 bytes or more).
Parameters
data: A bytes-like object, data to be compressed.
level_or_option: When it's an int object, it represents compression level.
When it's a dict object, it contains advanced compression
parameters.
zstd_dict: A ZstdDict object, pre-trained dictionary for compression.
)r r r+ s r r r C s% � � !��)�<�<�D��=�=����r
c � � t | t t f� � rt | � � S t | � � j S �N)�
isinstance�bytes� bytearray�len�
memoryview�nbytes)�dats r �_nbytesr: V s3 � ��#��y�)�*�*� ��3�x�x���c�?�?�!�!r
c �V � t |t � � st d� � �g }g }| D ]9}|� |� � |� t |� � � � �:d� |� � }|st
d� � �t |||� � }t |� � S )z�Train a zstd dictionary, return a ZstdDict object.
Parameters
samples: An iterable of samples, a sample is a bytes-like object
represents a file.
dict_size: The dictionary's maximum size, in bytes.
�+dict_size argument should be an int object.r
z6The samples are empty content, can't train dictionary.) r3 �int� TypeError�appendr: �join�
ValueErrorr r )�samples� dict_size�chunks�chunk_sizes�chunk�dict_contents r r r \ s� � � �i��%�%� G��E�F�F�F� �F��K�� +� +���
�
�e�������7�5�>�>�*�*�*�*�
�X�X�f�
�
�F�� S��Q�R�R�R�
�v�{�I�>�>�L��L�!�!�!r
c �< � t dk rdt z }t |� � �t | t � � st d� � �t |t � � st d� � �t |t � � st d� � �g }g }|D ]9}|� |� � |� t |� � � � �:d� |� � }|st d� � �t | j ||||� � }t |� � S )a� Finalize a zstd dictionary, return a ZstdDict object.
Given a custom content as a basis for dictionary, and a set of samples,
finalize dictionary by adding headers and statistics according to the zstd
dictionary format.
You may compose an effective dictionary content by hand, which is used as
basis dictionary, and use some samples to finalize a dictionary. The basis
dictionary can be a "raw content" dictionary, see is_raw parameter in
ZstdDict.__init__ method.
Parameters
zstd_dict: A ZstdDict object, basis dictionary.
samples: An iterable of samples, a sample is a bytes-like object
represents a file.
dict_size: The dictionary's maximum size, in bytes.
level: The compression level expected to use in production. The
statistics for each compression level differ, so tuning the
dictionary for the compression level can help quite a bit.
)r � � z�This function only available when the underlying zstd library's version is greater than or equal to v1.4.5, the current underlying zstd library's version is v%s.�/zstd_dict argument should be a ZstdDict object.r<