§
    HŠtj‡  ã                  ó  — d dl mZ d dlZd dlmZ d dlmZ d dlmZm	Z	m
Z
 ej        dk    r	d dlmZmZ nd dlmZmZ dZd	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 e	d¦  «        Z ed¦  «        Z e	d¦  «        Ze
dCd!„¦   «         Ze
dDd#„¦   «         ZdEd&„ZdFd(„ZdGd,„ZdHd2„Z 	 	 	 dIdJd:„Z!ddd;œdKdB„Z"dS )Lé    )ÚannotationsN)ÚCallable©Úwraps)ÚAnyÚTypeVarÚoverload)é   é
   )ÚConcatenateÚ	ParamSpeczTimothy Heysztheys@kayak.comc                  ó   — e Zd ZdS )ÚQueryExceptionN©Ú__name__Ú
__module__Ú__qualname__© ó    úJ/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/pypika/utils.pyr   r      ó   € € € € € Ø€Dr   r   c                  ó   — e Zd ZdS )ÚGroupingExceptionNr   r   r   r   r   r      r   r   r   c                  ó   — e Zd ZdS )ÚCaseExceptionNr   r   r   r   r   r      r   r   r   c                  ó   — e Zd ZdS )ÚJoinExceptionNr   r   r   r   r   r      r   r   r   c                  ó   — e Zd ZdS )ÚSetOperationExceptionNr   r   r   r   r   r   "   r   r   r   c                  ó   — e Zd ZdS )ÚRollupExceptionNr   r   r   r   r!   r!   &   r   r   r!   c                  ó   — e Zd ZdS )ÚDialectNotSupportedNr   r   r   r   r#   r#   *   r   r   r#   c                  ó   — e Zd ZdS )ÚFunctionExceptionNr   r   r   r   r%   r%   .   r   r   r%   Ú_SelfÚPÚRÚfuncú%Callable[Concatenate[_Self, P], None]Úreturnú&Callable[Concatenate[_Self, P], _Self]c                ó   — d S ©Nr   ©r)   s    r   Úbuilderr0   7   s   € ØdgÐdgr   ú"Callable[Concatenate[_Self, P], R]c                ó   — d S r.   r   r/   s    r   r0   r0   ;   s   € Ø]`Ð]`r   ú)Callable[Concatenate[_Self, P], R | None]ú*Callable[Concatenate[_Self, P], _Self | R]c                óJ   ‡ ‡— ddl Št          ‰ ¦  «        dˆˆ fd„¦   «         }|S )aº  
    Decorator for wrapper "builder" functions.  These are functions on the Query class or other classes used for
    building queries which mutate the query and return self.  To make the build functions immutable, this decorator is
    used which will deepcopy the current instance.  This decorator will return the return value of the inner function
    or the new copy of the instance.  The inner function does not need to return self.
    r   NÚselfr&   ÚargsúP.argsÚkwargsúP.kwargsr+   ú	_Self | Rc                óx   •— t          | dd¦  «        r‰                     | ¦  «        n| } ‰|g|¢R i |¤Ž}|€|S |S )NÚ	immutableT)ÚgetattrÚcopy)r6   r7   r9   Ú	self_copyÚresultr?   r)   s        €€r   Ú_copyzbuilder.<locals>._copyH   sX   ø€ å'.¨t°[À$Ñ'GÔ'GÐQ�D—I’I˜d‘O”O�OÈTˆ	Ø��iÐ1 $Ð1Ð1Ð1¨&Ð1Ð1ˆð ˆ>ØÐàˆr   )r6   r&   r7   r8   r9   r:   r+   r;   )r?   r   )r)   rB   r?   s   ` @r   r0   r0   ?   sI   øø€ ð €K€K€Kå
ˆ4�[„[ð	ð 	ð 	ð 	ð 	ð 	ñ „[ð	ð €Lr   úCallable[[_Self, str], R]c                ó>   ‡ — t          ‰ ¦  «        dˆ fd„¦   «         }|S )aÜ  
    Decorator for wrapping the __getattr__ function for classes that are copied via deepcopy.  This prevents infinite
    recursion caused by deepcopy looking for magic functions in the class. Any class implementing __getattr__ that is
    meant to be deepcopy'd should use this decorator.

    deepcopy is used by pypika in builder functions (decorated by @builder) to make the results immutable.  Any data
    model type class (stored in the Query instance) is copied.
    ÚnameÚstrr+   r(   c                ód   •— |dv r t          d| j        j        ›d|›d�¦  «        ‚ ‰| |¦  «        S )N)Ú__copy__Ú__deepcopy__Ú__getstate__Ú__setstate__Ú__getnewargs__ú'z' object has no attribute ')ÚAttributeErrorÚ	__class__r   )r6   rE   r)   s     €r   Ú_getattrzignore_copy.<locals>._getattra   sP   ø€ àð 
ð 
ð 
õ !�.ÈÌÔH_ÐH_ÐH_ÐaeÐaeÐaeÐ!fÑgÔgÐgàˆt�D˜$ÑÔÐr   )rE   rF   r+   r(   r   )r)   rP   s   ` r   Úignore_copyrQ   W   s:   ø€ õ ˆ4�[„[ð
 ð 
 ð 
 ð 
 ð 
 ñ „[ð
 ð €Or   Úvaluesúlist[bool | None]úbool | Nonec                ó@   — d„ | D ¦   «         }|rt          |¦  «        S dS )a“  
    Resolves the is_aggregate flag for an expression that contains multiple terms.  This works like a voter system,
    each term votes True or False or abstains with None.

    :param values: A list of booleans (or None) for each term in the expression
    :return: If all values are True or None, True is returned.  If all values are None, None is returned. Otherwise,
        False is returned.
    c                ó   — g | ]}|®|‘ŒS r.   r   )Ú.0Úxs     r   ú
<listcomp>z(resolve_is_aggregate.<locals>.<listcomp>z   s   € Ð1Ð1Ð1�A 1 =ˆa = = =r   N)Úall)rR   rA   s     r   Úresolve_is_aggregater[   q   s0   € ð 2Ð1˜Ð1Ñ1Ô1€FØð Ý�6‰{Œ{ÐØˆ4r   Úvaluer   Ú
quote_charú
str | NonerF   c                ó„   — |r&t          | ¦  «                             ||dz  ¦  «        } d                     | |pd¬¦  «        S )Né   z{quote}{value}{quote}Ú )r\   Úquote)rF   ÚreplaceÚformat)r\   r]   s     r   Úformat_quotesre   €   sG   € Øð ?Ý�E‘
”
×"Ò" :¨z¸A©~Ñ>Ô>ˆà"×)Ò)°¸ZÐ=MÈ2Ð)ÑNÔNÐNr   FÚsqlÚaliasÚalias_quote_charÚ
as_keywordÚboolr9   c                ób   — |€| S d                      | |rdndt          ||p|¦  «        ¬¦  «        S )Nz{sql}{_as}{alias}z AS ú )rf   Ú_asrg   )rd   re   )rf   rg   r]   rh   ri   r9   s         r   Úformat_alias_sqlrn   ‡   sL   € ð €}Øˆ
Ø×%Ò%Ø˜zÐ2�V�V¨s½-ÈÐO_ÐOmÐcmÑ:nÔ:nð &ñ ô ð r   )ÚexcÚtyper7   ro   úException | Nonerp   útype | NoneÚNonec                ó<   — |�|D ]}t          ||¦  «        s| ‚Œd S d S r.   )Ú
isinstance)ro   rp   r7   Úargs       r   Úvalidaterw   –   sE   € ØÐØð 	ð 	ˆCÝ˜c 4Ñ(Ô(ð Ø�	ðð Ðð	ð 	r   )r)   r*   r+   r,   )r)   r1   r+   r1   )r)   r3   r+   r4   )r)   rC   r+   rC   )rR   rS   r+   rT   )r\   r   r]   r^   r+   rF   )NNF)rf   rF   rg   r^   r]   r^   rh   r^   ri   rj   r9   r   r+   rF   )r7   r   ro   rq   rp   rr   r+   rs   )#Ú
__future__r   ÚsysÚcollections.abcr   Ú	functoolsr   Útypingr   r   r	   Úversion_infor   r   Útyping_extensionsÚ
__author__Ú	__email__Ú	Exceptionr   r   r   r   r   r!   r#   r%   r&   r'   r(   r0   rQ   r[   re   rn   rw   r   r   r   ú<module>r‚      s  ðØ "Ð "Ð "Ð "Ð "Ð "à 
€
€
€
Ø $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð Ø )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )àÔ�wÒÐØ-Ð-Ð-Ð-Ð-Ð-Ð-Ð-Ð-à8Ð8Ð8Ð8Ð8Ð8Ð8Ð8ð €
Ø€	ð	ð 	ð 	ð 	ð 	�Yñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	˜	ñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	�Iñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	�Iñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	˜Iñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	�iñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	˜)ñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	˜	ñ 	ô 	ð 	ð 	ˆ�ÑÔ€Ø€Iˆc�N„N€Ø€GˆC�L„L€ð 
Ø gÐ gÐ gñ 
„Ø gð 
Ø `Ð `Ð `ñ 
„Ø `ðð ð ð ð0ð ð ð ð4ð ð ð ðOð Oð Oð Oð "Ø#'Øðð ð ð ð ð 26È4ð ð ð ð ð ð ð ð r   