U
    d\                     @   s   d dl 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mZmZ ddlmZ ddl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jZdS )    N   )parse_to_list   )	ALTER_CMD
CREATE_CMDCREATERULE_CMDDEL_CMDDELETERULE_CMDGET_CMDINFO_CMDMGET_CMD
MRANGE_CMDMREVRANGE_CMDQUERYINDEX_CMD	RANGE_CMDREVRANGE_CMDTimeSeriesCommands)TSInfo)	parse_getparse_m_getparse_m_rangeparse_rangec                   @   s$   e Zd ZdZdddZd	ddZdS )

TimeSeriesz
    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jjttjjttjjttttjjt	t
tt
tttttttttttti| _|| _|j| _| j D ]\}}| j|| qbdS )z$Create a new RedisTimeSeries client.N)r   redisclientZbool_okr   r   r   intr	   r   r   r   r   r   r   r
   r   r   r   r   r   r   r   MODULE_CALLBACKSZexecute_commanditemsZset_response_callback)selfr   kwargskeyvalue r"   F/tmp/pip-unpacked-wheel-f5h5_hbx/redis/commands/timeseries/__init__.py__init__    s>                 zTimeSeries.__init__Tc                 C   sj   t | jtjrPt| jj| jj| jjj| jj| jj	| jj
| jj| jj| jjd	}n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_poolZresponse_callbackstransaction
shard_hint)
isinstancer   r   ZRedisClusterClusterPipeliner%   r&   r'   r(   r)   r*   r+   r,   _lockPipeliner.   r   )r   r/   r0   pr"   r"   r#   pipeline9   s&    zTimeSeries.pipeline)N)TN)__name__
__module____qualname____doc__r$   r6   r"   r"   r"   r#   r      s   
r   c                   @   s   e Zd ZdZdS )r2   z Cluster pipeline for the module.Nr7   r8   r9   r:   r"   r"   r"   r#   r2   ]   s   r2   c                   @   s   e Zd ZdZdS )r4   zPipeline for the module.Nr;   r"   r"   r"   r#   r4   a   s   r4   )r   Zhelpersr   commandsr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   infor   utilsr   r   r   r   r   Zclusterr2   r   r4   r"   r"   r"   r#   <module>   s   @E