
    h                       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Z
d Zd Zd	 Zd
 Zd Z e
ej                  ej                  dddg       	 ddlZ e
ej                  ej                  dddg       	 ddlZ e
ej                  ej                  ddg       	 ddlZ e
ej                  ej                  dddg       	 ddlZd Zd Z e
eedddg       y# e$ r Y nw xY w# e$ r Y Sw xY w# e$ r Y 7w xY w# e$ r Y yw xY w)zCompression utilities.    )annotationsN)ensure_bytes)registerencodersget_encoderget_decodercompress
decompressc                l    | t         <   |t        <   |rt        j                  fd|D               yy)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  &   K   | ]  }|f 
 y wN ).0aliascontent_types     L/var/www/html/backend/venv/lib/python3.12/site-packages/kombu/compression.py	<genexpr>zregister.<locals>.<genexpr>!   s     C%-Cs   N)	_encoders	_decoders_aliasesupdate)encoderdecoderr   aliasess     ` r   r   r      s3     &Il%IlC7CC     c                      t        t              S )z/Return a list of available compression methods.)listr   r   r   r   r   r   $   s    	?r   c                D    t         j                  | |       } t        |    | fS )zGet encoder by alias name.)r   getr   ts    r   r   r   )   s     QAQ<?r   c                <    t         t        j                  | |          S )zGet decoder by alias name.)r   r   r   r    s    r   r   r   /   s    X\\!Q'((r   c                D    t        |      \  }} |t        |             |fS )zCompress text.

    Arguments:
    ---------
        body (AnyStr): The text to compress.
        content_type (str): mime-type of compression method to use.
    )r   r   )bodyr   r   s      r   r	   r	   4   s(     (5G\<%&44r   c                $     t        |      |       S )zDecompress compressed text.

    Arguments:
    ---------
        body (AnyStr): Previously compressed text to uncompress.
        content_type (str): mime-type of compression method used.
    )r   )r$   r   s     r   r
   r
   @   s     %;|$T**r   zapplication/x-gzipgzipzlib)r   zapplication/x-bz2bzip2bzipzapplication/x-brotlibrotlizapplication/x-lzmalzmaxzc                L    t        j                         }|j                  |       S r   )zstdZstdCompressorr	   )r$   cs     r   zstd_compressr1   o   s    !zz$r   c                L    t        j                         }|j                  |       S r   )r.   ZstdDecompressorr
   )r$   ds     r   zstd_decompressr5   s   s    !!#||D!!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+   r6   r.   r1   r5   r   r   r   <module>r=      s[    "  -		4D&
)
	5+ 			'79= S\\^^ 7F*;=9 V__#hZ9; T]]__!FD>;@ " ]&+)>@M  		  		  		  		sH   C 8C) C4 C? C&%C&)C10C14C<;C<?DD