
    +h                     0    d dl mZ ddlmZ  G d d      Zy)   )	nativestr   )list_to_dictc                   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://oss.redis.com/redistimeseries/commands/#tsinfo.
    Nc                    t        t        t        t        |ddd         |ddd               }|j	                  d      | _        |j	                  d      | _        |j	                  d      | _        |j	                  d      | _        |j	                  d      | _	        t        |j	                  d	            | _        |j	                  d
      | _        |j	                  d      | _        |j	                  d      | _        d|v r|d   | _        | j                  dz  | _        d|v r
|d   | _        d|v rG|d   | _        t%        | j"                        t&        k(  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://oss.redis.com/redistimeseries/configuration/#duplicate_policy
        Nr   r   rules	sourceKey
chunkCountmemoryUsagetotalSampleslabelsretentionTimelastTimestampfirstTimestampmaxSamplesPerChunk   	chunkSizeduplicatePolicy)dictzipmapr   getr	   
source_keychunk_countmemory_usagetotal_samplesr   r   retention_msecslast_timestampfirst_timestampmax_samples_per_chunk
chunk_sizeduplicate_policytypebytesdecode)selfargsresponses      Q/var/www/html/venv/lib/python3.12/site-packages/redis/commands/timeseries/info.py__init__zTSInfo.__init__   sV   H C	4!95tADqDzBC\\'*
",,{3#<<5$LL7%\\.9"8<<#9:'||O<&ll?;'||,<=8+)12F)GD&**R/ O ("&{3DO($,->$?D!D))*e3(,(=(=(D(D(F% 4 )    c                 D    	 | j                  |      S # t        $ r Y y w xY wN)__getitem__AttributeErrorr'   items     r*   r   z
TSInfo.getT   s*    	##D)) 		s    	c                     t        | |      S r.   )getattrr1   s     r*   r/   zTSInfo.__getitem__Z   s    tT""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8Gt#r,   r   N)helpersr   utilsr   r   r;   r,   r*   <module>r>      s     V# V#r,   