
    h2                     P   d dl Z 	 d dlZdZ	 d dlZdZ	 d dlmZmZ dZ	d dl
mZ  eg d      Z edg      Zej                  e       d Zd	 Z G d
 de      Zd Z G d de      Z G d de      Z G d de      Zd Zy# e$ r dZY ~w xY w# e$ r dZY w xY w# e$ r dZ	Y w xY w)    NTF)ZstdCompressorZstdDecompressor)_SENSITIVE_COMMANDS)snappyzlibzstdismasterc                    	 |j                  d      }|d d  D ]  }|t        vr*|j	                  |       t        j                  d|       5|dk(  r-t        s'|j	                  |       t        j                  d       g|dk(  r-t        s'|j	                  |       t        j                  d       |dk(  st        r|j	                  |       t        j                  d        |S # t        $ r t        |      }Y w xY w)	N,zUnsupported compressor: r   zuWire protocol compression with snappy is not available. You must install the python-snappy module for snappy support.r   zWWire protocol compression with zlib is not available. The zlib module is not available.r   zwWire protocol compression with zstandard is not available. You must install the zstandard module for zstandard support.)
splitAttributeErrorlist_SUPPORTED_COMPRESSORSremovewarningswarn_HAVE_SNAPPY
_HAVE_ZLIB
_HAVE_ZSTD)dummyvaluecompressors
compressors       ^/var/www/html/ranktracker/api/venv/lib/python3.12/site-packages/pymongo/compression_support.pyvalidate_compressorsr   ,   s    "kk#&
 "!n P
33z*MM*FG8#Lz*MMPQ 6!*z*MM45 6!*z*MMOP!P& /  "5k"s   C( (C?>C?c                 ~    	 t        |      }|dk  s|dkD  rt        d| |fz        |S #  t        | d|d      xY w)Nz must be an integer, not .	   z$%s must be between -1 and 9, not %d.)int	TypeError
ValueError)optionr   levels      r   validate_zlib_compression_levelr%   J   sX    LE
 rzUQY2fe_DF 	FLLFEJKKs   ) <c                       e Zd Zd Zd Zy)CompressionSettingsc                      || _         || _        y N)r   zlib_compression_level)selfr   r*   s      r   __init__zCompressionSettings.__init__V   s    &&<#    c                     |r>|d   }|dk(  r
t               S |dk(  rt        | j                        S |dk(  r
t               S y y )Nr   r   r   r   )SnappyContextZlibContextr*   ZstdContext)r+   r   chosens      r   get_compression_contextz+CompressionSettings.get_compression_contextZ   sQ     ^F!$&6!"4#>#>??6!"}$ " r-   N)__name__
__module____qualname__r,   r3    r-   r   r'   r'   U   s    =%r-   r'   c                     t        j                  d      }dj                  |j                  |       |j	                         g      S )z Compress data with zlib level 0.r   r-   )r   compressobjjoincompressflush)datacobjs     r   _zlib_no_compressr?   e   s5    AD88T]]4($**,788r-   c                        e Zd ZdZed        Zy)r/      c                 ,    t        j                  |       S r)   )r   r;   r=   s    r   r;   zSnappyContext.compressn   s    t$$r-   Nr4   r5   r6   compressor_idstaticmethodr;   r7   r-   r   r/   r/   k   s    M% %r-   r/   c                       e Zd ZdZd Zy)r0      c                 r    dk(  rt         j                  | _        y dk(  rt        | _        y fd| _        y )Nr   r   c                 0    t        j                  |       S r)   )r   r;   )r=   r$   s    r   <lambda>z&ZlibContext.__init__.<locals>.<lambda>~   s    tU)C r-   )r   r;   r?   )r+   r$   s    `r   r,   zZlibContext.__init__v   s*    B; MMDMaZ-DMCDMr-   N)r4   r5   r6   rE   r,   r7   r-   r   r0   r0   s   s    MDr-   r0   c                        e Zd ZdZed        Zy)r1      c                 4    t               j                  |       S r)   )r   r;   rC   s    r   r;   zZstdContext.compress   s     ((..r-   NrD   r7   r-   r   r1   r1      s    M/ /r-   r1   c                 *   |t         j                  k(  rt        j                  t	        |             S |t
        j                  k(  rt        j                  |       S |t        j                  k(  rt               j                  |       S t        d|fz        )NzUnknown compressorId %d)r/   rE   r   
uncompressbytesr0   r   
decompressr1   r   r"   )r=   rE   s     r   rR   rR      s|    333   t--	+33	3t$$	+33	3  !,,T222m5EEFFr-   )r   r   r   ImportErrorr   r   	zstandardr   r   r   pymongo.monitoringr   setr   _NO_COMPRESSIONupdater   r%   objectr'   r?   r/   r0   r1   rR   r7   r-   r   <module>rZ      s    L
J
:J 378 zl#   * +<%& % 9%F %D& D/& /Go  L  J  Js3   B B 
B B
BBBB%$B%