Ë
    êU.jø,  ã                   óÆ   — d dl mZmZ  e«       Z G d„ d«      Z G d„ d«      Z G d„ d«      Z G d„ d	e«      Z G d
„ de«      Z	 G d„ d«      Z
 G d„ d«      Z G d„ d«      Zy)é    )ÚListÚUnionc                   ó(   — e Zd Zddededdfd„Zd„ Zy)ÚLimitÚoffsetÚcountÚreturnNc                 ó    — || _         || _        y ©N)r   r   )Úselfr   r   s      úcC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\redis/commands/search/aggregation.pyÚ__init__zLimit.__init__   s   € ØˆŒØˆ�
ó    c                 ót   — | j                   r+dt        | j                  «      t        | j                   «      gS g S )NÚLIMIT)r   Ústrr   ©r   s    r   Ú
build_argszLimit.build_args   s,   € Ø�:Š:ØœS §¡Ó-¬s°4·:±:«Ð?Ð?àˆIr   )r   r   ©Ú__name__Ú
__module__Ú__qualname__Úintr   r   © r   r   r   r      s!   „ ñ˜sð ¨sð ¸4ó ór   r   c                   óV   — e Zd ZdZdZdee   ddfd„Zdedd fd„Ze	dee   fd„«       Z
y)	ÚReducerzr
    Base reducer object for all reducers.

    See the `redisearch.reducers` module for the actual reducers.
    NÚargsr	   c                 ó.   — || _         d | _        d | _        y r   )Ú_argsÚ_fieldÚ_alias©r   r   s     r   r   zReducer.__init__   s   € ØˆŒ
ØˆŒØˆ�r   Úaliasc                 óp   — |t         u r&| j                  st        d«      ‚| j                  dd }|| _        | S )a  
        Set the alias for this reducer.

        ### Parameters

        - **alias**: The value of the alias for this reducer. If this is the
            special value `aggregation.FIELDNAME` then this reducer will be
            aliased using the same name as the field upon which it operates.
            Note that using `FIELDNAME` is only possible on reducers which
            operate on a single field value.

        This method returns the `Reducer` object making it suitable for
        chaining.
        z(Cannot use FIELDNAME alias with no fieldé   N)Ú	FIELDNAMEr    Ú
ValueErrorr!   )r   r#   s     r   r#   zReducer.alias    s:   € ð ”IÑØ—;’;Ü Ð!KÓLÐLà—K‘K  �OˆEØˆŒØˆr   c                 ó   — | j                   S r   )r   r   s    r   r   zReducer.args7   s   € à�z‰zÐr   )r   r   r   Ú__doc__ÚNAMEr   r   r   r#   Úpropertyr   r   r   r   r   r      sW   „ ñð €Dð˜d 3™ið ¨Dó ð
˜3ð  9ó ð. ð�d˜3‘iò ó ñr   r   c                   ó$   — e Zd ZdZdZdeddfd„Zy)ÚSortDirectionz@
    This special class is used to indicate sort direction.
    NÚfieldr	   c                 ó   — || _         y r   )r.   )r   r.   s     r   r   zSortDirection.__init__C   s	   € Øˆ�
r   )r   r   r   r)   Ú	DIRSTRINGr   r   r   r   r   r-   r-   <   s!   „ ñð €Ið˜cð  dô r   r-   c                   ó   — e Zd ZdZdZy)ÚAsczK
    Indicate that the given field should be sorted in ascending order
    ÚASCN©r   r   r   r)   r0   r   r   r   r2   r2   G   s   „ ñð �Ir   r2   c                   ó   — e Zd ZdZdZy)ÚDesczL
    Indicate that the given field should be sorted in descending order
    ÚDESCNr4   r   r   r   r6   r6   O   s   „ ñð �Ir   r6   c                   ó  — e Zd ZdZddeddfd„Zdee   dd fd„Zdee   dee	ee	   f   dd fd	„Z
dd
„Zdededd fd„Zdee   dd fd„Zdeeee   f   dd fd„Zdd„Zdd„Zdedd fd„Zdd„Zddededd fd„Zdee   fd„Zdedd fd„Zy)ÚAggregateRequestzH
    Aggregation request which can be passed to `Client.aggregate`.
    Úqueryr	   Nc                 óž   — || _         g | _        g | _        d| _        d| _        d| _        d| _        g | _        d| _        d| _	        d| _
        y)a}  
        Create an aggregation request. This request may then be passed to
        `client.aggregate()`.

        In order for the request to be usable, it must contain at least one
        group.

        - **query** Query string for filtering records.

        All member methods (except `build_args()`)
        return the object itself, making them useful for chaining.
        Fr   NÚTFIDF)Ú_queryÚ_aggregateplanÚ_loadfieldsÚ_loadallÚ_maxÚ_with_schemaÚ	_verbatimÚ_cursorÚ_dialectÚ_add_scoresÚ_scorer)r   r:   s     r   r   zAggregateRequest.__init__\   sU   € ð ˆŒØ ˆÔØˆÔØˆŒØˆŒ	Ø!ˆÔØˆŒØˆŒØˆŒØ ˆÔØˆ�r   Úfieldsc                 óR   — |r| j                   j                  |«       | S d| _        | S )aC  
        Indicate the fields to be returned in the response. These fields are
        returned in addition to any others implicitly specified.

        ### Parameters

        - **fields**: If fields not specified, all the fields will be loaded.
        Otherwise, fields should be given in the format of `@field`.
        T)r?   Úextendr@   )r   rH   s     r   ÚloadzAggregateRequest.loadu   s0   € ñ Ø×Ñ×#Ñ# FÔ+ð ˆð !ˆDŒMØˆr   Úreducersc           	      óœ  — t        |t        «      r|gn|}t        |t        «      r|gn|}dt        t        |«      «      g|¢}|D ]i  }|d|j                  t        t        |j
                  «      «      gz  }|j                  |j
                  «       |j                  €ŒY|d|j                  gz  }Œk | j                  j                  |«       | S )a|  
        Specify by which fields to group the aggregation.

        ### Parameters

        - **fields**: Fields to group by. This can either be a single string,
            or a list of strings. both cases, the field should be specified as
            `@field`.
        - **reducers**: One or more reducers. Reducers may be found in the
            `aggregation` module.
        ÚGROUPBYÚREDUCEÚAS)	Ú
isinstancer   r   Úlenr*   r   rJ   r!   r>   )r   rH   rL   ÚretÚreducers        r   Úgroup_byzAggregateRequest.group_by…   sµ   € ô (¨´Ô4�&‘¸&ˆÜ!+¨H´gÔ!>�H‘:ÀHˆàœ#œc &›kÓ*Ð4¨VÐ4ˆÛˆGØ�H˜gŸl™l¬C´°G·L±LÓ0AÓ,BÐCÑCˆCØ�J‰J�w—|‘|Ô$Ø�~‰~Ñ)Ø˜˜gŸn™nÐ-Ñ-‘ð	  ð 	×Ñ×"Ñ" 3Ô'Øˆr   c                 ó†   — |j                  «       D ]-  \  }}d|g}|�|d|gz  }| j                  j                  |«       Œ/ | S )aQ  
        Specify one or more projection expressions to add to each result

        ### Parameters

        - **kwexpr**: One or more key-value pairs for a projection. The key is
            the alias for the projection, and the value is the projection
            expression itself, for example `apply(square_root="sqrt(@foo)")`
        ÚAPPLYrP   )Úitemsr>   rJ   )r   Úkwexprr#   ÚexprrS   s        r   ÚapplyzAggregateRequest.apply    sP   € ð "Ÿ<™<ž>‰KˆE�4Ø˜D�/ˆCØÐ Ø˜˜e�}Ñ$�Ø×Ñ×&Ñ& sÕ+ð	 *ð ˆr   r   Únumc                 óp   — t        ||«      }| j                  j                  |j                  «       «       | S )a  
        Sets the limit for the most recent group or query.

        If no group has been defined yet (via `group_by()`) then this sets
        the limit for the initial pool of results from the query. Otherwise,
        this limits the number of items operated on from the previous group.

        Setting a limit on the initial search results may be useful when
        attempting to execute an aggregation on a sample of a large data set.

        ### Parameters

        - **offset**: Result offset from which to begin paging
        - **num**: Number of results to return


        Example of sorting the initial results:

        ```
        AggregateRequest("@sale_amount:[10000, inf]")            .limit(0, 10)            .group_by("@state", r.count())
        ```

        Will only group by the states found in the first 10 results of the
        query `@sale_amount:[10000, inf]`. On the other hand,

        ```
        AggregateRequest("@sale_amount:[10000, inf]")            .limit(0, 1000)            .group_by("@state", r.count()            .limit(0, 10)
        ```

        Will group all the results matching the query, but only return the
        first 10 groups.

        If you only wish to return a *top-N* style query, consider using
        `sort_by()` instead.

        )r   r>   rJ   r   )r   r   r\   Ú_limits       r   ÚlimitzAggregateRequest.limit²   s3   € ôT �v˜sÓ#ˆØ×Ñ×"Ñ" 6×#4Ñ#4Ó#6Ô7Øˆr   c                 ó€  — t        |t        t        f«      r|g}g }|D ]4  }t        |t        «      r||j                  |j                  gz  }Œ/||gz  }Œ6 dt        t        |«      «      g}|j                  |«       |j                  dd«      }|dkD  r|dt        |«      gz  }| j                  j                  |«       | S )a,  
        Indicate how the results should be sorted. This can also be used for
        *top-N* style queries

        ### Parameters

        - **fields**: The fields by which to sort. This can be either a single
            field or a list of fields. If you wish to specify order, you can
            use the `Asc` or `Desc` wrapper classes.
        - **max**: Maximum number of results to return. This can be
            used instead of `LIMIT` and is also faster.


        Example of sorting by `foo` ascending and `bar` descending:

        ```
        sort_by(Asc("@foo"), Desc("@bar"))
        ```

        Return the top 10 customers:

        ```
        AggregateRequest()            .group_by("@customer", r.sum("@paid").alias(FIELDNAME))            .sort_by(Desc("@paid"), max=10)
        ```
        ÚSORTBYÚmaxr   ÚMAX)	rQ   r   r-   r.   r0   rR   rJ   Úgetr>   )r   rH   ÚkwargsÚfields_argsÚfrS   rb   s          r   Úsort_byzAggregateRequest.sort_byà   s»   € ô8 �fœs¤MÐ2Ô3Ø�XˆFàˆÛˆAÜ˜!œ]Ô+Ø §¡¨¯©Ð5Ñ5‘à ˜sÑ"‘ð	 ð œœS Ó-Ó.Ð/ˆØ�
‰
�;ÔØ�j‰j˜ Ó"ˆØ�Š7Ø�Eœ3˜s›8Ð$Ñ$ˆCà×Ñ×"Ñ" 3Ô'Øˆr   Úexpressionsc                 ót   — t        |t        «      r|g}|D ]  }| j                  j                  d|g«       Œ! | S )zÿ
        Specify filter for post-query results using predicates relating to
        values in the result set.

        ### Parameters

        - **fields**: Fields to group by. This can either be a single string,
            or a list of strings.
        ÚFILTER)rQ   r   r>   rJ   )r   ri   Ú
expressions      r   ÚfilterzAggregateRequest.filter  s?   € ô �k¤3Ô'Ø&˜-ˆKã%ˆJØ×Ñ×&Ñ&¨°*Ð'=Õ>ð &ð ˆr   c                 ó   — d| _         | S )z|
        If set, the `schema` property will contain a list of `[field, type]`
        entries in the result object.
        T)rB   r   s    r   Úwith_schemazAggregateRequest.with_schema!  s   € ð
 !ˆÔØˆr   c                 ó   — d| _         | S )zM
        If set, includes the score as an ordinary field of the row.
        T)rF   r   s    r   Ú
add_scoreszAggregateRequest.add_scores)  s   € ð  ˆÔØˆr   Úscorerc                 ó   — || _         | S )zÚ
        Use a different scoring function to evaluate document relevance.
        Default is `TFIDF`.

        :param scorer: The scoring function to use
                       (e.g. `TFIDF.DOCNORM` or `BM25`)
        )rG   )r   rr   s     r   rr   zAggregateRequest.scorer0  s   € ð ˆŒØˆr   c                 ó   — d| _         | S )NT)rC   r   s    r   ÚverbatimzAggregateRequest.verbatim;  s   € ØˆŒØˆr   r   Úmax_idlec                 óh   — dg}|r|dt        |«      gz  }|r|dt        |dz  «      gz  }|| _        | S )NÚ
WITHCURSORÚCOUNTÚMAXIDLEiè  )r   rD   )r   r   rv   r   s       r   ÚcursorzAggregateRequest.cursor?  sF   € Øˆ~ˆÙØ�Wœc %›jÐ)Ñ)ˆDÙØ�Y¤ H¨t¡OÓ 4Ð5Ñ5ˆDØˆŒØˆr   c                 ó  — | j                   g}| j                  r|j                  d«       | j                  r|j                  d«       | j                  r|j                  d| j                  g«       | j                  r|j                  d«       | j                  r|| j                  z  }| j                  r#|j                  d«       |j                  d«       ne| j                  rY|j                  d«       |j                  t        t        | j                  «      «      «       |j                  | j                  «       | j                  r|j                  d| j                  g«       |j                  | j                  «       |S )NÚ
WITHSCHEMAÚVERBATIMÚSCORERÚ	ADDSCORESÚLOADÚ*ÚDIALECT)r=   rB   ÚappendrC   rG   rJ   rF   rD   r@   r?   r   rR   rE   r>   )r   rS   s     r   r   zAggregateRequest.build_argsH  s  € à�{‰{ˆmˆà×ÒØ�J‰J�|Ô$à�>Š>Ø�J‰J�zÔ"à�<Š<Ø�J‰J˜ $§,¡,Ð/Ô0à×ÒØ�J‰J�{Ô#à�<Š<Ø�4—<‘<ÑˆCà�=Š=Ø�J‰J�vÔØ�J‰J�s�Oà×ÒØ�J‰J�vÔØ�J‰J”sœ3˜t×/Ñ/Ó0Ó1Ô2Ø�J‰J�t×'Ñ'Ô(à�=Š=Ø�J‰J˜	 4§=¡=Ð1Ô2à�
‰
�4×&Ñ&Ô'àˆ
r   Údialectc                 ó   — || _         | S )zƒ
        Add a dialect field to the aggregate command.

        - **dialect** - dialect version to execute the query under
        )rE   )r   r…   s     r   r…   zAggregateRequest.dialectk  s   € ð  ˆŒØˆr   )r‚   )r	   r9   )r   g        )r   r   r   r)   r   r   r   rK   r   r   rU   r[   r   r_   rh   rm   ro   rq   rr   ru   Úfloatr{   r   r…   r   r   r   r9   r9   W   s  „ ññ˜cð ¨Dó ð2˜D ™Ið Ð*<ó ð Ø˜3‘iðØ,1°'¸4À¹=Ð2HÑ,Iðà	óó6ð$,˜Cð , cð ,Ð.@ó ,ð\-˜t C™yð -Ð7Ió -ð^ %¨¨T°#©Y¨Ñ"7ð Ð<Nó ó$óð	˜Sð 	Ð%7ó 	óñ˜Cð ¨uð Ð?Qó ð!˜D ™Ió !ðF˜sð Ð'9ô r   r9   c                   ó"   — e Zd Zdeddfd„Zd„ Zy)ÚCursorÚcidr	   Nc                 ó.   — || _         d| _        d| _        y )Nr   )rŠ   rv   r   ©r   rŠ   s     r   r   zCursor.__init__v  s   € ØˆŒØˆŒØˆ�
r   c                 óÊ   — t        | j                  «      g}| j                  r|dt        | j                  «      gz  }| j                  r|dt        | j                  «      gz  }|S )Nrz   ry   )r   rŠ   rv   r   r"   s     r   r   zCursor.build_args{  sS   € Ü�D—H‘H“ˆˆØ�=Š=Ø�Y¤ D§M¡MÓ 2Ð3Ñ3ˆDØ�:Š:Ø�Wœc $§*¡*›oÐ.Ñ.ˆDØˆr   r   r   r   r   r‰   r‰   u  s   „ ð˜Cð  Dó ó
r   r‰   c                   ó,   — e Zd Zdeddfd„Zdeeffd„Zy)ÚAggregateResultr{   r	   Nc                 ó.   — || _         || _        || _        y r   )Úrowsr{   Úschema)r   r‘   r{   r’   s       r   r   zAggregateResult.__init__…  s   € ØˆŒ	ØˆŒØˆ�r   c           	      óÊ   — | j                   r| j                   j                  nd}d| j                  j                  › dt	        | «      d›dt        | j                  «      › d|› d�	S )NéÿÿÿÿÚ<z at 0xÚxz Rows=z	, Cursor=Ú>)r{   rŠ   Ú	__class__r   ÚidrR   r‘   rŒ   s     r   Ú__repr__zAggregateResult.__repr__Š  sZ   € Ø!%§¢ˆd�k‰k�oŠo°"ˆà�—‘×'Ñ'Ð(¨¬r°$«x¸¨lð ;Ü˜Ÿ	™	“NÐ# 9¨S¨E°ð4ð	
r   )r   r   r   r‰   r   r   rš   r   r   r   r�   r�   „  s%   „ ð Vð ¸ó ð

˜3 ˜*ô 
r   r�   N)Útypingr   r   Úobjectr&   r   r   r-   r2   r6   r9   r‰   r�   r   r   r   Ú<module>r�      sg   ðß á‹H€	÷	ñ 	÷'ñ '÷Tñ ôˆ-ô ôˆ=ô ÷[ñ [÷|ñ ÷
ò 
r   