
    mBNj                     J    d dl mZ ddlmZ dddddd	d
dddd
Z G d d      Zy)   )	nativestr   )list_to_dict
source_keychunk_countmemory_usagetotal_samplesretention_msecslast_timestampfirst_timestampmax_samples_per_chunk
chunk_sizeduplicate_policy)
	sourceKey
chunkCountmemoryUsagetotalSamplesretentionTimelastTimestampfirstTimestampmaxSamplesPerChunk	chunkSizeduplicatePolicyc                   R    e Zd ZdZg Zg ZdZdZdZdZ	dZ
dZdZdZdZdZd Zd Zd Zy)TSInfoz
    Hold information and statistics on the time-series.
    Can be created using ``tsinfo`` command
    https://redis.io/docs/latest/commands/ts.info/

    Handles both RESP2 (flat list) and RESP3 (dict) responses.
    Nc                    t        |t              r7|}|j                  d      xs i | _        |j                  d      xs i | _        ndt        t        t        t        |ddd         |ddd               }|j                  d      | _        t        |j                  d            | _        |j                  d      | _	        |j                  d      | _
        |j                  d      | _        |j                  d	      | _        |j                  d
      | _        |j                  d      | _        |j                  d      | _        d|v r|d   | _        | j                   dz  | _        d|v r
|d   | _        d|v rE|d   | _        t        | j$                  t&              r | j$                  j)                         | _        yyy)a  
        Hold information and statistics on the time-series.

        The supported params that can be passed as args:

        rules:
            A list of compaction rules of the time series.
        sourceKey:
            Key name for source time series in case the current series
            is a target of a rule.
        chunkCount:
            Number of Memory Chunks used for the time series.
        memoryUsage:
            Total number of bytes allocated for the time series.
        totalSamples:
            Total number of samples in the time series.
        labels:
            A list of label-value pairs that represent the metadata
            labels of the time series.
        retentionTime:
            Retention time, in milliseconds, for the time series.
        lastTimestamp:
            Last timestamp present in the time series.
        firstTimestamp:
            First timestamp present in the time series.
        maxSamplesPerChunk:
            Deprecated.
        chunkSize:
            Amount of memory, in bytes, allocated for data.
        duplicatePolicy:
            Policy that will define handling of duplicate samples.

        Can read more about on
        https://redis.io/docs/latest/develop/data-types/timeseries/configuration/#duplicate_policy
        ruleslabelsNr   r   r   r   r   r   r   r   r   r      r   r   )
isinstancedictgetr   r   zipmapr   r   r   r   r   r	   r
   r   r   r   r   r   bytesdecode)selfargsresponses      o/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/redis/commands/timeseries/info.py__init__zTSInfo.__init__,   s   H dD!H!g.4"DJ",,x06BDK CItCaCy 941:FGH!g.DJ&x||H'=>DK",,{3#<<5$LL7%\\.9'||O<&ll?;'||,<=8+)12F)GD&**R/ O ("&{3DO($,->$?D!$//7(,(=(=(D(D(F% 8 )    c                 D    	 | j                  |      S # t        $ r Y y w xY wN)__getitem__AttributeErrorr'   items     r*   r"   z
TSInfo.getm   s*    	##D)) 		s    	c                 B    t        | t        j                  ||            S r.   )getattr_FIELD_ALIASESr"   r1   s     r*   r/   zTSInfo.__getitem__s   s    t^//d;<<r,   )__name__
__module____qualname____doc__r   r   r   r   r   r	   r
   last_time_stampfirst_time_stampr   r   r   r+   r"   r/    r,   r*   r   r      sY     EFIKLMOO J?GB=r,   r   N)helpersr   utilsr   r5   r   r<   r,   r*   <module>r?      s>      !#&%'1)_= _=r,   