§
    WøÁi†?  ã                  ó  — d dl mZ d dlmZ d dlmZ d dlmZ ddlmZ ddlm	Z	 dd	l
mZ dd
l
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddlmZ ddlmZ ddlmZ  ede¬¦  «        ZerddlmZ  G d„ dej        ¦  «        Z G d„ de¦  «        Zd„ Z G d„ dej        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$d(S ))é    )Úannotations)ÚAny)ÚTYPE_CHECKING)ÚTypeVaré   )Útypes)ÚARRAYé   )Ú	coercions)Úelements)Ú
expression)Ú	functions)Úroles)Úschema)ÚColumnCollectionConstraint)ÚTEXT)ÚInternalTraversalÚ_T)Úbound)Ú_TraverseInternalsTypec                  ó˜   — e Zd ZU dZd ZdZdej        fdej        fdej        fgZ	de
d<   d„ Zdd
„Zd„ Zej        fd„Zed„ ¦   «         Zd	S )Úaggregate_order_byaà  Represent a PostgreSQL aggregate order by expression.

    E.g.::

        from sqlalchemy.dialects.postgresql import aggregate_order_by
        expr = func.array_agg(aggregate_order_by(table.c.a, table.c.b.desc()))
        stmt = select(expr)

    would represent the expression::

        SELECT array_agg(a ORDER BY b DESC) FROM table;

    Similarly::

        expr = func.string_agg(
            table.c.a,
            aggregate_order_by(literal_column("','"), table.c.a)
        )
        stmt = select(expr)

    Would represent::

        SELECT string_agg(a, ',' ORDER BY a) FROM table;

    .. versionchanged:: 1.2.13 - the ORDER BY argument may be multiple terms

    .. seealso::

        :class:`_functions.array_agg`

    Ú
postgresqlÚtargetÚtypeÚorder_byr   Ú_traverse_internalsc                ó\  — t          j        t          j        |¦  «        | _        | j        j        | _        t          |¦  «        }|dk    rt          d¦  «        ‚|dk    r,t          j        t          j        |d         ¦  «        | _        d S t          j
        |dt          j        iŽ| _        d S )Nr   z)at least one ORDER BY element is requiredr   Ú_literal_as_text_role)r   Úexpectr   ÚExpressionElementRoler   r   ÚlenÚ	TypeErrorr   r   Ú
ClauseList)Úselfr   r   Ú_lobs       úl/var/www/html/jarvis.com/web/backend/venv/lib/python3.11/site-packages/sqlalchemy/dialects/postgresql/ext.pyÚ__init__zaggregate_order_by.__init__J   s�   € ÝÔ&¥uÔ'BÀFÑKÔKˆŒØ”KÔ$ˆŒ	å�8‰}Œ}ˆØ�1Š9ˆ9ÝÐGÑHÔHÐHØ�QŠYˆYÝ%Ô,ÝÔ+¨X°a¬[ñô ˆDŒMˆMˆMõ %Ô/ØðÝ16Ô1Lðð ˆDŒMˆMˆMó    Nc                ó   — | S ©N© )r%   Úagainsts     r'   Ú
self_groupzaggregate_order_by.self_groupZ   s   € Øˆr)   c                ó   — | j         | j        fS r+   ©r   r   )r%   Úkwargss     r'   Úget_childrenzaggregate_order_by.get_children]   s   € ØŒ{˜DœMÐ)Ð)r)   c                óR   —  || j         fi |¤Ž| _          || j        fi |¤Ž| _        d S r+   r0   )r%   ÚcloneÚkws      r'   Ú_copy_internalsz"aggregate_order_by._copy_internals`   s<   € Ø�e˜DœKÐ.Ð.¨2Ð.Ð.ˆŒØ˜˜dœmÐ2Ð2¨rÐ2Ð2ˆŒˆˆr)   c                ó4   — | j         j        | j        j        z   S r+   )r   Ú_from_objectsr   )r%   s    r'   r8   z aggregate_order_by._from_objectsd   s   € àŒ{Ô(¨4¬=Ô+FÑFÐFr)   r+   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__visit_name__Ústringify_dialectr   Údp_clauseelementÚdp_typer   Ú__annotations__r(   r.   r2   r   Ú_cloner6   Úpropertyr8   r,   r)   r'   r   r       sÛ   € € € € € € ðð ð@ *€Nà$Ðà	Ð$Ô5Ð6Ø	Ð"Ô*Ð+Ø	Ð&Ô7Ð8ð3Ðð ð ð ñ ðð ð ð ð ð ð ð*ð *ð *ð %-¤Oð 3ð 3ð 3ð 3ð ðGð Gñ „XðGð Gð Gr)   r   c                  óp   ‡ — e Zd ZdZdZdZdZdZ ej	        ddd¦  «        d	„ ¦   «         Z
ˆ fd
„Zdd„Zˆ xZS )ÚExcludeConstraintzäA table-level EXCLUDE constraint.

    Defines an EXCLUDE constraint as described in the `PostgreSQL
    documentation`__.

    __ https://www.postgresql.org/docs/current/static/sql-createtable.html#SQL-CREATETABLE-EXCLUDE

    Úexclude_constraintNFr   Úwherez:class:`.ExcludeConstraint`z$:paramref:`.ExcludeConstraint.where`c                óÀ  — g }g }i | _         t          |Ž \  }}t          t          j        t          j        |¦  «        |¦  «        D ]P\  \  }}}	}
}|
�|                     |
¦  «         |�|j        n|	}|�
|| j         |<   |                     |||f¦  «         ŒQ|| _        t          j
        | g|¢R |                     d¦  «        |                     d¦  «        |                     d¦  «        dœŽ |                     dd¦  «        | _        |                     d¦  «        }|�$t          j        t          j        |¦  «        | _        |                     d	i ¦  «        | _        dS )
aÌ  
        Create an :class:`.ExcludeConstraint` object.

        E.g.::

            const = ExcludeConstraint(
                (Column('period'), '&&'),
                (Column('group'), '='),
                where=(Column('group') != 'some group'),
                ops={'group': 'my_operator_class'}
            )

        The constraint is normally embedded into the :class:`_schema.Table`
        construct
        directly, or added later using :meth:`.append_constraint`::

            some_table = Table(
                'some_table', metadata,
                Column('id', Integer, primary_key=True),
                Column('period', TSRANGE()),
                Column('group', String)
            )

            some_table.append_constraint(
                ExcludeConstraint(
                    (some_table.c.period, '&&'),
                    (some_table.c.group, '='),
                    where=some_table.c.group != 'some group',
                    name='some_table_excl_const',
                    ops={'group': 'my_operator_class'}
                )
            )

        The exclude constraint defined in this example requires the
        ``btree_gist`` extension, that can be created using the
        command ``CREATE EXTENSION btree_gist;``.

        :param \*elements:

          A sequence of two tuples of the form ``(column, operator)`` where
          "column" is either a :class:`_schema.Column` object, or a SQL
          expression element (e.g. ``func.int8range(table.from, table.to)``)
          or the name of a column as string, and "operator" is a string
          containing the operator to use (e.g. `"&&"` or `"="`).

          In order to specify a column name when a :class:`_schema.Column`
          object is not available, while ensuring
          that any necessary quoting rules take effect, an ad-hoc
          :class:`_schema.Column` or :func:`_expression.column`
          object should be used.
          The ``column`` may also be a string SQL expression when
          passed as :func:`_expression.literal_column` or
          :func:`_expression.text`

        :param name:
          Optional, the in-database name of this constraint.

        :param deferrable:
          Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
          issuing DDL for this constraint.

        :param initially:
          Optional string.  If set, emit INITIALLY <value> when issuing DDL
          for this constraint.

        :param using:
          Optional string.  If set, emit USING <index_method> when issuing DDL
          for this constraint. Defaults to 'gist'.

        :param where:
          Optional SQL expression construct or literal SQL string.
          If set, emit WHERE <predicate> when issuing DDL
          for this constraint.

        :param ops:
          Optional dictionary.  Used to define operator classes for the
          elements; works the same way as that of the
          :ref:`postgresql_ops <postgresql_operator_classes>`
          parameter specified to the :class:`_schema.Index` construct.

          .. versionadded:: 1.3.21

          .. seealso::

            :ref:`postgresql_operator_classes` - general description of how
            PostgreSQL operator classes are specified.

        NÚnameÚ
deferrableÚ	initially)rI   rJ   rK   ÚusingÚgistrG   Úops)Ú	operatorsÚzipr   Ú expect_col_expression_collectionr   ÚDDLConstraintColumnRoleÚappendrI   Ú_render_exprsr   r(   ÚgetrL   r    ÚStatementOptionRolerG   rN   )r%   r   r5   ÚcolumnsÚrender_exprsÚexpressionsrO   ÚexprÚcolumnÚstrnameÚadd_elementÚoperatorrI   rG   s                 r'   r(   zExcludeConstraint.__init__z   s‚  € ð| ˆØˆØˆŒå!$ h Ñˆ�Yå>AÝÔ6ÝÔ-¨{ñô ð ñ	?
ô ?
ð 	8ð 	8Ñ:Ñ0ˆT�6˜7 K°(ð Ð&Ø—’˜{Ñ+Ô+Ð+à"(Ð"4�6”;�;¸'ˆDàÐà'/�”˜tÑ$à×Ò  t¨XÐ 6Ñ7Ô7Ð7Ð7à)ˆÔå"Ô+Øð	
àð	
ð 	
ð —’˜‘”Ø—v’v˜lÑ+Ô+Ø—f’f˜[Ñ)Ô)ð	
ð 	
ð 	
ð 	
ð —V’V˜G VÑ,Ô,ˆŒ
Ø—’�w‘”ˆØÐÝ"Ô)­%Ô*CÀUÑKÔKˆDŒJà—6’6˜% Ñ$Ô$ˆŒˆˆr)   c                ó|   •‡— t          ¦   «                              ‰¦  «         ˆfd„| j        D ¦   «         | _        d S )Nc                óf   •— g | ]-\  }}}t          |t          ¦  «        s|n‰j        |         ||f‘Œ.S r,   )Ú
isinstanceÚstrÚc)Ú.0rZ   rI   r^   Útables       €r'   ú
<listcomp>z1ExcludeConstraint._set_parent.<locals>.<listcomp>  sU   ø€ ð 
ð 
ð 
ñ %��d˜Hõ	 ' t­SÑ1Ô1ÐD��°u´w¸t´}ØØðð
ð 
ð 
r)   )ÚsuperÚ_set_parentrT   )r%   re   r5   Ú	__class__s    ` €r'   rh   zExcludeConstraint._set_parentÿ   sR   øø€ Ý‰Œ×Ò˜EÑ"Ô"Ð"ð
ð 
ð 
ð 
ð *.Ô);ð
ñ 
ô 
ˆÔÐÐr)   c           	     óÄ   ‡ ‡— ˆ ˆfd„‰ j         D ¦   «         } ‰ j        |‰ j        ‰ j        ‰ j        ‰ j        ‰ j        dœŽ}|j                             ‰ j        ¦  «         |S )Nc                óR   •— g | ]#\  }}}t          j        |‰j        ‰¦  «        |f‘Œ$S r,   )r   Ú_copy_expressionÚparent)rd   rZ   Ú_r^   r%   Útarget_tables       €€r'   rf   z+ExcludeConstraint._copy.<locals>.<listcomp>  sJ   ø€ ð 
ð 
ð 
ñ
 "��a˜õ Ô'¨¨d¬k¸<ÑHÔHØðð
ð 
ð 
r)   )rI   rJ   rK   rG   rL   )	rT   ri   rI   rJ   rK   rG   rL   ÚdispatchÚ_update)r%   ro   r5   r   rc   s   ``   r'   Ú_copyzExcludeConstraint._copy  s‹   øø€ ð
ð 
ð 
ð 
ð 
ð
 &*Ô%7ð
ñ 
ô 
ˆð ˆDŒNØØ”Ø”Ø”nØ”*Ø”*ð
ð 
ð 
ˆð 	
Œ
×Ò˜4œ=Ñ)Ô)Ð)Øˆr)   r+   )r9   r:   r;   r<   r=   rG   Úinherit_cacheÚcreate_drop_stringify_dialectr   Ú_document_text_coercionr(   rh   rr   Ú__classcell__©ri   s   @r'   rE   rE   i   s¥   ø€ € € € € ðð ð *€Nà€EØ€Mà$0Ð!à%€XÔ%ØØ%Ø.ñô ð
~%ð ~%ñô ð
~%ð@

ð 

ð 

ð 

ð 

ðð ð ð ð ð ð ð r)   rE   c                 óB   — t           |d<   t          j        j        | i |¤ŽS )zÏPostgreSQL-specific form of :class:`_functions.array_agg`, ensures
    return type is :class:`_postgresql.ARRAY` and not
    the plain :class:`_types.ARRAY`, unless an explicit ``type_``
    is passed.

    Ú_default_array_type)r	   r   ÚfuncÚ	array_agg)Úargr5   s     r'   r{   r{     s'   € õ !&€BÐÑÝŒ>Ô# SÐ/¨BÐ/Ð/Ð/r)   c                  ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )Ú_regconfig_fnTc           	     óL  •‡ — t          |¦  «        }t          |¦  «        dk    rSt          j        t          j        |                     d¦  «        t          ‰ dd ¦  «        ‰ t          j	        ¬¦  «        }|g}ng }ˆ fd„|D ¦   «         } t          ¦   «         j        ||z   i |¤Ž d S )Nr   r   rI   )rI   Úapply_propagate_attrsÚtype_c                ór   •— g | ]3}t          j        t          j        |t	          ‰d d¦  «        ‰¬¦  «        ‘Œ4S ©rI   N)rI   r€   ©r   r    r   r!   Úgetattr©rd   rc   r%   s     €r'   rf   z*_regconfig_fn.__init__.<locals>.<listcomp>;  óX   ø€ ð 
ð 
ð 
ð õ ÔÝÔ+ØÝ˜T 6¨4Ñ0Ô0Ø&*ð	ñ ô ð
ð 
ð 
r)   )Úlistr"   r   r    r   r!   Úpopr…   r   Ú	REGCONFIGrg   r(   )r%   Úargsr1   Úinitial_argÚ
addtl_argsri   s   `    €r'   r(   z_regconfig_fn.__init__-  sÂ   øø€ Ý�D‰zŒzˆÝˆt‰9Œ9�qŠ=ˆ=Ý#Ô*ÝÔ+Ø—’˜‘”Ý˜T 6¨4Ñ0Ô0Ø&*Ý”oðñ ô ˆKð '˜-ˆKˆKàˆKð
ð 
ð 
ð 
ð ð
ñ 
ô 
ˆ
ð 	�‰ŒÔ˜;¨Ñ3Ð?¸Ð?Ð?Ð?Ð?Ð?r)   )r9   r:   r;   rs   r(   rv   rw   s   @r'   r~   r~   *  sF   ø€ € € € € Ø€Mð@ð @ð @ð @ð @ð @ð @ð @ð @r)   r~   c                  ó$   — e Zd ZdZdZej        ZdS )Úto_tsvectoraÇ  The PostgreSQL ``to_tsvector`` SQL function.

    This function applies automatic casting of the REGCONFIG argument
    to use the :class:`_postgresql.REGCONFIG` datatype automatically,
    and applies a return type of :class:`_postgresql.TSVECTOR`.

    Assuming the PostgreSQL dialect has been imported, either by invoking
    ``from sqlalchemy.dialects import postgresql``, or by creating a PostgreSQL
    engine using ``create_engine("postgresql...")``,
    :class:`_postgresql.to_tsvector` will be used automatically when invoking
    ``sqlalchemy.func.to_tsvector()``, ensuring the correct argument and return
    type handlers are used at compile and execution time.

    .. versionadded:: 2.0.0rc1

    TN)r9   r:   r;   r<   rs   r   ÚTSVECTORr   r,   r)   r'   r�   r�   G  s&   € € € € € ðð ð" €MØŒ>€D€D€Dr)   r�   c                  ó$   — e Zd ZdZdZej        ZdS )Ú
to_tsqueryaÃ  The PostgreSQL ``to_tsquery`` SQL function.

    This function applies automatic casting of the REGCONFIG argument
    to use the :class:`_postgresql.REGCONFIG` datatype automatically,
    and applies a return type of :class:`_postgresql.TSQUERY`.

    Assuming the PostgreSQL dialect has been imported, either by invoking
    ``from sqlalchemy.dialects import postgresql``, or by creating a PostgreSQL
    engine using ``create_engine("postgresql...")``,
    :class:`_postgresql.to_tsquery` will be used automatically when invoking
    ``sqlalchemy.func.to_tsquery()``, ensuring the correct argument and return
    type handlers are used at compile and execution time.

    .. versionadded:: 2.0.0rc1

    TN©r9   r:   r;   r<   rs   r   ÚTSQUERYr   r,   r)   r'   r’   r’   ]  ó&   € € € € € ðð ð" €MØŒ=€D€D€Dr)   r’   c                  ó$   — e Zd ZdZdZej        ZdS )Úplainto_tsqueryaÒ  The PostgreSQL ``plainto_tsquery`` SQL function.

    This function applies automatic casting of the REGCONFIG argument
    to use the :class:`_postgresql.REGCONFIG` datatype automatically,
    and applies a return type of :class:`_postgresql.TSQUERY`.

    Assuming the PostgreSQL dialect has been imported, either by invoking
    ``from sqlalchemy.dialects import postgresql``, or by creating a PostgreSQL
    engine using ``create_engine("postgresql...")``,
    :class:`_postgresql.plainto_tsquery` will be used automatically when
    invoking ``sqlalchemy.func.plainto_tsquery()``, ensuring the correct
    argument and return type handlers are used at compile and execution time.

    .. versionadded:: 2.0.0rc1

    TNr“   r,   r)   r'   r—   r—   s  r•   r)   r—   c                  ó$   — e Zd ZdZdZej        ZdS )Úphraseto_tsqueryaÕ  The PostgreSQL ``phraseto_tsquery`` SQL function.

    This function applies automatic casting of the REGCONFIG argument
    to use the :class:`_postgresql.REGCONFIG` datatype automatically,
    and applies a return type of :class:`_postgresql.TSQUERY`.

    Assuming the PostgreSQL dialect has been imported, either by invoking
    ``from sqlalchemy.dialects import postgresql``, or by creating a PostgreSQL
    engine using ``create_engine("postgresql...")``,
    :class:`_postgresql.phraseto_tsquery` will be used automatically when
    invoking ``sqlalchemy.func.phraseto_tsquery()``, ensuring the correct
    argument and return type handlers are used at compile and execution time.

    .. versionadded:: 2.0.0rc1

    TNr“   r,   r)   r'   r™   r™   ‰  r•   r)   r™   c                  ó$   — e Zd ZdZdZej        ZdS )Úwebsearch_to_tsqueryaá  The PostgreSQL ``websearch_to_tsquery`` SQL function.

    This function applies automatic casting of the REGCONFIG argument
    to use the :class:`_postgresql.REGCONFIG` datatype automatically,
    and applies a return type of :class:`_postgresql.TSQUERY`.

    Assuming the PostgreSQL dialect has been imported, either by invoking
    ``from sqlalchemy.dialects import postgresql``, or by creating a PostgreSQL
    engine using ``create_engine("postgresql...")``,
    :class:`_postgresql.websearch_to_tsquery` will be used automatically when
    invoking ``sqlalchemy.func.websearch_to_tsquery()``, ensuring the correct
    argument and return type handlers are used at compile and execution time.

    .. versionadded:: 2.0.0rc1

    TNr“   r,   r)   r'   r›   r›   Ÿ  r•   r)   r›   c                  ó*   ‡ — e Zd ZdZdZeZˆ fd„Zˆ xZS )Úts_headlinea¾  The PostgreSQL ``ts_headline`` SQL function.

    This function applies automatic casting of the REGCONFIG argument
    to use the :class:`_postgresql.REGCONFIG` datatype automatically,
    and applies a return type of :class:`_types.TEXT`.

    Assuming the PostgreSQL dialect has been imported, either by invoking
    ``from sqlalchemy.dialects import postgresql``, or by creating a PostgreSQL
    engine using ``create_engine("postgresql...")``,
    :class:`_postgresql.ts_headline` will be used automatically when invoking
    ``sqlalchemy.func.ts_headline()``, ensuring the correct argument and return
    type handlers are used at compile and execution time.

    .. versionadded:: 2.0.0rc1

    Tc           
     óÜ  •‡ — t          |¦  «        }t          |¦  «        dk     rd}nCt          |d         t          j        ¦  «        r!|d         j        j        t          j        u rd}nd}|rSt          j
        t          j        |                     d¦  «        ‰ t          ‰ dd ¦  «        t          j        ¬¦  «        }|g}ng }ˆ fd„|D ¦   «         } t!          ¦   «         j        ||z   i |¤Ž d S )	Né   Fr   Tr   rI   )r€   rI   r�   c                ór   •— g | ]3}t          j        t          j        |t	          ‰d d¦  «        ‰¬¦  «        ‘Œ4S rƒ   r„   r†   s     €r'   rf   z(ts_headline.__init__.<locals>.<listcomp>ç  r‡   r)   )rˆ   r"   ra   r   ÚColumnElementr   Ú_type_affinityr   r”   r   r    r   r!   r‰   r…   rŠ   rg   r(   )r%   r‹   r1   Úhas_regconfigrŒ   r�   ri   s   `     €r'   r(   zts_headline.__init__Ê  s  øø€ Ý�D‰zŒzˆõ ˆt‰9Œ9�qŠ=ˆ=à!ˆMˆMå�t˜A”w¥Ô 6Ñ7Ô7ð	!à�Q””Ô+­u¬}Ð<Ð<ð "ˆMˆMà ˆMàð 
	Ý#Ô*ÝÔ+Ø—’˜‘”Ø&*Ý˜T 6¨4Ñ0Ô0Ý”oðñ ô ˆKð '˜-ˆKˆKàˆKð
ð 
ð 
ð 
ð ð
ñ 
ô 
ˆ
ð 	�‰ŒÔ˜;¨Ñ3Ð?¸Ð?Ð?Ð?Ð?Ð?r)   )	r9   r:   r;   r<   rs   r   r   r(   rv   rw   s   @r'   r�   r�   µ  sW   ø€ € € € € ðð ð" €MØ€Dð&@ð &@ð &@ð &@ð &@ð &@ð &@ð &@ð &@r)   r�   N)%Ú
__future__r   Útypingr   r   r   Ú r   Úarrayr	   Úsqlr   r   r   r   r   r   Ú
sql.schemar   Úsql.sqltypesr   Úsql.visitorsr   r   r   r¡   r   rE   r{   ÚGenericFunctionr~   r�   r’   r—   r™   r›   r�   r,   r)   r'   ú<module>r­      s  ðð #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð Ø  Ð  Ð  Ð  Ð  Ð  Ø Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø  Ð  Ð  Ð  Ð  Ð  Ø -Ð -Ð -Ð -Ð -Ð -à€WˆT˜ÐÑÔ€àð 7Ø6Ð6Ð6Ð6Ð6Ð6ðFGð FGð FGð FGð FG˜Ô1ñ FGô FGð FGðRsð sð sð sð sÐ2ñ sô sð sðl0ð 0ð 0ð@ð @ð @ð @ð @�IÔ-¨bÔ1ñ @ô @ð @ð:ð ð ð ð �-ñ ô ð ð,ð ð ð ð �ñ ô ð ð,ð ð ð ð �mñ ô ð ð,ð ð ð ð �}ñ ô ð ð,ð ð ð ð ˜=ñ ô ð ð,;@ð ;@ð ;@ð ;@ð ;@�-ñ ;@ô ;@ð ;@ð ;@ð ;@r)   