Ë
    êU.j|  ã                   óF  — d dl mZ ddlmZmZmZmZ  G d„ de«      Z G d„ de«      Z G d„ d	e«      Z	 G d
„ de«      Z
 G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Zy)é    )ÚUnioné   )ÚAscÚDescÚReducerÚSortDirectionc                   ó,   ‡ — e Zd ZdZdeddfˆ fd„Zˆ xZS )ÚFieldOnlyReducerzHSee https://redis.io/docs/interact/search-and-query/search/aggregations/ÚfieldÚreturnNc                 ó2   •— t         ‰| �  |«       || _        y ©N)ÚsuperÚ__init__Ú_field©Úselfr   Ú	__class__s     €ú`C:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\redis/commands/search/reducers.pyr   zFieldOnlyReducer.__init__	   s   ø€ Ü‰Ñ˜ÔØˆ�ó    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústrr   Ú__classcell__©r   s   @r   r
   r
      s   ø„ ÙRð˜cð  d÷ ñ r   r
   c                   ó(   ‡ — e Zd ZdZdZdˆ fd„Zˆ xZS )Úcountz3
    Counts the number of results in the group
    ÚCOUNTc                 ó"   •— t         ‰| �  «        y r   ©r   r   )r   r   s    €r   r   zcount.__init__   s   ø€ Ü‰ÑÕr   )r   N)r   r   r   r   ÚNAMEr   r   r   s   @r   r   r      s   ø„ ñð €D÷ñ r   r   c                   ó0   ‡ — e Zd ZdZdZdeddfˆ fd„Zˆ xZS )ÚsumzS
    Calculates the sum of all the values in the given fields within the group
    ÚSUMr   r   Nc                 ó$   •— t         ‰| �  |«       y r   r"   r   s     €r   r   zsum.__init__    ó   ø€ Ü‰Ñ˜Õr   ©r   r   r   r   r#   r   r   r   r   s   @r   r%   r%      ó'   ø„ ñð €Dð ˜cð   d÷  ñ  r   r%   c                   ó0   ‡ — e Zd ZdZdZdeddfˆ fd„Zˆ xZS )ÚminzK
    Calculates the smallest value in the given field within the group
    ÚMINr   r   Nc                 ó$   •— t         ‰| �  |«       y r   r"   r   s     €r   r   zmin.__init__+   r(   r   r)   r   s   @r   r,   r,   $   r*   r   r,   c                   ó0   ‡ — e Zd ZdZdZdeddfˆ fd„Zˆ xZS )ÚmaxzJ
    Calculates the largest value in the given field within the group
    ÚMAXr   r   Nc                 ó$   •— t         ‰| �  |«       y r   r"   r   s     €r   r   zmax.__init__6   r(   r   r)   r   s   @r   r0   r0   /   r*   r   r0   c                   ó0   ‡ — e Zd ZdZdZdeddfˆ fd„Zˆ xZS )ÚavgzG
    Calculates the mean value in the given field within the group
    ÚAVGr   r   Nc                 ó$   •— t         ‰| �  |«       y r   r"   r   s     €r   r   zavg.__init__A   r(   r   r)   r   s   @r   r4   r4   :   r*   r   r4   c                   ó0   ‡ — e Zd ZdZdZdeddfˆ fd„Zˆ xZS )Útolistz6
    Returns all the matched properties in a list
    ÚTOLISTr   r   Nc                 ó$   •— t         ‰| �  |«       y r   r"   r   s     €r   r   ztolist.__init__L   r(   r   r)   r   s   @r   r8   r8   E   ó'   ø„ ñð €Dð ˜cð   d÷  ñ  r   r8   c                   ó0   ‡ — e Zd ZdZdZdeddfˆ fd„Zˆ xZS )Úcount_distinctzs
    Calculate the number of distinct values contained in all the results in
    the group for the given field
    ÚCOUNT_DISTINCTr   r   Nc                 ó$   •— t         ‰| �  |«       y r   r"   r   s     €r   r   zcount_distinct.__init__X   r(   r   r)   r   s   @r   r=   r=   P   s'   ø„ ñð
 €Dð ˜cð   d÷  ñ  r   r=   c                   ó   — e Zd ZdZdZy)Úcount_distinctishzÀ
    Calculate the number of distinct values contained in all the results in the
    group for the given field. This uses a faster algorithm than
    `count_distinct` but is less accurate
    ÚCOUNT_DISTINCTISHN)r   r   r   r   r#   © r   r   rA   rA   \   s   „ ñð �Dr   rA   c                   ó4   ‡ — e Zd ZdZdZdededdfˆ fd„Zˆ xZS )Úquantilezp
    Return the value for the nth percentile within the range of values for the
    field within the group.
    ÚQUANTILEr   Úpctr   Nc                 óF   •— t         ‰| �  |t        |«      «       || _        y r   )r   r   r   r   )r   r   rG   r   s      €r   r   zquantile.__init__n   s   ø€ Ü‰Ñ˜¤ C£Ô)Øˆ�r   )	r   r   r   r   r#   r   Úfloatr   r   r   s   @r   rE   rE   f   s.   ø„ ñð
 €Dð˜cð ¨ð °$÷ ñ r   rE   c                   ó0   ‡ — e Zd ZdZdZdeddfˆ fd„Zˆ xZS )ÚstddevzG
    Return the standard deviation for the values within the group
    ÚSTDDEVr   r   Nc                 ó$   •— t         ‰| �  |«       y r   r"   r   s     €r   r   zstddev.__init__z   r(   r   r)   r   s   @r   rK   rK   s   r;   r   rK   c                   ó>   ‡ — e Zd ZdZdZdedeeef   ddfˆ fd„Z	ˆ xZ
S )Úfirst_valuezR
    Selects the first value within the group according to sorting parameters
    ÚFIRST_VALUEr   Úbyfieldsr   Nc                 ó  •— g }t        |«      dk(  r2t        |d   t        «      rt        |d   t        «      r |d   |«      g}|D ]  }||j
                  |j                  gz  }Œ |g}|r	|dg|z   z  }t        ‰| �   |Ž  || _	        y)aô  
        Selects the first value of the given field within the group.

        ### Parameter

        - **field**: Source field used for the value
        - **byfields**: How to sort the results. This can be either the
            *class* of `aggregation.Asc` or `aggregation.Desc` in which
            case the field `field` is also used as the sort input.

            `byfields` can also be one or more *instances* of `Asc` or `Desc`
            indicating the sort order for these fields
        r   r   ÚBYN)
ÚlenÚ
isinstanceÚtypeÚ
issubclassr   r   Ú	DIRSTRINGr   r   r   )r   r   rQ   Ú	fieldstrsÚfÚargsr   s         €r   r   zfirst_value.__init__…   s—   ø€ ð ˆ	ä�‹M˜QÒÜ˜8 A™;¬Ô-Ü˜8 A™;¬Ô6à#˜ ™ EÓ*Ð+ˆHãˆAØ˜!Ÿ'™' 1§;¡;Ð/Ñ/‰Ið ð ˆwˆÙØ�T�F˜YÑ&Ñ&ˆDÜ‰Ñ˜$ÑØˆ�r   )r   r   r   r   r#   r   r   r   r   r   r   r   s   @r   rO   rO   ~   s7   ø„ ñð €Dð˜cð ¨e°C¸°IÑ.>ð À4÷ ñ r   rO   c                   ó4   ‡ — e Zd ZdZdZdededdfˆ fd„Zˆ xZS )Úrandom_samplezT
    Returns a random sample of items from the dataset, from the given property
    ÚRANDOM_SAMPLEr   Úsizer   Nc                 óF   •— |t        |«      g}t        ‰| �  |Ž  || _        y)z
        ### Parameter

        **field**: Field to sample from
        **size**: Return this many items (can be less)
        N)r   r   r   r   )r   r   r_   r[   r   s       €r   r   zrandom_sample.__init__­   s'   ø€ ð ”s˜4“yÐ!ˆÜ‰Ñ˜$ÑØˆ�r   )	r   r   r   r   r#   r   Úintr   r   r   s   @r   r]   r]   ¦   s.   ø„ ñð €Dð	˜cð 	¨ð 	°÷ 	ñ 	r   r]   N)Útypingr   Úaggregationr   r   r   r   r
   r   r%   r,   r0   r4   r8   r=   rA   rE   rK   rO   r]   rC   r   r   Ú<module>rd      s³   ðÝ ç :Ó :ô�wô ôˆGô ô Ð
ô  ô Ð
ô  ô Ð
ô  ô Ð
ô  ô Ðô  ô	 Ð%ô 	 ôÐ(ô ô
ˆwô 
ô Ðô  ô%�'ô %ôP�Gõ r   