o
    —¨Êh¨  ã                   @  sn  d Z ddlmZ ddlZddlmZ i Zi Zi ZdZ	d%dd„Z
dd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Ze
ejejdddgd� zddlZW n	 eyN   Y nw e
ejejdddgd� zddlZW n	 eyj   Y nw e
ejejddgd� zddlZW n	 ey…   Y nw e
ejejdddgd� zddlZW n
 ey¢   Y dS w dd„ Zd d!„ Ze
eed"d#d$gd� dS )&zCompression utilities.é    )ÚannotationsN)Úensure_bytes)ÚregisterÚencodersÚget_encoderÚget_decoderÚcompressÚ
decompressc                   s4   | t ˆ < |tˆ < |rt ‡ fdd„|D ƒ¡ dS dS )a¤  Register new compression method.

    Arguments:
    ---------
        encoder (Callable): Function used to compress text.
        decoder (Callable): Function used to decompress previously
            compressed text.
        content_type (str): The mime type this compression method
            identifies as.
        aliases (Sequence[str]): A list of names to associate with
            this compression method.
    c                 3  s   � | ]}|ˆ fV  qd S ©N© )Ú.0Úalias©Úcontent_typer   úC/var/www/html/env/lib/python3.10/site-packages/kombu/compression.pyÚ	<genexpr>!   s   € zregister.<locals>.<genexpr>N)Ú	_encodersÚ	_decodersÚ_aliasesÚupdate)ÚencoderÚdecoderr   Úaliasesr   r   r   r      s
   ÿr   c                   C  s   t tƒS )z/Return a list of available compression methods.)Úlistr   r   r   r   r   r   $   s   r   c                 C  s   t  | | ¡} t|  | fS )zGet encoder by alias name.)r   Úgetr   ©Útr   r   r   r   )   s   r   c                 C  s   t t | | ¡ S )zGet decoder by alias name.)r   r   r   r   r   r   r   r   /   s   r   c                 C  s   t |ƒ\}}|t| ƒƒ|fS )z¢Compress text.

    Arguments:
    ---------
        body (AnyStr): The text to compress.
        content_type (str): mime-type of compression method to use.
    )r   r   )Úbodyr   r   r   r   r   r   4   s   r   c                 C  s   t |ƒ| ƒS )zÁDecompress compressed text.

    Arguments:
    ---------
        body (AnyStr): Previously compressed text to uncompress.
        content_type (str): mime-type of compression method used.
    )r   )r   r   r   r   r   r	   @   s   r	   zapplication/x-gzipÚgzipÚzlib)r   zapplication/x-bz2Úbzip2Úbzipzapplication/x-brotliÚbrotlizapplication/x-lzmaÚlzmaÚxzc                 C  ó   t  ¡ }| | ¡S r
   )ÚzstdÚZstdCompressorr   )r   Úcr   r   r   Úzstd_compresso   ó   
r)   c                 C  r%   r
   )r&   ÚZstdDecompressorr	   )r   Údr   r   r   Úzstd_decompresss   r*   r-   zapplication/zstdr&   Ú	zstandardr
   )Ú__doc__Ú
__future__r   r   Úkombu.utils.encodingr   r   r   r   Ú__all__r   r   r   r   r   r	   Úbz2ÚImportErrorr"   r#   r.   r&   r)   r-   r   r   r   r   Ú<module>   sp    
þÿþÿþÿþÿ
þ