o
    Lj^                     @   s,  d dl mZ d dlZd dlmZ ddlmZmZmZm	Z	 ddl
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ dd	lm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ G d
d deZ,G dd deej-j.Z.G dd deej/j0Z0G dd de,Z1G dd de,Z2dS )    )LiteralN)bool_ok   )apply_module_callbacksget_legacy_responsesget_protocol_versionparse_to_list   )	ALTER_CMD
CREATE_CMDCREATERULE_CMDDEL_CMDDELETERULE_CMDGET_CMDINFO_CMDMGET_CMD
MRANGE_CMDMREVRANGE_CMD
NRANGE_CMDNREVRANGE_CMDQUERYINDEX_CMDQUERYLABELS_CMD	RANGE_CMDREAD_CMDREVRANGE_CMDTimeSeriesCommands)TSInfo)	parse_getparse_get_unifiedparse_m_get!parse_m_get_resp3_to_resp2_legacyparse_m_get_unifiedparse_m_range#parse_m_range_resp3_to_resp2_legacyparse_m_range_unifiedparse_n_rangeparse_query_labelsparse_rangeparse_range_unifiedc                   @   s$   e Zd ZdZdddZd	ddZdS )
_TimeSeriesBasez
    This class subclasses redis-py's `Redis` and implements RedisTimeSeries's
    commands (prefixed with "ts").
    The client allows to interact with RedisTimeSeries and use all of it's
    functionality.
    Nc                 K   s  t tttttttttttt	tt
ti}tttttttttttttttttti	}i }tttttttttttttttttti	}tttttttttttttttti}tttttttttt tt tttttti	}|| _!|j"| _"t#t$| j!t%| j!||||||d| _&| j&' D ]\}	}
| j!(|	|
 qdS )z$Create a new RedisTimeSeries client.)commonresp2resp3resp2_unifiedresp3_unifiedresp3_to_resp2_legacyN))r
   r   r   r   r   r   r(   r   r%   r   r   r&   r   intr   r   r   r   r   r   r   r"   r   r   r   r   r'   r   r   r!   r$   r    r#   clientexecute_commandr   r   r   _MODULE_CALLBACKSitemsset_response_callback)selfr1   kwargsr3   _RESP2_MODULE_CALLBACKS_RESP3_MODULE_CALLBACKS_RESP2_UNIFIED_MODULE_CALLBACKS_RESP3_UNIFIED_MODULE_CALLBACKS'_RESP3_TO_RESP2_LEGACY_MODULE_CALLBACKSkv r?   `/home/djax/ivt_ai_plugin/venv/lib/python3.10/site-packages/redis/commands/timeseries/__init__.py__init__9   s   z_TimeSeriesBase.__init__Tc                 C   sp   t | jtjr+t| jj| jj| jjj| jj| jj	| jj
 | jj| jj| jjd	}|S t| jj| j||d}|S )aL  Creates a pipeline for the TimeSeries module, that can be used
        for executing only TimeSeries commands and core commands.

        Usage example:

        r = redis.Redis()
        pipe = r.ts().pipeline()
        for i in range(100):
            pipeline.add("with_pipeline", i, 1.1 * i)
        pipeline.execute()

        )	nodes_managercommands_parserstartup_nodesresult_callbackscluster_response_callbackscluster_error_retry_attemptsread_from_replicasreinitialize_stepslock)connection_poolresponse_callbackstransaction
shard_hint)
isinstancer1   redisRedisClusterClusterPipelinerB   rC   rD   rE   rF   retryget_retriesrH   rI   _lockPipelinerK   r3   )r6   rM   rN   pr?   r?   r@   pipeline   s(   
z_TimeSeriesBase.pipeline)N)TN)__name__
__module____qualname____doc__rA   rX   r?   r?   r?   r@   r)   1   s    
Lr)   c                   @      e Zd ZdZdS )rR   z Cluster pipeline for the module.NrY   rZ   r[   r\   r?   r?   r?   r@   rR          rR   c                   @   r]   )rV   zPipeline for the module.Nr^   r?   r?   r?   r@   rV      r_   rV   c                   @      e Zd ZU dZed ed< dS )
TimeSeriesF_is_async_clientNrY   rZ   r[   rb   r   __annotations__r?   r?   r?   r@   ra         
 ra   c                   @   r`   )AsyncTimeSeriesTrb   Nrc   r?   r?   r?   r@   rf      re   rf   )3typingr   rP   redis._parsers.helpersr   helpersr   r   r   r   commandsr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   infor   utilsr   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   clusterrR   r1   rV   ra   rf   r?   r?   r?   r@   <module>   s    P8x