
    Q
i                     V    d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z
 dee         fdZ	dS )z
Wrapper for redis-py's get_protocol_version to handle edge cases.

This fixes issue #365 where ClusterPipeline objects may not have nodes_manager attribute.
    )OptionalUnion)ClusterPipeline)get_protocol_versionreturnc                 H    	 t          |           }|S # t          $ r Y dS w xY w)a  
    Safe wrapper for redis-py's get_protocol_version that handles edge cases.

    The main issue is that ClusterPipeline objects may not always have a
    nodes_manager attribute properly set, causing AttributeError.

    Args:
        client: Redis client, pipeline, or cluster pipeline object

    Returns:
        Protocol version string ("2" or "3") or None if unable to determine
    N)redis_get_protocol_versionAttributeError)clientresults     C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\redisvl/utils/redis_protocol.pyr   r      s=    +F33    tts    
!!N)__doc__typingr   r   redis.asyncio.clusterr   AsyncClusterPipelineredis.clusterredis.commands.helpersr   r	   str     r   <module>r      s     # " " " " " " " I I I I I I ) ) ) ) ) ) U U U U U UHSM      r   