
    +h5                        d dl Z d dlZd dlmZ d dlmZ d dlmZmZm	Z	m
Z
 	 d dlZej                  j                  d       Z eed      Z	 d dlZdZ	 d dlZdZej,                  d	k\  rd d
lmZ nd dlZd Zed        Zde
eef   defdZd Zde	eef   deeef   fdZ d Z!d Z"ddZ#ddZ$d Z%d Z&y# e$ r dZdZY uw xY w# e$ r dZY {w xY w# e$ r dZY w xY w)    N)contextmanagerwraps)AnyDictMappingUnionz0.pack_commandFT)      )metadatac                 4    ddl m}  |j                  | fi |S )z
    Returns an active Redis client generated from the given database URL.

    Will attempt to extract the database id from the path url fragment, if
    none is provided.
    r   )Redis)redis.clientr   from_url)urlkwargsr   s      >/var/www/html/venv/lib/python3.12/site-packages/redis/utils.pyr   r   %   s     #5>>#(((    c              #   T   K   | j                         }| |j                          y wN)pipelineexecute)	redis_objps     r   r   r   1   s"     A
GIIKs   &(valuereturnc                 L    t        | t              r| j                  dd      S | S )Nzutf-8replace)errors)
isinstancebytesdecoder   s    r   str_if_bytesr%   8   s(    3=eU3KWY/QVr   c                 *    t        t        |             S r   )strr%   r$   s    r   safe_strr(   >   s    |E"##r   dictsc                  :    i }| D ]  }|j                  |        |S )za
    Merge all provided dicts into 1 dict.
    *dicts : `dict`
        dictionaries to merge
    )update)r)   mergedds      r   
dict_merger.   B   s+     F a Mr   c                 .    t         j                  | |      S r   )dictfromkeys)key_listcallbacks     r   list_keys_to_dictr4   P   s    ==8,,r   c                     t               }|j                         D ]  }|D ]  }|j                  |         t        |      S )z
    Merge all items in `res` into a list.

    This command is used when sending a command to multiple nodes
    and the result from each node should be merged into a single list.

    res : 'dict'
    )setvaluesaddlist)commandresresultvr   s        r   merge_resultr>   T   sG     UFZZ\  	EJJu	 <r   c                 t    dd l }d|  d}|r	|d| dz  }|r	|d| dz  }|j                  |t        |       y )Nr   zCall to deprecated .z ()z -- Deprecated since version )category
stacklevel)warningswarnDeprecationWarning)namereasonversionrC   rD   msgs         r   warn_deprecatedrK   f   sR    vQ
'CF81~.wiq99MM# 2zMJr   c                       fd}|S )z5
    Decorator to mark a function as deprecated.
    c                 6     t                fd       }|S )Nc                  N    t        xs j                  d        | i |S )Nr   )rC   )rK   __name__)argsr   funcrG   rH   rI   s     r   wrapperz7deprecated_function.<locals>.decorator.<locals>.wrapperw   s*    D1DMM67qQ(((r   r   )rQ   rR   rG   rH   rI   s   ` r   	decoratorz&deprecated_function.<locals>.decoratorv   s     	t	) 
	) r    )rH   rI   rG   rS   s   ``` r   deprecated_functionrU   q   s    
 r   c                  ^   dt         j                  j                  j                  j	                         vryt        j
                  d      } | j                  t         j                         t        j                         }|j                  t         j                         | j                  |       yy)zo
    Set up a logger that log info logs to stdout.
    (This is used by the default push response handler)
    push_responseN)
loggingrootmanager
loggerDictkeys	getLoggersetLevelINFOStreamHandler
addHandler)loggerhandlers     r   _set_info_loggerrd      sy    
 gll22==BBDD""?3%'')&'" Er   c                  j    	 t        j                  d      } | S # t         j                  $ r d} Y | S w xY w)Nredisz99.99.99)r   rI   PackageNotFoundError)libvers    r   get_lib_versionri      s?    !!'* M (( Ms    22) rj      )rj   rj   N)'rX   sys
contextlibr   	functoolsr   typingr   r   r   r	   hiredis__version__
startswithHIREDIS_AVAILABLEhasattrHIREDIS_PACK_AVAILABLEImportErrorsslSSL_AVAILABLEcryptographyCRYPTOGRAPHY_AVAILABLEversion_info	importlibr   importlib_metadatar   r   r'   r"   r%   r(   r.   r4   r>   rK   rU   rd   ri   rT   r   r   <module>r~      s?    
 %  , ,# $//::4@@$Wn=
M#! v")	)  c5j) c $wsCx( T#s(^ -$K 
#C  #"#  M  #"#s5   )B5 C C 5	C CCCCC