Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : claqxcrl ( 523)
PHP Version : 8.1.32
Disable Function : NONE
Directory :  /opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/__pycache__/elements.cpython-312.pyc
�

���g�����dZddlmZddlmZddlmZddlZddlZddl	Z	ddl
Z
ddl
mZddl
mZddl
m
Z
dd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl m!Z!ddl m"Z"ddl m#Z#ddl m$Z$ddl m%Z%dd l&m'Z'dd!l&m(Z(dd"l&m)Z)dd#l&m*Z*dd$l+m,Z,dd%l+m-Z-dd&l.m/Z/dd'l.m0Z0dd(l.m1Z1dd)l.m2Z2dd*l.m3Z3dd+l.m4Z4dd,l.m5Z5dd-l.m6Z6dd.l.m7Z7dd/l.m8Z8dd0l9m:Z:dd1l9m;Z;dd2l!m<Z<dd3l"m=Z=dd4l$m>Z>dd5l?m@Z@dd6l?mAZAdd7l?mBZBdd8l?mCZCdd9l?mDZDd:d;l mEZEd:d<l mFZFd:d=l mGZGd:d>lGmHZHd:d?lGmIZId:d@lJmKZKd:dAlJmLZLd:dBlJmMZMe
j:r�ddCl&mNZNddDl&mOZOddEl&mPZPddFl&mQZQddGl&mRZRddHl&mSZSddIl&mTZTddJl.mUZUddKl9mVZVddLl9mWZWddMlXmYZYddNlXmZZZddOl[m\Z\ddPl"m]Z]ddQl^m_Z_ddRl^m`Z`ddSl^maZaddTl^mbZbddUlcmdZdddVlcmeZeddWlcmfZfddXlcmgZgddYlhmiZiddZl%mjZjdd[l?mkZkdd\l?mlZldd]l?mmZmd:d^lnmoZod:d_lnmpZpd:d`lqmrZrd:dalqmsZsd:dblqmtZtd:dclqmuZud:ddlqmvZvd:delwmxZxeeyefZzeeye{efZ|edfdg�h�Z}ediedj�k�Z~edldg�h�Zedmdn�h�Z�edodp�h�Z�e	d�							d�dq��Z�e		d�							d�dr��Z�e		d�							d�ds��Z�		d�							d�dt�Z�	d�					d�du�Z�Gdv�dweD�Z�eF�j
Gdx�dye-e:e>eAe���Z�Gdz�d{e��Z�Gd|�d}e#�je#�je#�je��Z�Gd~�dee~e=eI�Z�Gd��d�e�e~e#�je~eI�Z�e�Z�Gd��d�e#�j e#�j"e#�j$e#�j&e}e#�j(e#�je#�j*e#�je#�je#�j,e�e}e��Z�Gd��d�e�e}�Z�Gd��d�e�e}�Z�Gd��d�e#�j4e�e}�Z�Gd��d�e��Z�Gd��d�e#�je#�j,e#�j"e#�j$e#�j(e#�j:e#�j<e#�j4e4e3e�e#�j&eeF�j>d��Z�Gd��d�e8e#�jBde�d�Z�e��jG�Gd��d�e8e#�jBe�e�e��Z�e��jG�Gd��d�e8e#�jBe�e�e��Z�e��jG�Gd��d�e#�j4e#�j(e#�je#�je��Z�Gd��d�e�e}�Z�Gd��d�e�e}�Z�Gd��d�e�e��Z�e��jVZ�e��jXZ�Gd��d�e�e�eed�f�ZGd��d�e�e}�Z�Gd��d�e�e}�Z�Gd��d�e�e}�Z�Gd��d�e�e}�Z�Gd��d�e�e{�Z�Gd��d�e�e}�Z�Gd��d�e�e�Z�Gd��d�e�e}�Z�Gd��d�e�e}�Z�Gd��d�e�e�e�e��Z�Gd��d�e�e}�Z�Gd��d�e�e�Z�Gd��d�e�e�Z�Gd��d�e��Z�Gd��d�e�e�e}�Z�Gd��d�e�e}�Z�Gd��d�e�Z�e��j|Z�e��j~Z�ee{e�fZ�Gd��d�e�e}�Z�GdÄd�e�e}�Z�Gdńd�e4e�e}�Z�GdDŽd�e�e}�Z�eLdɫZ�Gdʄd�e#�j�e}e�e}�Z�Gd̄d�e#�j�e#�j�e}e#�j�e6e�e}�Z�Gd΄d�e�e}�Z�GdЄd�e�e��Z�Gd҄d�e3e��Z�GdԄd�eΫZ�Gdքd�eΫZ�Gd؄d�eΫZ�Gdڄd�eG�j�e̫Z�d�d܄Z�d�dބZ�d�d߄Z�Gd�d�eG�j�d��Z�Gd�d�e,�Z�Gd�d�eӫZ�Gd�d�eګZ�e�Z�Gd�d�eګZ�y)�z�Core SQL expression elements, including :class:`_expression.ClauseElement`,
:class:`_expression.ColumnElement`, and derived classes.

�)�annotations)�Decimal)�EnumN)�AbstractSet)�Any)�Callable)�cast)�Dict)�	FrozenSet)�Generic)�Iterable)�Iterator)�List)�Mapping)�Optional)�overload)�Sequence)�Set)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union�)�	coercions)�	operators)�roles)�
traversals)�type_api)�has_schema_attr)�is_named_from_clause)�is_quoted_name)�
is_tuple_type)�	Annotated)�SupportsWrappingAnnotations)�_clone)�_expand_cloned)�_generative)�_NoArg)�
Executable)�
Generative)�HasMemoized)�	Immutable)�NO_ARG)�SingletonConstant)�MemoizedHasCacheKey)�NO_CACHE)�_document_text_coercion)�ColumnOperators)�HasCopyInternals)�cloned_traverse)�ExternallyTraversible)�InternalTraversal)�traverse)�	Visitable�)�exc)�
inspection)�util)�!HasMemoized_ro_memoized_attribute)�
TypingOnly)�Literal)�	ParamSpec)�Self)�_ByArgument)�_ColumnExpressionArgument)�#_ColumnExpressionOrStrLabelArgument)�_HasDialect)�	_InfoType)�_PropagateAttrsType)�_TypeEngineArgument)�	ColumnSet)�_CacheKeyTraversalType)�CacheKey)�Compiled)�SQLCompiler)�FunctionElement)�OperatorType)�Column)�DefaultGenerator)�FetchedValue)�
ForeignKey)�_SelectIterable)�
FromClause)�NamedFromClause)�
TextualSelect)�	TupleType)�
TypeEngine)�_CloneCallableType)�_TraverseInternalsType)�anon_map)�
Connection)�Dialect)�_CoreMultiExecuteParams)�
CacheStats)�CompiledCacheType)�CoreExecuteOptionsParameter)�SchemaTranslateMapType)�Result�_Tr)�bound�_T_coT)rg�	covariant�_OPT�_NT�_NUMERIC�_NMT�_NUMBERc��y�N���value�type_�literal_executes   �H/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/elements.py�literalrw����
�c��yrprqrrs   rvrwrw�rxryc��yrprqrrs   rvrwrw�s��
ryc�P�tjtj|||��S)aReturn a literal clause, bound to a bind parameter.

    Literal clauses are created automatically when non-
    :class:`_expression.ClauseElement` objects (such as strings, ints, dates,
    etc.) are
    used in a comparison operation with a :class:`_expression.ColumnElement`
    subclass,
    such as a :class:`~sqlalchemy.schema.Column` object.  Use this function
    to force the generation of a literal clause, which will be created as a
    :class:`BindParameter` with a bound value.

    :param value: the value to be bound. Can be any Python object supported by
     the underlying DB-API, or is translatable via the given type argument.

    :param type\_: an optional :class:`~sqlalchemy.types.TypeEngine` which will
     provide bind-parameter translation for this literal.

    :param literal_execute: optional bool, when True, the SQL engine will
     attempt to render the bound value directly in the SQL statement at
     execution time rather than providing as a parameter value.

     .. versionadded:: 2.0

    )rtru)r�expectr�LiteralValueRolerrs   rvrwrw�s)��:���
���
��'�	�ryc��t||d��S)a�Produce a :class:`.ColumnClause` object that has the
    :paramref:`_expression.column.is_literal` flag set to True.

    :func:`_expression.literal_column` is similar to
    :func:`_expression.column`, except that
    it is more often used as a "standalone" column expression that renders
    exactly as stated; while :func:`_expression.column`
    stores a string name that
    will be assumed to be part of a table and may be quoted as such,
    :func:`_expression.literal_column` can be that,
    or any other arbitrary column-oriented
    expression.

    :param text: the text of the expression; can be any SQL expression.
      Quoting rules will not be applied. To specify a column-name expression
      which should be subject to quoting rules, use the :func:`column`
      function.

    :param type\_: an optional :class:`~sqlalchemy.types.TypeEngine`
      object which will
      provide result-set translation and additional expression semantics for
      this column. If left as ``None`` the type will be :class:`.NullType`.

    .. seealso::

        :func:`_expression.column`

        :func:`_expression.text`

        :ref:`tutorial_select_arbitrary_text`

    T)rt�
is_literal)�ColumnClause)�textrts  rv�literal_columnr��s��F��E�d�;�;ryc��eZdZdZdZdZdZdZejd�ejd�		d
							dd	���Z
d
�Zdd�Zdd�Z
y)�CompilerElementznbase class for SQL elements that can be compiled to produce a
    SQL string.

    .. versionadded:: 2.0

    rq�compiler_elementF�defaultzsqlalchemy.engine.defaultzsqlalchemy.engine.urlNc�.�|��|r
|j}nr|jdk(r|j�}nRtjj
}|jj|j�j��}|j|fi|��S)a�Compile this SQL expression.

        The return value is a :class:`~.Compiled` object.
        Calling ``str()`` or ``unicode()`` on the returned value will yield a
        string representation of the result. The
        :class:`~.Compiled` object also can return a
        dictionary of bind parameter names and values
        using the ``params`` accessor.

        :param bind: An :class:`.Connection` or :class:`.Engine` which
           can provide a :class:`.Dialect` in order to generate a
           :class:`.Compiled` object.  If the ``bind`` and
           ``dialect`` parameters are both omitted, a default SQL compiler
           is used.

        :param column_keys: Used for INSERT and UPDATE statements, a list of
            column names which should be present in the VALUES clause of the
            compiled statement. If ``None``, all columns from the target table
            object are rendered.

        :param dialect: A :class:`.Dialect` instance which can generate
            a :class:`.Compiled` object.  This argument takes precedence over
            the ``bind`` argument.

        :param compile_kwargs: optional dictionary of additional parameters
            that will be passed through to the compiler within all "visit"
            methods.  This allows any custom flag to be passed through to
            a custom compilation construct, for example.  It is also used
            for the case of passing the ``literal_binds`` flag through::

                from sqlalchemy.sql import table, column, select

                t = table("t", column("x"))

                s = select(t).where(t.c.x == 5)

                print(s.compile(compile_kwargs={"literal_binds": True}))

        .. seealso::

            :ref:`faq_sql_expression_string`

        r�)
�dialect�stringify_dialect�_default_dialectr=�	preloaded�
engine_url�URL�create�get_dialect�	_compiler)�self�bindr��kw�urls     rv�compilezCompilerElement.compile�s���h�?���,�,���'�'�9�4��/�/�1���n�n�/�/�� �#�'�'�.�.��*�*���+�-�"���t�~�~�g�,��,�,ryc�V�tjj}|j�Srp)r=r��engine_default�StrCompileDialect)r�r�s  rvr�z CompilerElement._default_dialect6s ���.�.�/�/���(�(�*�*ryc�Z�trt|t�sJ�|j||fi|��S)zNReturn a compiler appropriate for this ClauseElement, given a
        Dialect.)r�
isinstance�
ClauseElement�statement_compiler�r�r�r�s   rvr�zCompilerElement._compiler:s1����d�M�2�2�2�)�w�)�)�'�4�>�2�>�>ryc�4�t|j��Srp)�strr��r�s rv�__str__zCompilerElement.__str__Bs���4�<�<�>�"�"ry�NN)r��Optional[_HasDialect]r��Optional[Dialect]r�r�returnrM)r�r_r�rr�rM�r�r�)�__name__�
__module__�__qualname__�__doc__�	__slots__�__visit_name__�supports_executionr�r=�preload_moduler�r�r�r�rqryrvr�r��s�����I�'�N���!���T���4�5��T���0�1�'+�%)�=-�#�=-�#�=-��	=-�

�=-�2�6�=-�~+�?�#ryr�c��eZdZUdZdZerejd,d��ZnejZejd-d��ZdZde
d<dZd	Zd	Zd	Zd	Zd	Zd	Zd	Zd	Zd	Zd	Zd	Zd	Zd	Zd	Zd	Zd	Zd	Zd	Z d	Z!d	Z"e#d.d
��Z$dZ%de
d<d
e
d<e&j
rdd�					d/d�Z'ejPd0d��Z)d1d�Z*d2d�Z+d3d�Z,d�Z-d�Z.e#d��Z/e0jbd��Z2d�Z3e#d��Z4d�Z5								d4d�Z6								d5d�Z7d6d�Z8	d7					d8d �Z9	d7					d9d!�Z:								d:d"�Z;d;d#�Z<	d7			d<d$�Z=d=d%�Z>d	dd&�													d>d'�Z?d(�Z@d=d)�ZAd*�ZBd+�ZCy)?r�zSBase class for elements of a programmatically constructed SQL
    expression.

    �clausec��y)z�like annotations, however these propagate outwards liberally
            as SQL constructs are built, and are set up at construction time.

            Nrqr�s rv�_propagate_attrszClauseElement._propagate_attrsWs��
ryc��yrprqr�s rv�descriptionzClauseElement.descriptionb���ryNzOptional[Self]�_is_clone_ofTFc��yrprqr�s rv�_order_by_label_elementz%ClauseElement._order_by_label_element~r�ryrK�_cache_key_traversal�ColumnElement[bool]�negation_clause.)�
omit_attrsc��yrprq)r�r�r�s   rv�get_childrenzClauseElement.get_children�s��&)ryc��gSrprqr�s rv�
_from_objectszClauseElement._from_objects�����	ryc�:�tj|�|_|Srp)r=�
immutabledictr�)r��valuess  rv�_set_propagate_attrsz"ClauseElement._set_propagate_attrs�s��!%� 2� 2�6� :����ryc�F�|j�}|j||�Srp)r�r�)r�r�s  rv�_default_compilerzClauseElement._default_compiler�s#���'�'�)���)�)�'�4�8�8ryc��|j}|jj|j�}|rG|jj	�j�D��cic]
\}}||vs�||��c}}|_n|jj	�|_|j}|�	||_|S||_|Scc}}w)z�Create a shallow copy of this ClauseElement.

        This method may be used by a generative API.  Its also used as
        part of the "deep" copy afforded by a traversal that combines
        the _copy_internals() method.

        )�_memoized_keys�	__class__�__new__�__dict__�copy�itemsr�)r�r��skip�c�k�v�ccs       rvr&zClauseElement._clone�s����"�"���N�N�"�"�4�>�>�2���"&���!3�!3�!5�!;�!;�!=��!=���A��$���1��!=��A�J����+�+�-�A�J��
�
��!�~������48������s�B:�,B:c��|S)z�a hook to allow the right side of a binary expression to respond
        to a negation of the binary expression.

        Used for the special case of expanding bind parameter with IN.

        rq)r��
negated_op�original_ops   rv�_negate_in_binaryzClauseElement._negate_in_binary��	���ryc��|S)z�in the context of binary expression, convert the type of this
        object to the one given.

        applies only to :class:`_expression.ColumnElement` classes.

        rq�r�rts  rv�_with_binary_element_typez'ClauseElement._with_binary_element_type�r�ryc��|jS)a.return the 'constructor' for this ClauseElement.

        This is for the purposes for creating a new object of
        this type.   Usually, its just the element's __class__.
        However, the "Annotated" version of the object overrides
        to return the class of its proxied element.

        �r�r�s rv�_constructorzClauseElement._constructor�s���~�~�ryc�v�tj�}|}|� |j|�|j}|�� |S)aReturn the set consisting all cloned ancestors of this
        ClauseElement.

        Includes this ClauseElement.  This accessor tends to be used for
        FromClause objects to identify 'equivalent' FROM clauses, regardless
        of transformative operations.

        )r=�
column_set�addr�)r��s�fs   rv�_cloned_setzClauseElement._cloned_set�s>��
�O�O���%)���m�
�E�E�!�H����A��m��ryc�P�|j�|j}|j��|Srp)r�r�s rv�	_de_clonezClauseElement._de_clone�s,�����+��$�$�D����+��ryc��td��)NzFThis SQL expression has no entity namespace with which to filter from.)�AttributeErrorr�s rv�entity_namespacezClauseElement.entity_namespace�s���
)�
�	
ryc��|jj�}|jdd�|jdd�|S)Nr��_generate_cache_key)r�r��pop)r��ds  rv�__getstate__zClauseElement.__getstate__�s6���M�M��� ��	���n�d�#�	���#�T�*��ryc��|jr+trt|t�sJ�|j	|||�Stj|��rp)r�rr�r*�_execute_clauseelementr;�ObjectNotExecutableError�r��
connection�distilled_params�execution_optionss    rv�_execute_on_connectionz$ClauseElement._execute_on_connectionsO���"�"��!�$�
�3�3�3��4�4��&�(9��
��.�.�t�4�4ryc�D�|j|||�j�S)z�an additional hook for subclasses to provide a different
        implementation for connection.scalar() vs. connection.execute().

        .. versionadded:: 2.0

        )r��scalarr�s    rv�_execute_on_scalarz ClauseElement._execute_on_scalars'���*�*��(�*;�
�
�&�(�	ryc�x�|j�}|�g}t|id|ji�|S|jS)a�Return the list of :class:`.BindParameter` objects embedded in the
        object.

        This accomplishes the same purpose as ``visitors.traverse()`` or
        similar would provide, however by making use of the cache key
        it takes advantage of memoization of the key to result in fewer
        net method calls, assuming the statement is also going to be
        executed.

        �	bindparam)r�r8�append�
bindparams)r��keyr�s   rv�_get_embedded_bindparamsz&ClauseElement._get_embedded_bindparams!sE���&�&�(���;�35�J��T�2��Z�->�->�?�@����>�>�!ryc�(�|jd||�S)aReturn a copy with :func:`_expression.bindparam` elements
        replaced.

        Same functionality as :meth:`_expression.ClauseElement.params`,
        except adds `unique=True`
        to affected bind parameters so that multiple statements can be
        used.

        T��_replace_params�r��_ClauseElement__optionaldict�kwargss   rv�
unique_paramszClauseElement.unique_params7s���#�#�D�.�&�A�Aryc�(�|jd||�S)a�Return a copy with :func:`_expression.bindparam` elements
        replaced.

        Returns a copy of this ClauseElement with
        :func:`_expression.bindparam`
        elements replaced with values taken from the given dictionary::

          >>> clause = column("x") + bindparam("foo")
          >>> print(clause.compile().params)
          {'foo':None}
          >>> print(clause.params({"foo": 7}).compile().params)
          {'foo':7}

        Frrs   rv�paramszClauseElement.paramsGs��&�#�#�E�>�6�B�Bryc�^���|r�j|�d��fd�}t|ddd�d|i�S)Nc�~��|j�vr�|j|_d|_�r|j�yy�NF)r�rs�required�_convert_to_unique)r�r�uniques ��rv�visit_bindparamz6ClauseElement._replace_params.<locals>.visit_bindparames:����x�x�6�!�#�D�H�H�-��
� %��
���'�'�)�ryT)�maintain_key�detect_subquery_colsr�)r��BindParameter[Any]r��None)�updater5)r�r�optionaldictrrs ` ` rvrzClauseElement._replace_params\s;�����M�M�,�'�	*���!�4�@�
�/�*�
�	
ryc�0�tj||fi|��S)a�Compare this :class:`_expression.ClauseElement` to
        the given :class:`_expression.ClauseElement`.

        Subclasses should override the default behavior, which is a
        straight identity comparison.

        \**kw are arguments consumed by subclass ``compare()`` methods and
        may be used to modify the criteria for comparison
        (see :class:`_expression.ColumnElement`).

        )r�compare�r��otherr�s   rvrzClauseElement.comparers���!�!�$��4��4�4ryc��|S)a�Apply a 'grouping' to this :class:`_expression.ClauseElement`.

        This method is overridden by subclasses to return a "grouping"
        construct, i.e. parenthesis.   In particular it's used by "binary"
        expressions to provide a grouping around themselves when placed into a
        larger expression, as well as by :func:`_expression.select`
        constructs when placed into the FROM clause of another
        :func:`_expression.select`.  (Note that subqueries should be
        normally created using the :meth:`_expression.Select.alias` method,
        as many
        platforms require nested SELECT statements to be named).

        As expressions are composed together, the application of
        :meth:`self_group` is automatic - end-user code should never
        need to use this method directly.  Note that SQLAlchemy's
        clause constructs take operator precedence into account -
        so parenthesis might not be needed, for example, in
        an expression like ``x OR (y AND z)`` - AND takes precedence
        over OR.

        The base :meth:`self_group` method of
        :class:`_expression.ClauseElement`
        just returns self.
        rq�r��againsts  rv�
self_groupzClauseElement.self_group�s	��6�ryc��|S)zVReturn this :class:`_expression.ClauseElement`
        without any groupings.
        rqr�s rv�_ungroupzClauseElement._ungroup�s	��
�ry)�for_executemany�schema_translate_mapc���|�|jr|j�}nd}|�rtr|�J�|\}}	||t|�t	|�|f}
|j|
�}|�*|j}|j|f||||d�|��}|||
<n[|j}nNd}	|j|f||||d�|��}|js
|j}n|�
|j}n|j}||	|fS)N)�	cache_key�column_keysr!r")�_supports_statement_cacher�r�tuple�bool�get�
CACHE_MISSr��	CACHE_HIT�NO_DIALECT_SUPPORT�CACHING_DISABLED�NO_CACHE_KEY)
r�r��compiled_cacher%r!r"r��elem_cache_keyr$�extracted_paramsr��compiled_sql�	cache_hits
             rv�_compile_w_cachezClauseElement._compile_w_cache�sB���%�'�*K�*K�!�5�5�7�N�!�N��%��%�1�1�1�*8�'�I�'����k�"��)�*���C�*�-�-�c�2�L��#�#�.�.�	�-�t�~�~�� �,� +�$3�)=� ��
 ��'3��s�#�#�-�-�	�#��)�4�>�>���(�'� /�%9���
�L��4�4�#�6�6�	��'�#�4�4�	�#�0�0�	��-�y�8�8ryc�R�t|d�r|jS|j�S)Nr�)�hasattrr��_negater�s rv�
__invert__zClauseElement.__invert__�s'���4�*�+��'�'�'��<�<�>�!ryc��|jtj��}t|t�sJ�t|tj��S)N�r)�operator�rr�invr��
ColumnElement�UnaryExpression�r��groupeds  rvr7zClauseElement._negate�s7���/�/�)�-�-�/�8���'�=�1�1�1��w����?�?ryc��td��)N�+Boolean value of this clause is not defined)�	TypeErrorr�s rv�__bool__zClauseElement.__bool__�s���E�F�Fryc��|j}|�tj|�Sd|j|jj
t
|�|fzS)Nz<%s.%s at 0x%x; %s>)r��object�__repr__r�r�r��id)r��friendlys  rvrHzClauseElement.__repr__�sR���#�#�����?�?�4�(�(�(�������'�'��4���	,��
ry�r�rH�r��
Optional[str]�r�zOptional[Label[Any]])r�ztyping_Tuple[str, ...]r�rr�zIterable[ClauseElement]�r�zList[FromClause])r��Mapping[str, Any]r�rB)r�rN)r�rr�rB)r�r^r�r`r�rcr�zResult[Any])r�r^r�r`r�rcr�r)r��Sequence[BindParameter[Any]]rp)rzOptional[Dict[str, Any]]rrr�rB)r�Optional[Mapping[str, Any]]rrr�rB)rr(rrRrzDict[str, Any]r�rB)rr�r�rr�r()r�Optional[OperatorType]r�r�)r�r�)r�r_r/zOptional[CompiledCacheType]r%z	List[str]r!r(r"z Optional[SchemaTranslateMapType]r�rr�zJtyping_Tuple[Compiled, Optional[Sequence[BindParameter[Any]]], CacheStats])Dr�r�r�r�r�rr=�memoized_propertyr��
EMPTY_DICT�ro_memoized_propertyr�r��__annotations__�is_clause_element�
is_selectable�is_dml�_is_column_element�_is_keyed_column_element�	_is_table�!_gen_static_annotations_cache_key�_is_textual�_is_from_clause�_is_returns_rows�_is_text_clause�_is_from_container�_is_select_container�_is_select_base�_is_select_statement�_is_bind_parameter�_is_clause_list�_is_lambda_element�_is_singleton_constant�
_is_immutable�_is_star�propertyr�r��typingr��ro_non_memoized_propertyr�r�r�r&r�r�r�r,�memoized_attributer�r�r�r�r�r�rrr	rrrr r4r8r7rErHrqryrvr�r�Fs���
�N��	
�	�	�	�
 �	� �?�?��	������$(�L�.�'����M�
�F���$���I�(-�%��K��O����O��� ���O� �����O���"���M��H�
����48��0�7�(�(�
���;>�	*�!7�	*�EH�	*�
$�	*�
�"�"��#���9��:���	��	��#�#��$��,�
�
��
��
5��
5�2�
5�7�	
5�

�
5����2��7�	�


�� "�048�B�0�B��B�
�	B�$7;�C�3�C��C�
�	C�*
��
�2�
��	
�

�
�,5�15��-��	��:�!&�AE�@9��@9�4�	@9�
�@9��
@9�?�@9��@9�
�@9�D"�@�
G�
ryr�c�N�eZdZdZej
rdd�Z		d							dd�Zyy)�DQLDMLClauseElementz|represents a :class:`.ClauseElement` that compiles to a DQL or DML
    expression, not DDL.

    .. versionadded:: 2.0

    c��y)zRReturn a compiler appropriate for this ClauseElement, given a
            Dialect.Nrqr�s   rvr�zDQLDMLClauseElement._compiler
s��
ryNc��yrprq)r�r�r�r�s    rvr�zDQLDMLClauseElement.compiles��
ry)r�r_r�rr�rNr�)r�r�r�r�r�rr�rN)r�r�r�r�rnrr�r�rqryrvrrrrsO������	�+/�)-�	�'�	�'�	��		�
�	�ryrrc�0�eZdZdZdZejZdZy)�CompilerColumnElementzdA compiler-only column element used for ad-hoc string compilations.

    .. versionadded:: 2.0

    rqFN)	r�r�r�r�r�r=rUr��_is_collection_aggregaterqryrvrvrvs����I�����$�ryrvc���eZdZdZej
�rdejdod��Z								dpd�Z									dpd�Z
e		dqdd�											drd��Ze				ds											dtd��Z				du											dtd	�Z		dv							dwd
�Z
dxd�Zdxd�Zdyd
�Zdzd�Zdzd�Zd{d�Zdzd�Zdzd�Zdzd�Zdzd�Zdzd�Zdzd�Zd|d�Zdzd�Zd}d�Zed~d��Zedd��Zdd�Zed~d��Zedd��Zdd�Zed�d ��Zedd!��Zdd"�Z	d�					d�d#�Z 	d�					d�d$�Z!d�d%�Z"d�d&�Z#d�d'�Z$d|d(�Z%d�d)�Z&d�d*�Z'				d�d+�Z(				d�d,�Z)				d�d-�Z*	d�					d�d.�Z+	d�					d�d/�Z,	d�					d�d0�Z-	d�					d�d1�Z.d�d2�Z/d�d3�Z0d�d4�Z1		d�							d�d5�Z2		d�							d�d6�Z3		d�							d�d7�Z4		d�							d�d8�Z5d�d9�Z6d�d:�Z7d�d;�Z8	d�					d�d<�Z9	d�							d�d=�Z:d|d>�Z;d|d?�Z<d|d@�Z=d|dA�Z>d|dB�Z?d|dC�Z@d�dD�ZA	d�							d�dE�ZBd�dF�ZCd�dG�ZDd�dH�ZEe						d�dI��ZFe						d�dJ��ZFeddK��ZFddL�ZFed�dM��ZGed�dN��ZGddO�ZGe						d�dP��ZHeddQ��ZHddR�ZHe						d�dS��ZIeddT��ZIddU�ZIe						d�dV��ZJeddW��ZJddX�ZJe						d�dY��ZKeddZ��ZKdd[�ZKed�d\��ZLedd]��ZLdd^�ZLed�d_��ZMedd`��ZMdda�ZMe						d�db��ZNed�dc��ZNeddd��ZNdde�ZNe						d�df��ZOeddg��ZOddh�ZOe						d�di��ZPeddj��ZPddk�ZPe						d�dl��ZQeddm��ZQddn�ZQyy)��SQLCoreOperationsrqc��yrprqr�s rvr�z"SQLCoreOperations._propagate_attrs7s��;>ryc��yrprq�r��oprrs    rv�operatezSQLCoreOperations.operate:���!$ryc��yrprqr|s    rv�reverse_operatez!SQLCoreOperations.reverse_operate>rryN)�python_implc��yrprq�r��opstring�
precedence�
is_comparison�return_typer�s      rvr}zSQLCoreOperations.opBs��7:ryc��yrprqr�s      rvr}zSQLCoreOperations.opMs��69ryc��yrprqr�s      rvr}zSQLCoreOperations.opWs��69ryc��yrprq)r�r�r�r�s    rv�bool_opzSQLCoreOperations.bool_op`s��
7:ryc��yrprq�r�rs  rv�__and__zSQLCoreOperations.__and__g���Cryc��yrprqr�s  rv�__or__zSQLCoreOperations.__or__is��3ryc��yrprqr�s rvr8zSQLCoreOperations.__invert__ks��cryc��yrprqr�s  rv�__lt__zSQLCoreOperations.__lt__m���Sryc��yrprqr�s  rv�__le__zSQLCoreOperations.__le__or�ryc��yrprqr�s rv�__hash__zSQLCoreOperations.__hash__us��3ryc��yrprqr�s  rv�__eq__zSQLCoreOperations.__eq__w���ryc��yrprqr�s  rv�__ne__zSQLCoreOperations.__ne__zr�ryc��yrprqr�s  rv�is_distinct_fromz"SQLCoreOperations.is_distinct_from}���sryc��yrprqr�s  rv�is_not_distinct_fromz&SQLCoreOperations.is_not_distinct_from���3ryc��yrprqr�s  rv�__gt__zSQLCoreOperations.__gt__�r�ryc��yrprqr�s  rv�__ge__zSQLCoreOperations.__ge__�r�ryc��yrprqr�s rv�__neg__zSQLCoreOperations.__neg__�s��Sryc��yrprqr�s  rv�__contains__zSQLCoreOperations.__contains__����3ryc��yrprq)r��indexs  rv�__getitem__zSQLCoreOperations.__getitem__����ryc��yrprqr�s  rv�
__lshift__zSQLCoreOperations.__lshift__����KNryc��yrprqr�s  rvr�zSQLCoreOperations.__lshift__����@Cryc��yrprqr�s  rvr�zSQLCoreOperations.__lshift__����ryc��yrprqr�s  rv�
__rshift__zSQLCoreOperations.__rshift__�r�ryc��yrprqr�s  rvr�zSQLCoreOperations.__rshift__�r�ryc��yrprqr�s  rvr�zSQLCoreOperations.__rshift__�r�ryc��yrprqr�s  rv�concatzSQLCoreOperations.concat�s��GJryc��yrprqr�s  rvr�zSQLCoreOperations.concat�s��<?ryc��yrprqr�s  rvr�zSQLCoreOperations.concat�r�ryc��yrprq�r�r�escapes   rv�likezSQLCoreOperations.like����%(ryc��yrprqr�s   rv�ilikezSQLCoreOperations.ilike�r�ryc��yrprqr�s  rv�bitwise_xorzSQLCoreOperations.bitwise_xor����Cryc��yrprqr�s  rv�
bitwise_orzSQLCoreOperations.bitwise_or�r�ryc��yrprqr�s  rv�bitwise_andzSQLCoreOperations.bitwise_and�r�ryc��yrprqr�s rv�bitwise_notzSQLCoreOperations.bitwise_not����ryc��yrprqr�s  rv�bitwise_lshiftz SQLCoreOperations.bitwise_lshift�r�ryc��yrprqr�s  rv�bitwise_rshiftz SQLCoreOperations.bitwise_rshift�r�ryc��yrprqr�s  rv�in_zSQLCoreOperations.in_����
&)ryc��yrprqr�s  rv�not_inzSQLCoreOperations.not_in�r�ryc��yrprqr�s  rv�notin_zSQLCoreOperations.notin_�r�ryc��yrprqr�s   rv�not_likezSQLCoreOperations.not_like�r�ryc��yrprqr�s   rv�notlikezSQLCoreOperations.notlike�r�ryc��yrprqr�s   rv�	not_ilikezSQLCoreOperations.not_ilike�r�ryc��yrprqr�s   rv�notilikezSQLCoreOperations.notilike�r�ryc��yrprqr�s  rv�is_zSQLCoreOperations.is_�r�ryc��yrprqr�s  rv�is_notzSQLCoreOperations.is_not�r�ryc��yrprqr�s  rv�isnotzSQLCoreOperations.isnot�s��sryc��yrprq�r�rr��
autoescapes    rv�
startswithzSQLCoreOperations.startswith����
#&ryc��yrprqr�s    rv�istartswithzSQLCoreOperations.istartswith�r�ryc��yrprqr�s    rv�endswithzSQLCoreOperations.endswith�r�ryc��yrprqr�s    rv�	iendswithzSQLCoreOperations.iendswith�r�ryc��yrprqrs   rv�containszSQLCoreOperations.contains�s��#ryc��yrprqrs   rv�	icontainszSQLCoreOperations.icontainsr�ryc��yrprq)r�rrs   rv�matchzSQLCoreOperations.matchr�ryc��yrprq)r��pattern�flagss   rv�regexp_matchzSQLCoreOperations.regexp_matchs��"%ryc��yrprq)r�r��replacementr�s    rv�regexp_replacez SQLCoreOperations.regexp_replacerryc��yrprqr�s rv�desczSQLCoreOperations.descs��#ryc��yrprqr�s rv�asczSQLCoreOperations.ascs��ryc��yrprqr�s rv�nulls_firstzSQLCoreOperations.nulls_firstr�ryc��yrprqr�s rv�
nullsfirstzSQLCoreOperations.nullsfirst���ryc��yrprqr�s rv�
nulls_lastzSQLCoreOperations.nulls_lastrryc��yrprqr�s rv�	nullslastzSQLCoreOperations.nullslasts��sryc��yrprq�r��	collations  rv�collatezSQLCoreOperations.collate���cryc��yrprq)r��cleft�cright�	symmetrics    rv�betweenzSQLCoreOperations.betweenr�ryc��yrprqr�s rv�distinctzSQLCoreOperations.distinctr�ryc��yrprqr�s rv�any_zSQLCoreOperations.any_ ���Cryc��yrprqr�s rv�all_zSQLCoreOperations.all_"rryc��yrprqr�s  rv�__add__zSQLCoreOperations.__add__)���#&ryc��yrprqr�s  rvr#zSQLCoreOperations.__add__/s��"%ryc��yrprqr�s  rvr#zSQLCoreOperations.__add__5���=@ryc��yrprqr�s  rvr#zSQLCoreOperations.__add__8r�ryc��yrprqr�s  rv�__radd__zSQLCoreOperations.__radd__:r�ryc��yrprqr�s  rvr*zSQLCoreOperations.__radd__=s��ILryc��yrprqr�s  rvr*zSQLCoreOperations.__radd__@rryc��yrprqr�s  rv�__sub__zSQLCoreOperations.__sub__Br$ryc��yrprqr�s  rvr.zSQLCoreOperations.__sub__Hr'ryc��yrprqr�s  rvr.zSQLCoreOperations.__sub__Kr�ryc��yrprqr�s  rv�__rsub__zSQLCoreOperations.__rsub__Mr$ryc��yrprqr�s  rvr2zSQLCoreOperations.__rsub__S���>Aryc��yrprqr�s  rvr2zSQLCoreOperations.__rsub__Vrryc��yrprqr�s  rv�__mul__zSQLCoreOperations.__mul__Xr$ryc��yrprqr�s  rvr7zSQLCoreOperations.__mul__^r'ryc��yrprqr�s  rvr7zSQLCoreOperations.__mul__ar�ryc��yrprqr�s  rv�__rmul__zSQLCoreOperations.__rmul__cr$ryc��yrprqr�s  rvr;zSQLCoreOperations.__rmul__ir4ryc��yrprqr�s  rvr;zSQLCoreOperations.__rmul__lrryc��yrprqr�s  rv�__mod__zSQLCoreOperations.__mod__ns��JMryc��yrprqr�s  rvr?zSQLCoreOperations.__mod__qr'ryc��yrprqr�s  rvr?zSQLCoreOperations.__mod__tr�ryc��yrprqr�s  rv�__rmod__zSQLCoreOperations.__rmod__vr�ryc��yrprqr�s  rvrCzSQLCoreOperations.__rmod__yr4ryc��yrprqr�s  rvrCzSQLCoreOperations.__rmod__|rryc��yrprqr�s  rv�__truediv__zSQLCoreOperations.__truediv__~���'*ryc��yrprqr�s  rvrGzSQLCoreOperations.__truediv__�s��LOryc��yrprqr�s  rvrGzSQLCoreOperations.__truediv__�s��ADryc��yrprqr�s  rvrGzSQLCoreOperations.__truediv__�r�ryc��yrprqr�s  rv�__rtruediv__zSQLCoreOperations.__rtruediv__�rHryc��yrprqr�s  rvrMzSQLCoreOperations.__rtruediv__����BEryc��yrprqr�s  rvrMzSQLCoreOperations.__rtruediv__����#ryc��yrprqr�s  rv�__floordiv__zSQLCoreOperations.__floordiv__����#&ryc��yrprqr�s  rvrSzSQLCoreOperations.__floordiv__�rOryc��yrprqr�s  rvrSzSQLCoreOperations.__floordiv__�rQryc��yrprqr�s  rv�
__rfloordiv__zSQLCoreOperations.__rfloordiv__�rTryc��yrprqr�s  rvrXzSQLCoreOperations.__rfloordiv__����CFryc��yrprqr�s  rvrXzSQLCoreOperations.__rfloordiv__�r�ryrK)r}rPrrrrr��ColumnElement[Any])..)r�r�r��intr�r(r��_TypeEngineArgument[_OPT]r��Optional[Callable[..., Any]]r�z'Callable[[Any], BinaryExpression[_OPT]])....)r�r�r�r]r�r(r��"Optional[_TypeEngineArgument[Any]]r�r_r�z&Callable[[Any], BinaryExpression[Any]])rFNN)rN)r�r�r�r]r�r_r�z'Callable[[Any], BinaryExpression[bool]])rrr��BooleanClauseList)r�zColumnElement[_T_co])rrr�r��r�r])r��UnaryExpression[_T_co])r�rr�r\)r��	_SQO[int]rrr�zColumnElement[int])rrr�r\)r�z	_SQO[str]rrr��ColumnElement[str]rp)rrr�rMr��BinaryExpression[bool])rrr�zBinaryExpression[Any])rz=Union[Iterable[Any], BindParameter[Any], roles.InElementRole]r�rf)rrr�rfr)rrr�rMr�r(r�r�)rrr�rr�r�)rrrrr�r�)r�rr�rMr�r�)r�rrrr�rMr�re)rr�r��CollationClause�F)rrrrrr(r�rf)r�z_SQO[_T_co]r�rc)r�zCollectionAggregate[Any])r��
_SQO[_NMT]rrr�zColumnElement[_NMT])r�rdrrr��ColumnElement[_NUMERIC])r�z	_SQO[_NT]rrr�zColumnElement[_NT])r�rirrr�rj)Rr�r�r�r�rnrr=�non_memoized_propertyr�r~r�rr}r�r�r�r8r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr	rrrrrrrr!r#r*r.r2r7r;r?rCrGrMrSrXrqryrvryry/s����I�
���	
�	#�	#�>�
$�>�	%�"�	%�,/�	%�;>�	%�
�	%�	%�"�	%�+.�	%�:=�	%�
�	%�
�"�"%�		:�9=�	:��	:��	:� �		:�3�
	:�6�	:�5�	:�
�	:�
�"�"%�>A�8;�
	9��	9��	9� �		9�
<�	9�6�
	9�4�	9�
�	9� �"'�>B�8<�
	9��	9��	9� �		9�
<�	9�6�
	9�4�	9� �8<�		:��	:��	:�6�		:�
5�	:�	@�>�9�@�@�	'�	�	�	K�N�@�@�8�F�D�	�N�
�N�	�C�
�C�C�	�N�
�N�	�C�
�C�C�	�J�
�J�	�?�
�?�?�7;�	)��	)�&3�	)�
#�	)�
7;�	)��	)�&3�	)�
#�	)�	H�F�G�<�J�J�	)��	)�
$�	)�	)��	)�
$�	)�	)��	)�
$�	)�7;�	)��	)�&3�	)�
#�	)�
7;�	)��	)�&3�	)�
#�	)�
7;�	)��	)�&3�	)�
#�	)�
7;�	)��	)�&3�	)�
#�	)�	A�C�B�
%)�$�		&��	&�"�	&��		&�
!�	&�%)�$�		&��	&�"�	&��		&�
!�	&�%)�$�		&��	&�"�	&��		&�
!�	&�%)�$�		&��	&�"�	&��		&�
!�	&�	N�N�N�8<�	&��	&�'4�	&�
 �	&�
JN�	%��	%�-0�	%�9F�	%�
�	%�	6�4�<�;�;�:�A�>C�	)��	)�&)�	)�6:�	)�
#�	)�	G�7�7�
�	&��	&��	&�!�	&�
�	&�

�	%��	%��	%� �	%�
�	%�

�@�
�@�@�	�N�
�N�	�L�
�L�A�	�	&��	&��	&�!�	&�
�	&�

�@�
�@�@�	�	&��	&��	&�!�	&�
�	&�

�A�
�A�A�	�	&��	&��	&�!�	&�
�	&�

�@�
�@�@�	�	&��	&��	&�!�	&�
�	&�

�A�
�A�A�	�M�
�M�	�@�
�@�@�	�N�
�N�	�A�
�A�A�	�	*��	*�$'�	*�
$�	*�
�	*�
�O�
�O�	�D�
�D�D�	�	*��	*�%(�	*�
$�	*�
�	*�
�E�
�E�E�	�	&��	&�%(�	&�
 �	&�
�	&�
�E�
�E�E�	�	&��	&�%(�	&�
 �	&�
�	&�
�F�
�F�F�eryryc��eZdZdZdZy)�SQLColumnExpressiona�A type that may be used to indicate any SQL column element or object
    that acts in place of one.

    :class:`.SQLColumnExpression` is a base of
    :class:`.ColumnElement`, as well as within the bases of ORM elements
    such as :class:`.InstrumentedAttribute`, and may be used in :pep:`484`
    typing to indicate arguments or return values that should behave
    as column expressions.

    .. versionadded:: 2.0.0b4


    rqN�r�r�r�r�r�rqryrvrmrm�s����Iryrmc���eZdZUdZdZdZded<ded<dZdZded	<dZ	dZ
e�Zd
ed<e
jdAd��Ze
j dBd��ZdZd
ed<	ej(dBd��ZedBd��ZedBd��ZedBd��ZdZ	dZ	dZdZded<edCdDd��Ze	dC			dEd��Z	dC			dEd�ZedFd��Z edGd��Z dHd�Z ded<e!se
jdId ��Z"ej(dJd!��Z#d"�Z$dKd#�Z%								dLd$�Z&								dLd%�Z'		dM									dNd&�Z(edHd'��Z)edOd(��Z*e
jdPd)��Z+e
jdPd*��Z,e
jdPd+��Z-dAd,�Z.dQd-�Z/dRd.�Z0ej(dBd/��Z1ej(dBd0��Z2ddddd1�																	dSd2�Z3dTd3�Z4dUd4�Z5	dC					dVd5�Z6e
jdWd6��Z7e
jdXd7��Z8ee
jrd8d9�dWd:���Z:ee
jrd8d;�dWd<���Z;dYd=�Z<e
jdXd>��Z=e
jdXd?��Z>dZd@�Z?y)[r>aRepresent a column-oriented SQL expression suitable for usage in the
    "columns" clause, WHERE clause etc. of a statement.

    While the most familiar kind of :class:`_expression.ColumnElement` is the
    :class:`_schema.Column` object, :class:`_expression.ColumnElement`
    serves as the basis
    for any unit that may be present in a SQL expression, including
    the expressions themselves, SQL functions, bound parameters,
    literal expressions, keywords such as ``NULL``, etc.
    :class:`_expression.ColumnElement`
    is the ultimate base class for all such elements.

    A wide variety of SQLAlchemy Core functions work at the SQL expression
    level, and are intended to accept instances of
    :class:`_expression.ColumnElement` as
    arguments.  These functions will typically document that they accept a
    "SQL expression" as an argument.  What this means in terms of SQLAlchemy
    usually refers to an input which is either already in the form of a
    :class:`_expression.ColumnElement` object,
    or a value which can be **coerced** into
    one.  The coercion rules followed by most, but not all, SQLAlchemy Core
    functions with regards to SQL expressions are as follows:

        * a literal Python value, such as a string, integer or floating
          point value, boolean, datetime, ``Decimal`` object, or virtually
          any other Python object, will be coerced into a "literal bound
          value".  This generally means that a :func:`.bindparam` will be
          produced featuring the given value embedded into the construct; the
          resulting :class:`.BindParameter` object is an instance of
          :class:`_expression.ColumnElement`.
          The Python value will ultimately be sent
          to the DBAPI at execution time as a parameterized argument to the
          ``execute()`` or ``executemany()`` methods, after SQLAlchemy
          type-specific converters (e.g. those provided by any associated
          :class:`.TypeEngine` objects) are applied to the value.

        * any special object value, typically ORM-level constructs, which
          feature an accessor called ``__clause_element__()``.  The Core
          expression system looks for this method when an object of otherwise
          unknown type is passed to a function that is looking to coerce the
          argument into a :class:`_expression.ColumnElement` and sometimes a
          :class:`_expression.SelectBase` expression.
          It is used within the ORM to
          convert from ORM-specific objects like mapped classes and
          mapped attributes into Core expression objects.

        * The Python ``None`` value is typically interpreted as ``NULL``,
          which in SQLAlchemy Core produces an instance of :func:`.null`.

    A :class:`_expression.ColumnElement` provides the ability to generate new
    :class:`_expression.ColumnElement`
    objects using Python expressions.  This means that Python operators
    such as ``==``, ``!=`` and ``<`` are overloaded to mimic SQL operations,
    and allow the instantiation of further :class:`_expression.ColumnElement`
    instances
    which are composed from other, more fundamental
    :class:`_expression.ColumnElement`
    objects.  For example, two :class:`.ColumnClause` objects can be added
    together with the addition operator ``+`` to produce
    a :class:`.BinaryExpression`.
    Both :class:`.ColumnClause` and :class:`.BinaryExpression` are subclasses
    of :class:`_expression.ColumnElement`:

    .. sourcecode:: pycon+sql

        >>> from sqlalchemy.sql import column
        >>> column("a") + column("b")
        <sqlalchemy.sql.expression.BinaryExpression object at 0x101029dd0>
        >>> print(column("a") + column("b"))
        {printsql}a + b

    .. seealso::

        :class:`_schema.Column`

        :func:`_expression.column`

    �column_elementFr(�primary_key�Optional[ColumnElement[_T]]r�T�_insert_sentinelzAbstractSet[ForeignKey]�foreign_keysc��gSrprqr�s rv�_proxieszColumnElement._proxies)r�ryrMc��y)a}The named label that can be used to target
        this column in a result set in a "table qualified" context.

        This label is almost always the label used when
        rendering <expr> AS <label> in a SELECT statement when using
        the LABEL_STYLE_TABLENAME_PLUS_COL label style, which is what the
        legacy ORM ``Query`` object uses as well.

        For a regular Column bound to a Table, this is typically the label
        <tablename>_<columnname>.  For other constructs, different rules
        may apply, such as anonymized labels and others.

        .. versionchanged:: 1.4.21 renamed from ``._label``

        Nrqr�s rv�	_tq_labelzColumnElement._tq_label-s��"ryNr�c��|jS)alA label-based version of 'key' that in some circumstances refers
        to this object in a Python namespace.


        _tq_key_label comes into play when a select() statement is constructed
        with apply_labels(); in this case, all Column objects in the ``.c``
        collection are rendered as <tablename>_<columnname> in SQL; this is
        essentially the value of ._label. But to locate those columns in the
        ``.c`` collection, the name is along the lines of <tablename>_<key>;
        that's the typical value of .key_label.

        .. versionchanged:: 1.4.21 renamed from ``._key_label``

        )�
_proxy_keyr�s rv�
_tq_key_labelzColumnElement._tq_key_labelJs�� ���ryc��|jS)z legacy; renamed to _tq_key_label)r{r�s rv�
_key_labelzColumnElement._key_label\s���!�!�!ryc��|jS)zlegacy; renamed to _tq_label�rxr�s rv�_labelzColumnElement._labelas���~�~�ryc��t|dd�S)aVthe 'name' that naturally applies this element when rendered in
        SQL.

        Concretely, this is the "name" of a column or a label in a
        SELECT statement; ``<columnname>`` and ``<labelname>`` below:

        .. sourcecode:: sql

            SELECT <columnmame> FROM table

            SELECT column AS <labelname> FROM table

        Above, the two names noted will be what's present in the DBAPI
        ``cursor.description`` as the names.

        If this attribute returns ``None``, it means that the SQL element as
        written does not have a 100% fully predictable "name" that would appear
        in the ``cursor.description``. Examples include SQL functions, CAST
        functions, etc. While such things do return names in
        ``cursor.description``, they are only predictable on a
        database-specific basis; e.g. an expression like ``MAX(table.col)`` may
        appear as the string ``max`` on one database (like PostgreSQL) or may
        appear as the whole expression ``max(table.col)`` on SQLite.

        The default implementation looks for a ``.name`` attribute on the
        object, as has been the precedent established in SQLAlchemy for many
        years.  An exception is made on the ``FunctionElement`` subclass
        so that the return value is always ``None``.

        .. versionadded:: 1.4.21



        �nameN)�getattrr�s rv�_non_anon_labelzColumnElement._non_anon_labelfs��H�t�V�T�*�*ryrqz
Sequence[str]�
_alt_namesc��yrprqrs  rvrzColumnElement.self_group�s��EHryc��yrprqrs  rvrzColumnElement.self_group�s��!ryc�t�|tjtjtjfvrY|jj
tjj
ur)t|tjtj�S|tjtjfvrt|�S|Srp)r�and_�or_�_asbool�type�_type_affinityr�BOOLEANTYPE�	AsBoolean�is_true�is_false�any_op�all_op�Groupingrs  rvrzColumnElement.self_group�s���
�	���	�
�
�y�7H�7H�I�I��	�	�(�(�H�,@�,@�,O�,O�O��T�9�#4�#4�i�6H�6H�I�I�
��)�)�9�+;�+;�<�
<��D�>�!��Kryc��yrprqr�s rvr7zColumnElement._negate�rZryc��yrprqr�s rvr7zColumnElement._negate�s��?Bryc�P�|jjtjjur)t	|t
jt
j�S|jt
j��}t|t�sJ�t|t
jd��S�Nr:T)r;�wraps_column_expression)
r�r�rr�r�rr�r�rr=r�r>r?r@s  rvr7zColumnElement._negate�sw���9�9�#�#�x�';�';�'J�'J�J��T�9�#5�#5�y�7H�7H�I�I��o�o�i�m�m�o�<�G��g�}�5�5�5�"��)�-�-���
ry�TypeEngine[_T]r�c�"�tjSrp�r�NULLTYPEr�s rvr�zColumnElement.type�s���$�$�$ryc��	|jj}||�S#t$r}td|jz�|�d}~wwxYw)NzOObject %r associated with '.type' attribute is not a TypeEngine class or object)r��comparator_factoryr�rD)r�r��errs   rv�
comparatorzColumnElement.comparator�sZ��	,�!%���!=�!=��&�d�+�+��
�	��6�8<�	�	�B���
��	�s� �	A�A�Ac�:�|jj|�yrp)r�r�r��states  rv�__setstate__zColumnElement.__setstate__�s���
�
���U�#ryc	���	t|j|�S#t$rJ}tdt|�j�dt|j�j�d|���|�d}~wwxYw)NzNeither z object nor z object has an attribute )r�r�r�r�r�)r�r�r�s   rv�__getattr__zColumnElement.__getattr__�sc��
	��4�?�?�C�0�0���	� ���J�'�'�����)�2�2��	���
��	�s��	A+�AA&�&A+c�.�||jg|��i|��Srp�r�r|s    rvr~zColumnElement.operate�s���$�/�/�4�E�4�V�4�4ryc�*�|||jfi|��Srpr�r|s    rvr�zColumnElement.reverse_operate�s���%����3�F�3�3ryc	�:�td||||jd|��S�NT)�_compared_to_operatorrt�_compared_to_typer�	expanding��
BindParameterr��r�r;�objrtr�s     rv�_bind_paramzColumnElement._bind_param�s*�����"*��"�i�i���
�	
ryc��|S)z^Return a column expression.

        Part of the inspection interface; returns self.

        rqr�s rv�
expressionzColumnElement.expressionr�ryc��|fSrprqr�s rv�_select_iterablezColumnElement._select_iterable�	���w�ryc�:�td�|jD��S)Nc3�:K�|]}|jr�|���y�wrp)rv��.0r�s  rv�	<genexpr>z-ColumnElement.base_columns.<locals>.<genexpr>s����E�N�q�!�*�*��N�s��)�	frozenset�	proxy_setr�s rv�base_columnszColumnElement.base_columnss���E�D�N�N�E�E�Eryc���t|j�g�jtj|j
D�cgc]}|j��c}��Scc}w)aFset of all columns we are proxying

        as of 2.0 this is explicitly deannotated columns.  previously it was
        effectively deannotated columns but wasn't enforced.  annotated
        columns should basically not go into sets if at all possible because
        their hashing behavior is very non-performant.

        )r��_deannotate�union�	itertools�chainrvr��r�r�s  rvr�zColumnElement.proxy_setsN���$�*�*�,�-�.�4�4��O�O�4�=�=�A�=�a�a�k�k�=�A�B�
�	
��As�Ac�>�tt|j��Srp)r�r'r�r�s rv�_expanded_proxy_setz!ColumnElement._expanded_proxy_set*s�������7�8�8ryc
��|gttj|jD�cgc]}|j	���c}��zScc}w)z�An 'uncached' version of proxy set.

        This list includes annotated columns which perform very poorly in
        set operations.

        )�listr�r�rv�_uncached_proxy_listr�s  rvr�z"ColumnElement._uncached_proxy_list.sE���v���O�O��
�
�N�
�1�a�4�4�6�
�N�O�
�
�	
��Ns�Ac�^�t|jj|j��S)z�Return True if the given :class:`_expression.ColumnElement`
        has a common ancestor to this :class:`_expression.ColumnElement`.)r(r��intersection)r��othercolumns  rv�shares_lineagezColumnElement.shares_lineage:s$���D�N�N�/�/��0E�0E�F�G�Gryc�l�t|d�xr't|d�xr|j|jk(S)zhReturn True if the given column element compares to this one
        when targeting within a result row.r�)r6r�r�s  rv�_compare_name_for_resultz&ColumnElement._compare_name_for_result@s7��

�E�6�"�
(���f�%�
(��
�
�d�i�i�'�	
ryc���|jr+d|jvrtt|jd�S|j}|s|j}t|t�ry|S)N�	proxy_key)�_annotationsr	r�r�r�r��_anonymous_label�r�r�s  rvrzzColumnElement._proxy_keyJs\�������0A�0A�!A���T�.�.�{�;�<�<��x�x���
�'�'�D��d�,�-���Kryc��t|dd��y|jr+d|jvrtt|jd�Sy)a\a suggested label to use in the case that the column has no name,
        which should be used if possible as the explicit 'AS <label>'
        where this expression would normally have an anon label.

        this is essentially mostly what _proxy_key does except it returns
        None if the column has a normal name that can be used.

        r�Nr�)r�r�r	r�r�s rv�_expression_labelzColumnElement._expression_label\sG���4���&�2��
�
�
�;�$�2C�2C�#C���T�.�.�{�;�<�<�ry)r�r��name_is_truncatable�compound_select_colsc��|�|j}|�|j}n|}|�J�t|r$tjt
j|�n|t|dd�|��}	|j|	_|rt|�|	_
n|g|	_
|j�*|jjj|�|	_||	fS)z�Create a new :class:`_expression.ColumnElement` representing this
        :class:`_expression.ColumnElement` as it appears in the select list of
        a descending selectable.

        Nr�)rt�_selectable)�_anon_name_labelrzr�rr}r�TruncatedLabelRoler�r�r�rvr��columnsr))
r��
selectablerqrtr�r�r�r�r��cos
          rv�_make_proxyzColumnElement._make_proxyns���"�<��(�(�D��{��o�o���C�����+�'�� � ��!9�!9�4�@���$���-�"� 
��)�9�9�����3�4�B�K��&�B�K��"�"�.�(�5�5�=�=�A�A�#�F�B�O��B�w�ryc��t||�S)aProduce a type cast, i.e. ``CAST(<expression> AS <type>)``.

        This is a shortcut to the :func:`_expression.cast` function.

        .. seealso::

            :ref:`tutorial_casts`

            :func:`_expression.cast`

            :func:`_expression.type_coerce`

        )�Castr�s  rvr	zColumnElement.cast�s���D�%� � ryc�0�t|||j�S)z�Produce a column label, i.e. ``<columnname> AS <name>``.

        This is a shortcut to the :func:`_expression.label` function.

        If 'name' is ``None``, an anonymous label name will be generated.

        )�Labelr�r�s  rv�labelzColumnElement.label�s���T�4����+�+ryc��|j�|j}|j��t|�}|r|dksJ�|sJ�|dz|z}|dz}t|t�rtj	|d|��Stj	||xsd�S)Ni��_�)�enclosing_label�anon)r��hashr�r��safe_construct)r��seed�add_hash�
hash_values    rv�_anon_labelzColumnElement._anon_label�s������+��$�$�D����+��$�Z�
���w�'�'�'��K�4�$��*�h�6�J��#�:�D��d�,�-�#�2�2��B��3��
� �.�.�z�4�>�6�J�Jryc�>�t|dd�}|j|�S)a�Provides a constant 'anonymous label' for this ColumnElement.

        This is a label() expression which will be named at compile time.
        The same label() is returned each time ``anon_label`` is called so
        that expressions can reference ``anon_label`` multiple times,
        producing the same label name at compile time.

        The compiler uses this function automatically at compile time
        for expressions that are known to be 'unnamed' like binary
        expressions and function calls.

        .. versionchanged:: 1.4.9 - this attribute was not intended to be
           public and is renamed to _anon_name_label.  anon_name exists
           for backwards compat

        r�N�r�r�r�s  rvr�zColumnElement._anon_name_label�s#��$�t�V�T�*������%�%ryc�8�|j|j�S)a�Provides a constant 'anonymous key label' for this ColumnElement.

        Compare to ``anon_label``, except that the "key" of the column,
        if available, is used to generate the label.

        This is used when a deduplicating key is placed into the columns
        collection of a selectable.

        .. versionchanged:: 1.4.9 - this attribute was not intended to be
           public and is renamed to _anon_key_label.  anon_key_label exists
           for backwards compat

        )r�rzr�s rv�_anon_key_labelzColumnElement._anon_key_label�s��������0�0ry�1.4zqThe :attr:`_expression.ColumnElement.anon_label` attribute is now private, and the public accessor is deprecated.c��|jSrp)r�r�s rv�
anon_labelzColumnElement.anon_label�s���$�$�$ryzuThe :attr:`_expression.ColumnElement.anon_key_label` attribute is now private, and the public accessor is deprecated.c��|jSrp)r�r�s rv�anon_key_labelzColumnElement.anon_key_labels���#�#�#ryc�h�t|dd�}|�|j|�S|j||��S)a)label to apply to a column that is anon labeled, but repeated
        in the SELECT, so that we have to make an "extra anon" label that
        disambiguates it from the previous appearance.

        these labels come out like "foo_bar_id__1" and have double underscores
        in them.

        r�N�r�)r��_dedupe_anon_tq_label_idxr��r��idxr�s   rv�_dedupe_anon_label_idxz$ColumnElement._dedupe_anon_label_idxs@����f�d�+���=��1�1�#�6�6��#�#�E�C�#�8�8ryc�:�|jt|dd��S�Nrx�r�r�r�s rv�_anon_tq_labelzColumnElement._anon_tq_label(s�������k�4� @�A�Aryc�:�|jt|dd��S)Nr{rr�s rv�_anon_tq_key_labelz ColumnElement._anon_tq_key_label,s�������o�t� D�E�Eryc�J�t|dd�xsd}|j||��S)Nrxr�r�r�rs   rvrz'ColumnElement._dedupe_anon_tq_label_idx0s+����k�4�0�:�F��������4�4ry�r��List[ColumnElement[Any]]rLrp)rrr��ColumnElement[_T])rrSr�r\)r�r�r�r�)r�r
r�r
)r�r\�r�r�)r�zTypeEngine.Comparator[_T])r�r�r�r)r}�operators.OperatorTyperrrrr�r\r)
r;rr�rrt�Optional[TypeEngine[_T]]r�r(r��BindParameter[_T]�r�rU)r�zFrozenSet[ColumnElement[Any]])r�r\r�r()rr\r�r()r�rVrqrJrt�Set[KeyedColumnElement[Any]]r�rMr�rMr�r(r��&Optional[Sequence[ColumnElement[Any]]]r�rr��#typing_Tuple[str, ColumnClause[_T]])rtr^r�z
Cast[_OPT])r�rMr��	Label[_T])r�rMr�z
Optional[int]r�r�r�)r�r��rr]r�r�)rr]r�r�)@r�r�r�r�r�rqrWr[rs�_omit_from_statementsrwr�rtr=rTrvrkrxr�r,rpr{rmr}r�r��_render_label_in_columns_clause�_allow_label_resolve�_is_implicitly_booleanr�rrr7rr�r�r�r�r~r�r�r�r�r�r�r�r�r�r�rzr�r�r	r�r�r�r��
deprecatedr�r�rrr	rrqryrvr>r>�s���M�^&�N��K���-�-���"��d�"�!��$��,5�K�L�)�7�	������
���� ��$�C�����#�#��$��"�"��"������#+��#+�J'+�#�� ���#�� "�J�
�"�
�H��H�
�04�!�-�!�	�!��!�
15��-��	���F��F�
�B��B�����	
�	�	�	%�
 �	%�
�#�#�	,�$�	,�$��5�"�5��5��	5�

�5�4�(�4�14�4�@C�4�	�4�+/��
�(�
��
�(�	
�
�
�
�

�"��������
���F��F�
���
��
�
���9��9�

�H�
��#�#��$��"�#�#��$��.#�!�$)�GK�+��+��	+�
3�+��
+��+�"�+�E�+��+�
-�+�Z!� ,�>B�"K�!�"K�-:�"K�	�"K�H
���&��&�(
���1��1� ��T�_�_�
�	:��
%���%���T�_�_�
�	>��
$���$�9�.
���B��B�
���F��F�5ryr>c� �eZdZUdZdZded<y)�KeyedColumnElementz)ColumnElement where ``.key`` is non-None.Tr�r�N)r�r�r�r�r\rWrqryrvrr6s��3�#��	�Hryrc���eZdZdZed	d��Zejd
d��Zed
d��Z	ed
d��Z
ejd�fd��Zdd�Ze�fd��Z
�xZS)
�WrapsColumnExpressionz�Mixin that defines a :class:`_expression.ColumnElement`
    as a wrapper with special
    labeling behavior for an expression that already has a name.

    .. versionadded:: 1.4

    .. seealso::

        :ref:`change_4449`


    c��t��rp��NotImplementedErrorr�s rv�wrapped_column_expressionz/WrapsColumnExpression.wrapped_column_expressionLs��!�#�#ryc�L�|j}t|d�r|jSyr)r$r6rx)r��wces  rvrxzWrapsColumnExpression._tq_labelPs$���,�,���3��$��=�=� �ryc��|jSrprr�s rvr�zWrapsColumnExpression._labelXs���~�~�ryc��yrprqr�s rvr�z%WrapsColumnExpression._non_anon_label\r�ryc���|j}|js(|j}|r|St|d�r|jSt
�|�S)Nr�)r$rbr�r6r��super)r�r&�nalr�s   �rvr�z&WrapsColumnExpression._anon_name_label`sN����,�,��
�"�"��%�%�C���
���0�1��+�+�+��w�'�'ryc��|j}|j}|r|j|dz�S|j|�S)Nr�)r$r�r�r)r�rr&r+s    rvrz,WrapsColumnExpression._dedupe_anon_label_idxosA���,�,���!�!����#�#�C�#�I�.�.��1�1�#�6�6ryc�`��|j}|js|jSt�|�Srp)r$rbrzr*)r�r&r�s  �rvrzz WrapsColumnExpression._proxy_keyws,����,�,���"�"��>�>�!��w�!�!ry�r�r
rLr�r)r�r�r�r�rmr$r=rkrxr�r�r�rrz�
__classcell__r�s@rvr r >s������$��$�
���� ����������
���(� �(�7��"��"ryr c��eZdZUdZdZdejfdejfdejfdejfdejfgZded	<d
ed<ded<ded<d
Z
dZd
ZdZej$dd
ej$ddd
d
d
ddd
f																									dd�Zd
efd�Zedd��Zdd�Zd�Zd�Zdd d�Zd�Zd�Zd�Zd�Zd�Zy)!r�a�Represent a "bound expression".

    :class:`.BindParameter` is invoked explicitly using the
    :func:`.bindparam` function, as in::

        from sqlalchemy import bindparam

        stmt = select(users_table).where(
            users_table.c.name == bindparam("username")
        )

    Detailed discussion of how :class:`.BindParameter` is used is
    at :func:`.bindparam`.

    .. seealso::

        :func:`.bindparam`

    r�r�r��callablersrur\�_traverse_internalsr�r��Optional[_T]FTNc���|tjur|tjuxr|du}|tjurd}|�tj||�}|rBtjt
|�|�t|t�s|ndd��|_d|_	n5|r||_n+tjt
|�d�|_d|_	|j|_
|xsd|_||_||_
||_|	|_||_||_d|_|
|_|
rd|_|�R|r|r|d}nt*j,}n|}|�|j/||�|_yt+j2|�|_yt|t0�r
|�|_yt5|�r?|r+|r|d}n|}|j7|�t9d|�_y|t9d|�_y||_y)N�paramT��sanitize_keyrz%BindParameter[typing_Tuple[Any, ...]])r)r.�quoted_name�	constructr�r�rIr�r��_key_is_anon�_identifying_key�	_orig_keyrrsr1�
isoutparamr
r��	expand_opru�_is_crudr�_NO_VALUE_IN_LIST�coerce_compared_valuer��_resolve_value_to_typer#�_resolve_values_to_typesr	)r�r�rsrtrr
�quote�	callable_r�r=rur�r�r?�check_values               rv�__init__zBindParameter.__init__�s��� �v�}�}�$���
�
�-�C�)�t�2C�H��F�M�M�!��E����'�'��U�3�C��'�6�6��4����&�s�,<�=��!�!�7�	�D�H�!%�D��
��D�H�'�6�6�r�$�x��I�D�H� $�D��
!%���������������
�!��
�$��� ��
�
#���
���.���� �D�M��=���"'��(�K�"*�"<�"<�K�#�� �,�-�C�C�)�;���	�%�;�;�K�H��	�
��t�
$���D�I�
�5�
!���"'��(�K�"'�K��2�2�;�?��<�d�C�H�
��<�d�C�H��D�Iryc���|j|��}||_d|_|tur|n|j|_|j
tjurt
j|�|_|S)zXReturn a copy of this :class:`.BindParameter` with the given value
        set.
        )rN)	r&rsr1r.r
r�rr�rB)r�rsrr
�cloneds     rv�_with_valuezBindParameter._with_values_�����,��7��������&.�f�&<�(�$�-�-����;�;�(�+�+�+�"�9�9�%�@�F�K��
ryc�R�|jr|j�S|jS)z�Return the value of this bound parameter,
        taking into account if the ``callable`` parameter
        was set.

        The ``callable`` value will be evaluated
        and returned if present, else ``value``.

        )r1rsr�s rv�effective_valuezBindParameter.effective_values!���=�=��=�=�?�"��:�:�ryc�>�tj|�}d|_|S)ahProduce a copy of this bound parameter that will enable the
        :paramref:`_sql.BindParameter.literal_execute` flag.

        The :paramref:`_sql.BindParameter.literal_execute` flag will
        have the effect of the parameter rendered in the compiled SQL
        string using ``[POSTCOMPILE]`` form, which is a special form that
        is converted to be a rendering of the literal value of the parameter
        at SQL execution time.    The rationale is to support caching
        of SQL statement strings that can embed per-statement literal values,
        such as LIMIT and OFFSET parameters, in the final SQL string that
        is passed to the DBAPI.   Dialects in particular may want to use
        this method within custom compilation schemes.

        .. versionadded:: 1.4.5

        .. seealso::

            :ref:`engine_thirdparty_caching`

        T)r�r&rur�s  rv�render_literal_executez$BindParameter.render_literal_execute.s!��*
� � ��&�� ����ryc�T�|j|ur|j�}||_|S|Srp)r>r&)r�r�r�r�s    rvr�zBindParameter._negate_in_binaryGs*���>�>�[�(��;�;�=�D�'�D�N��K��Kryc�>�tj|�}||_|Srp)r�r&r�)r�rtr�s   rvr�z'BindParameter._with_binary_element_typeOs��� � ��&������ryc��tj|fi|��}|jj|j�|s@|jr4t
j
t|�|jxsdd��|_	|S)Nr5Tr6)
r�r&r�rrr�r�rIr<r�)r�rr�r�s    rvr&zBindParameter._cloneTsl��� � ��,��,��	
�
�
���T�-�-�.�����$�3�3��1��q�{�{�-�g�D�4��A�E��ryc��|jjjdd�}|s|�	d|t<y|j|�\}}|r||jfS|�|j|�||j|jj|jr|j|z|jfS|j|jfS)N�
inherit_cacheFT)r�r�r)r1�get_anonr�r��_static_cache_keyr:r�ru)r�r]r��
_gen_cache_ok�id_�founds      rv�_gen_cache_keyzBindParameter._gen_cache_keyes������/�/�3�3�O�U�K�
���#�%)���"��&�X�&�&�t�,�
��U������(�(��!����d�#�
��N�N��I�I�'�'�#'�#4�#4�D�H�H�x��� � �
�	
�;?�(�(�� � �
�	
ryc��|js<d|_tjt|�|jxsdd��|_yy)NTr5r6)rr�r�rIr<r�r�s rvrz BindParameter._convert_to_unique|s@���{�{��D�K�'�6�6��4��$�.�.�3�G�$�7��D�H�ryc��|jj�}|j}|jr|j�}d|d<||d<|S)z4execute a deferred value for serialization purposes.Nr1rs)r�r�rsr1)r�r�r�s   rvr�zBindParameter.__getstate__�sH��
�M�M��� ���J�J���=�=��
�
��A� �A�j�M���'�
��ryc���|jdd�r4tjt|�|jdd�d��|d<|jj|�y)NrFr<r5Tr6r�)r)r�r�rIr�rr�s  rvr�zBindParameter.__setstate__�sS���9�9�X�u�%�+�:�:��4��%�)�)�K��9��;��E�%�L�	
�
�
���U�#ryc��|jj�d|j�d|j�d|j�d�S)N�(z, z, type_=�))r�r�r�rsr�r�s rvrHzBindParameter.__repr__�s.���N�N�#�#��H�H��J�J��I�I�	
�	
ry)r�rMrsrrt�!Optional[_TypeEngineArgument[_T]]rr(r
z#Union[bool, Literal[_NoArg.NO_ARG]]rD�Optional[bool]rEzOptional[Callable[[], Any]]r�r(r=r(rur(r�rSr�zOptional[TypeEngine[Any]]r?r()r�r3)r�rrh)rr(r�rr�rB) r�r�r�r�r�r7�dp_anon_name�dp_type�
dp_plain_dict�dp_plain_obj�
dp_booleanr2rWr?rgr:rSr)r.rGrJrmrLrNr�r�r&rYrr�r�rHrqryrvr�r��s����(!�N�
�!�.�.�/�	�"�*�*�+�	�&�4�4�5�	�#�0�0�1�	�-�8�8�9�3��/��

�H�
�����H����L��M�
�]�]�37��8>�
�
� $�15�� � %�8<�7;��e�
�e��e�1�	e�
�e�6�
e��e�/�e��e��e��e� 6�e�5�e��e�N/4�f�
��
��
��2��
�"
�.�	�$�
ryr�c�D�eZdZUdZdZdejfgZded<d�Z	y)�
TypeClausezTHandle a type keyword in a SQL statement.

    Used by the ``Case`` statement.

    �
typeclauser�r\r2c��||_yrp)r�r�s  rvrGzTypeClause.__init__�s	����	ryN)
r�r�r�r�r�r7rcr2rWrGrqryrvrhrh�s4���"�N�
�"�*�*�+�3��/��ryrhc��eZdZUdZdZdejfdejfgZde	d<dZ
dZejdej�Zd	Zd	Zd	Zd	Zedd
��Zd�Zedd��Zd
Zde	d<d
Zde	d<d	Zed��Zdd�Ze						dd��Zej@d�						dd��Z!edd��Z"ed��Z#	d			d d�Z$y
)!�
TextClauseaRepresent a literal SQL text fragment.

    E.g.::

        from sqlalchemy import text

        t = text("SELECT * FROM users")
        result = connection.execute(t)

    The :class:`_expression.TextClause` construct is produced using the
    :func:`_expression.text`
    function; see that function for full documentation.

    .. seealso::

        :func:`_expression.text`

    �
textclause�_bindparamsr�r\r2Tz(?<![:\w\x5c]):(\w+)(?!:)Fc��y�Nrqrqr�s rv�_hide_fromszTextClause._hide_froms�s��ryc��t||�Srp)r�r�s  rvr�zTextClause.__and__�s���D�%� � ryc��|fSrprqr�s rvr�zTextClause._select_iterable�r�ryNrMr�r�c� �|jdk(S�N�*)r�r�s rvrlzTextClause._is_star�s���y�y�C��ryc�`��i�_�fd�}�jj||��_y)Nc���t|jd���j|jd�<d|jd�zS)Nrz:%s)r��grouprn)�mr�s �rv�replz!TextClause.__init__.<locals>.repl�s;���+8������+D�D���Q�W�W�Q�Z�(��1�7�7�1�:�%�%ry)rn�_bind_params_regex�subr�)r�r�r{s`  rvrGzTextClause.__init__�s,���:<���	&��+�+�/�/��d�;��	ryc��|jj�x|_}|D]!}	||j}|||j<�#|j
�D]!\}}	||}|j|d��||<�#|S#t$r(}t	j
d|jz�|�d}~wwxYw#t$r}t	j
d|z�|�d}~wwxYw)a�Establish the values and/or types of bound parameters within
        this :class:`_expression.TextClause` construct.

        Given a text construct such as::

            from sqlalchemy import text

            stmt = text(
                "SELECT id, name FROM user WHERE name=:name AND timestamp=:timestamp"
            )

        the :meth:`_expression.TextClause.bindparams`
        method can be used to establish
        the initial value of ``:name`` and ``:timestamp``,
        using simple keyword arguments::

            stmt = stmt.bindparams(
                name="jack", timestamp=datetime.datetime(2012, 10, 8, 15, 12, 5)
            )

        Where above, new :class:`.BindParameter` objects
        will be generated with the names ``name`` and ``timestamp``, and
        values of ``jack`` and ``datetime.datetime(2012, 10, 8, 15, 12, 5)``,
        respectively.  The types will be
        inferred from the values given, in this case :class:`.String` and
        :class:`.DateTime`.

        When specific typing behavior is needed, the positional ``*binds``
        argument can be used in which to specify :func:`.bindparam` constructs
        directly.  These constructs must include at least the ``key``
        argument, then an optional value and type::

            from sqlalchemy import bindparam

            stmt = stmt.bindparams(
                bindparam("name", value="jack", type_=String),
                bindparam("timestamp", type_=DateTime),
            )

        Above, we specified the type of :class:`.DateTime` for the
        ``timestamp`` bind, and the type of :class:`.String` for the ``name``
        bind.  In the case of ``name`` we also set the default value of
        ``"jack"``.

        Additional bound parameters can be supplied at statement execution
        time, e.g.::

            result = connection.execute(
                stmt, timestamp=datetime.datetime(2012, 10, 8, 15, 12, 5)
            )

        The :meth:`_expression.TextClause.bindparams`
        method can be called repeatedly,
        where it will re-use existing :class:`.BindParameter` objects to add
        new information.  For example, we can call
        :meth:`_expression.TextClause.bindparams`
        first with typing information, and a
        second time with value information, and it will be combined::

            stmt = text(
                "SELECT id, name FROM user WHERE name=:name "
                "AND timestamp=:timestamp"
            )
            stmt = stmt.bindparams(
                bindparam("name", type_=String), bindparam("timestamp", type_=DateTime)
            )
            stmt = stmt.bindparams(
                name="jack", timestamp=datetime.datetime(2012, 10, 8, 15, 12, 5)
            )

        The :meth:`_expression.TextClause.bindparams`
        method also supports the concept of
        **unique** bound parameters.  These are parameters that are
        "uniquified" on name at statement compilation time, so that  multiple
        :func:`_expression.text`
        constructs may be combined together without the names
        conflicting.  To use this feature, specify the
        :paramref:`.BindParameter.unique` flag on each :func:`.bindparam`
        object::

            stmt1 = text("select id from table where name=:name").bindparams(
                bindparam("name", value="name1", unique=True)
            )
            stmt2 = text("select id from table where name=:name").bindparams(
                bindparam("name", value="name2", unique=True)
            )

            union = union_all(stmt1.columns(column("id")), stmt2.columns(column("id")))

        The above statement will render as:

        .. sourcecode:: sql

            select id from table where name=:name_1
            UNION ALL select id from table where name=:name_2

        .. versionadded:: 1.3.11  Added support for the
           :paramref:`.BindParameter.unique` flag to work with
           :func:`_expression.text`
           constructs.

        z?This text() construct doesn't define a bound parameter named %rNF)r
)rnr�r<�KeyErrorr;�
ArgumentErrorr�rJ)	r��binds�names_to_values�
new_paramsr��existingr�r�rss	         rvr�zTextClause.bindparams	s��X)-�(8�(8�(=�(=�(?�?���:��D�
6�&�d�n�n�5��26�
�8�-�-�.��*�/�/�1�J�C��
N�%�c�?��#+�"6�"6�u�u�"6�"M�
�3��2����%�
��'�'�/�15���@�����
���
��'�'�/�14�5�����
�s/�A>�B2�>	B/�#B*�*B/�2	C�;C�Czsqlalchemy.sql.selectablec	�@�tjj}|D�cgc]&}tjt
j|���(}}|D�cgc]A}|j|vr/t|j|j|j��n|��C}}|j�D��cgc]\}}t||���}	}}|jj|j�}
|
j|||	zt|�xr|	��|
Scc}wcc}wcc}}w)a�Turn this :class:`_expression.TextClause` object into a
        :class:`_expression.TextualSelect`
        object that serves the same role as a SELECT
        statement.

        The :class:`_expression.TextualSelect` is part of the
        :class:`_expression.SelectBase`
        hierarchy and can be embedded into another statement by using the
        :meth:`_expression.TextualSelect.subquery` method to produce a
        :class:`.Subquery`
        object, which can then be SELECTed from.

        This function essentially bridges the gap between an entirely
        textual SELECT statement and the SQL expression language concept
        of a "selectable"::

            from sqlalchemy.sql import column, text

            stmt = text("SELECT id, name FROM some_table")
            stmt = stmt.columns(column("id"), column("name")).subquery("st")

            stmt = (
                select(mytable)
                .select_from(mytable.join(stmt, mytable.c.name == stmt.c.name))
                .where(stmt.c.id > 5)
            )

        Above, we pass a series of :func:`_expression.column` elements to the
        :meth:`_expression.TextClause.columns` method positionally.  These
        :func:`_expression.column`
        elements now become first class elements upon the
        :attr:`_expression.TextualSelect.selected_columns` column collection,
        which then
        become part of the :attr:`.Subquery.c` collection after
        :meth:`_expression.TextualSelect.subquery` is invoked.

        The column expressions we pass to
        :meth:`_expression.TextClause.columns` may
        also be typed; when we do so, these :class:`.TypeEngine` objects become
        the effective return type of the column, so that SQLAlchemy's
        result-set-processing systems may be used on the return values.
        This is often needed for types such as date or boolean types, as well
        as for unicode processing on some dialect configurations::

            stmt = text("SELECT id, name, timestamp FROM some_table")
            stmt = stmt.columns(
                column("id", Integer),
                column("name", Unicode),
                column("timestamp", DateTime),
            )

            for id, name, timestamp in connection.execute(stmt):
                print(id, name, timestamp)

        As a shortcut to the above syntax, keyword arguments referring to
        types alone may be used, if only type conversion is needed::

            stmt = text("SELECT id, name, timestamp FROM some_table")
            stmt = stmt.columns(id=Integer, name=Unicode, timestamp=DateTime)

            for id, name, timestamp in connection.execute(stmt):
                print(id, name, timestamp)

        The positional form of :meth:`_expression.TextClause.columns`
        also provides the
        unique feature of **positional column targeting**, which is
        particularly useful when using the ORM with complex textual queries. If
        we specify the columns from our model to
        :meth:`_expression.TextClause.columns`,
        the result set will match to those columns positionally, meaning the
        name or origin of the column in the textual SQL doesn't matter::

            stmt = text(
                "SELECT users.id, addresses.id, users.id, "
                "users.name, addresses.email_address AS email "
                "FROM users JOIN addresses ON users.id=addresses.user_id "
                "WHERE users.id = 1"
            ).columns(
                User.id,
                Address.id,
                Address.user_id,
                User.name,
                Address.email_address,
            )

            query = (
                session.query(User)
                .from_statement(stmt)
                .options(contains_eager(User.addresses))
            )

        The :meth:`_expression.TextClause.columns` method provides a direct
        route to calling :meth:`_expression.FromClause.subquery` as well as
        :meth:`_expression.SelectBase.cte`
        against a textual SELECT statement::

            stmt = stmt.columns(id=Integer, name=String).cte("st")

            stmt = select(sometable).where(sometable.c.id == stmt.c.id)

        :param \*cols: A series of :class:`_expression.ColumnElement` objects,
         typically
         :class:`_schema.Column` objects from a :class:`_schema.Table`
         or ORM level
         column-mapped attributes, representing a set of columns that this
         textual string will SELECT from.

        :param \**types: A mapping of string names to :class:`.TypeEngine`
         type objects indicating the datatypes to use for names that are
         SELECTed from the textual string.  Prefer to use the ``*cols``
         argument as it also indicates positional ordering.

        )�
positional)r=r��sql_selectablerr}r�LabeledColumnExprRoler�r�r�r�rXr��_initr()r��cols�typesr��col�
input_cols�positional_input_colsr�rt�keyed_input_cols�elems           rvr�zTextClause.columns�	s-��n�^�^�2�2�
�KO�.
�JN�3�I���U�8�8�#�>�$�	�.
�"�
!
�"���7�7�e�#��S�W�W�e�i�i����&8�9���"�
	�!
�8=�{�{�}�4
�7D���e�L��e�$�}�	�4
��'�'�/�/�
�0H�0H�I���
�
��!�$4�4��1�2�K�;K�7K�	�	
�
���-.
��!
��4
s�+D�AD�+Dc�"�tjSrpr�r�s rvr�zTextClause.type 
s��� � � ryc�8�|jj|�Srp)r�r�r�s rvr�zTextClause.comparator$
s���y�y�+�+�D�1�1ryc�@�|tjurt|�S|Srp)r�in_opr�rs  rvrzTextClause.self_group*
s���i�o�o�%��D�>�!��Kry)r�zIterable[FromClause]r)r�r�)r�rr�rr�rB)r��_ColumnExpressionArgument[Any]r�z_TypeEngineArgument[Any]r�rX)r�zTypeEngine[Any]rp�rrSr�zUnion[Self, Grouping[Any]])%r�r�r�r�r�r7�dp_string_clauseelement_dict�	dp_stringr2rWrbr_�rer��UNICODEr|rrrrwrmrqr�r�r�r�rrlrGr(r�r=r�r�r�r�rrqryrvrlrl�s����&"�N�
�)�F�F�G�	�"�,�,�-�3��/��
�O��K�#����$@�"�*�*�M��"��&+�#�!��$��
����!�����
�C��� �F�M� � ��
� �� �	<��E�"�E��E�
�	E��E�N�T���4�5�N�-�N�*�N�
�	N�6�N�`�!��!��2��2�15��-��	#�ryrlc�j�eZdZUdZdZgZded<ded<esejd	d��Z
ed
d��Zy)�Nullz�Represent the NULL keyword in a SQL statement.

    :class:`.Null` is accessed as a constant via the
    :func:`.null` function.

    �nullr\r2�
_singletonc�"�tjSrpr�r�s rvr�z	Null.typeB
s���$�$�$ryc�"�tjS)z+Return a constant :class:`.Null` construct.)r�r���clss rv�	_instancezNull._instanceF
s�����ryNr)r�r�)
r�r�r�r�r�r2rWrr=rTr��classmethodr�rqryrvr�r�3
sO����N�24��/�4����	
�	�	�	%�
 �	%����ryr�c�r�eZdZUdZdZgZded<ded<esejd
d��Z
dd�Zedd��Z
y	)
�False_z�Represent the ``false`` keyword, or equivalent, in a SQL statement.

    :class:`.False_` is accessed as a constant via the
    :func:`.false` function.

    �falser\r2r�c�"�tjSrp�rr�r�s rvr�zFalse_.type`
����'�'�'ryc�"�tjSrp��True_r�r�s rvr7zFalse_._negated
s�����ryc�"�tjSrp�r�r�r�s rvr�zFalse_._instanceg
s��� � � ryNr�r�r��r�r�)r�r�r�r�r�r2rWrr=rTr�r7r�r�rqryrvr�r�P
sT����N�24��/�4����	
�	�	�	(�
 �	(� ��!��!ryr�c��eZdZUdZdZgZded<ded<esejdd��Z
dd�Ze				d
d��Z
edd	��Zy
)r�z�Represent the ``true`` keyword, or equivalent, in a SQL statement.

    :class:`.True_` is accessed as a constant via the
    :func:`.true` function.

    �truer\r2r�c�"�tjSrpr�r�s rvr�z
True_.type~
r�ryc�"�tjSrpr�r�s rvr7z
True_._negate�
s��� � � ryc�*�|�|j�S|Srp)r�)r�rs  rv�_ifnonez
True_._ifnone�
s���=��=�=�?�"��Lryc�"�tjSrpr�r�s rvr�zTrue_._instance�
s�����ryNrr�)r�Optional[ColumnElement[Any]]r�r\r�)r�r�r�r�r�r2rWrr=rTr�r7r�r�r�rqryrvr�r�o
sx����N�24��/�4����	
�	�	�	(�
 �	(�!���0��	����� �� ryr�c�4�eZdZUdZdZdZdejfdejfgZ	de
d<de
d<ejdde
jd	�									dd
�Ze	d					dd��Zdd
�Zdd�Zedd��Zd�Zej0dd��Z	d			dd�Zy)�
ClauseListzzDescribe a list of clauses, separated by an operator.

    By default, is comma-separated, such as a column listing.

    �
clauselistT�clausesr;r\r2r)r;ry�group_contents�_literal_as_text_rolec��||_||_||_|}|}||_|jrF|D�cgc]4}t	j
|||��j
|j����6c}|_n+|D�cgc]}t	j
|||����c}|_tj|j�|_
ycc}wcc}w)N��apply_propagate_attrsr:)r;ryr��_text_converter_rolerr}rr�r�
is_booleanr)	r�r;ryr�r�r��clauses_iterator�text_converter_roler�s	         rvrGzClauseList.__init__�
s���!��
���
�,���EL��3H��$7��!����
/�	�/�F�� � �'��t���*�T�]�]�*�3�4�/�	�D�L�/�	�/�F�� � �'��t��/�	�D�L�'0�&:�&:�4�=�=�&I��#����s�9C�7CNc��|j|�}|rt|�ng|_d|_||_d|_d|_|S)NTF)r�r�r�ryr;r�r�r�r;r�r�s    rv�_construct_rawzClauseList._construct_raw�
sD���{�{�3���(/�t�G�}�R�����
� ��
�"���&+��#��ryc�,�t|j�Srp��iterr�r�s rv�__iter__zClauseList.__iter__�
����D�L�L�!�!ryc�,�t|j�Srp��lenr�r�s rv�__len__zClauseList.__len__�
����4�<�<� � ryc��tjj|jD�cgc]}|j��c}�Scc}wrp)r�r��
from_iterabler�r�)r�r�s  rvr�zClauseList._select_iterable�
s8�����,�,�/3�|�|�<�|�t�T�
"�
"�|�<�
�	
��<s�Ac�6�|jrT|jjtj|j
|�j
|j���y|jjtj|j
|��y�Nr:)r�r�r�rr}r�rr;�r�r�s  rvr�zClauseList.append�
su������L�L���� � ��!:�!:�F�C�N�N� �M�M�O��
�
�L�L���� � ��!:�!:�F�C�
ryc��ttj|jD�cgc]}|j��c}��Scc}wrp�r�r�r�r�r�r�s  rvr�zClauseList._from_objects�
�0���I�O�O�t�|�|�%L�|�!�a�o�o�|�%L�M�N�N��%L��>c�t�|jr+tj|j|�rt	|�S|Srp)ryr�is_precedentr;r�rs  rvrzClauseList.self_group�
s-���:�:�)�0�0�����H��D�>�!��Kry)
r�r�r;rPryr(r�r(r�zType[roles.SQLRole]rp)r;rPr�rr�r��r�zIterator[ColumnElement[Any]]rbrrOr�)r�r�r�r�r�rhr7�dp_clauseelement_list�dp_operatorr2rWr�comma_opr�WhereHavingRolerGr�r�r�r�rmr�r�r=ror�rrqryrvr�r��
s0���"�N��O�
�%�;�;�<�	�&�2�2�3�3��/��
&�%�
"+�!3�!3��#�5:�5J�5J�
J�0�J��J��	J�
�J� 3�
J�>�;?����8��
�	���"�!��
��
�

�
�"�"�O�#�O�15��-��	#�ryr�c��eZdZUdZded<ded<dZded<ed	��Z	d			dd�Ze		dd��Z	e
d
d
d
�													dd��Zy
)�OperatorExpressionz[base for expressions that contain an operator and operands

    .. versionadded:: 2.0

    rPr;r�r�Tr(ryc�@�tj|j�Srp)rr�r;r�s rvr�z OperatorExpression.is_comparisons���&�&�t�}�}�5�5ryNc���|jr tj|j|�s1|tjur*tj
|j�st
|�S|Srp)ryrr�r;r=r�r�rs  rvrzOperatorExpression.self_groupsP��
�J�J��&�&�t�}�}�g�>�
�9�=�=�(�!�,�,�T�]�]�;��D�>�!��Kryc��t��rpr"r�s rv�_flattened_operator_clausesz.OperatorExpression._flattened_operator_clauses$s
��"�#�#ry)�negate�	modifiersc��tj|�r�|�
Jd|����d}t|dd�|ur*|j|j�rd}|j
}n|f}t|dd�|ur*|j|j�rd}|j
}	n|f}	|rt
j||g||	z���S|jrd}t||||||��S)Nz.negate not supported for associative operator Fr;T)rtr�r�)
r�is_associativer��_compare_type_affinityr�r��ExpressionClauseList�_construct_for_listrw�BinaryExpression)
r��left�rightr}rtr�r��multi�left_flattened�right_flatteneds
          rv�_construct_for_opz$OperatorExpression._construct_for_op*s���#�#�B�'���
E�?��t�D�
E���E���j�$�����4�4�T�Y�Y�?���!%�!A�!A��"&�����z�4�����4�4�U�Z�Z�@���"'�"C�"C��#(�(���+�?�?����%��6����)�)��F���%��5��9�
�	
ryrp�rrSr�zUnion[Self, Grouping[_T]]�r��%typing_Tuple[ColumnElement[Any], ...])r�r\r�r\r}rPrtr�r�rSr�rRr�zOperatorExpression[_T])r�r�r�r�rWryrmr�rr�r�r�rqryrvr�r�s������
���E�4��
�6��6�15��-��	"��$�$�	.�$��$�
�*.�15�,
� �,
�"�,
�
�	,
��
,
�'�,
�/�,
�
 �,
��,
ryr�c��eZdZUdZdZdejfdejfgZde	d<de	d<de	d	<d
d�					dd�Z
e		dd
��Zdd�Z
dd�Zedd��Zej"dd��Zdd�Zedd�									dd��Zdd�Zy
) r�a9Describe a list of clauses, separated by an operator,
    in a column expression context.

    :class:`.ExpressionClauseList` differs from :class:`.ClauseList` in that
    it represents a column-oriented DQL expression only, not an open ended
    list of anything comma separated.

    .. versionadded:: 2.0

    �expression_clauselistr�r;r\r2r�r(ryN�rtc����|�_t�fd�|D���_tj�j��_t
j|��_y)Nc3�j�K�|]*}tjtj|������,y�w)r�N)rr}r�ExpressionElementRole)r�r�r�s  �rvr�z0ExpressionClauseList.__init__.<locals>.<genexpr>ys:�����
�"��
����+�+�V�4�
�
�"�s�03)	r;r'r�rr�rr�to_instancer�)r�r;rtr�s`   rvrGzExpressionClauseList.__init__qsR���!��
��
�"�	
�
���'0�&:�&:�4�=�=�&I��#��(�(��/��	ryc��|jSrp�r�r�s rvr�z0ExpressionClauseList._flattened_operator_clauses�s���|�|�ryc�,�t|j�Srpr�r�s rvr�zExpressionClauseList.__iter__�r�ryc�,�t|j�Srpr�r�s rvr�zExpressionClauseList.__len__�r�ryc��|fSrprqr�s rvr�z%ExpressionClauseList._select_iterable�r�ryc��ttj|jD�cgc]}|j��c}��Scc}wrpr�r�s  rvr�z"ExpressionClauseList._from_objects�r�r�c�0�|xj|fz
c_yrprr�s  rv�_append_inplacez$ExpressionClauseList._append_inplace�s������	�!�ryT)ryc����|j|�}||_|rt�fd�|D��|_n||_�|_||_|D]"}|js�|j|_|S|S)Nc3�B�K�|]}|j������y�w)r:N)r)r�r�r;s  �rvr�z;ExpressionClauseList._construct_for_list.<locals>.<genexpr>�s �����!�8?�1����X��.��s�)r�ryr'r�r;r�r�)r�r;rtryr�r�r�s `     rvr�z(ExpressionClauseList._construct_for_list�s}����{�{�3�����
�� �!�8?�!��D�L�#�D�L� ��
���	��A��!�!�()�(:�(:��%����	��ryc��|jtj��}t|t�sJ�t|tjd��Sr�r<r@s  rvr7zExpressionClauseList._negate�s>���/�/�)�-�-�/�8���'�=�1�1�1���i�m�m�T�
�	
ry)r;rPr�r�rtr`r�r�rbrrO)r�r\r�r)
r;rPrtr�r�r\ryr(r�zExpressionClauseList[_T]�r�r)r�r�r�r�r�r7�dp_clauseelement_tupler�r2rWrGrmr�r�r�r�r=ror�r	r�r�r7rqryrvr�r�Zs��	�-�N�
�%�<�<�=�	�&�2�2�3�3��/��
3�2��K�48�	0��0�1�0�1�	0�"��	.����
"�!�����
�"�"�O�#�O�"��������%�	�
��
"�
���.
ryr�c�V��eZdZdZdZd�Ze										dd��Zeejf													d
d��Z
e				dd��Ze	d					dd��Zeejf					dd��Z
eejf					dd	��Zedd
��Z	d			d�fd�
Z�xZS)rar�Tc��td��)Nz+BooleanClauseList has a private constructorr")r��argr�s   rvrGzBooleanClauseList.__init__�s��!�9�
�	
ryc���d}g}tj}d}|D].}	|	|ur|	}�
|	|ur|	g}d}n|sd}n|}d}|j|	��0|s|�|g}d}||D�
cgc]}
|
j|����c}
fScc}
w)Nrrr:r:)rr�r�r)r�r;�continue_on�skip_onr��has_continue_on�convert_clausesr�lccr�r�s           rv�_process_clauses_for_booleanz.BooleanClauseList._process_clauses_for_boolean�s��������#�#�����F���$�#)���7�"�$*�(�������C�&�G��C��&�&�v�.�)�,�?�#>�.�/�O��C��O�L�O�q�Q�\�\�'�\�2�O�L�L�L��Ls�A5c�\��|tjuro�j}tjd|�d|�d|�d|t
jurdnd�d|�d|t
jurdnd	�d
�
d��|j��S|j�||tj|f|z�D�cgc]&}tjtj|���(c}�\}	}
|	d
kDr:tjj!�fd�|
D��}|j�|�S|	sJ�|
dScc}w)Nz	Invoking z_() without arguments is deprecated, and will be disallowed in a future release.   For an empty z() construct, use 'r^ztrue()zfalse()z, *args)' or '�True�Falsez
, *args)'.r�)�versionrc3�h�K�|])}t|dd��urd�|jD�n|f���+y�w)r;Nc3� K�|]}|���y�wrprqr�s  rvr�z9BooleanClauseList._construct.<locals>.<genexpr>.<genexpr>s����D� C�1�Q� C�s�)r�r�)r��to_flatr;s  �rvr�z/BooleanClauseList._construct.<locals>.<genexpr>sF�����>� /�G��w�
�D�9�X�E�E�� C� C�D�!��$� /�s�/2r)r)r.r�r=�warn_deprecatedr�r�r�r�coerce_generator_argrr}rr�r�r�r�)r�r;rr�initial_clauser�r�r�r�rr�flattened_clausess `          rv�
_constructzBooleanClauseList._construct�sg����V�]�]�*��$�$�D�� � ��D�6�"J��F�-�d�V�1� +�u�/?�/?� ?�H�Y�5����a�)�U�-=�-=�=�F�7� ����

��%�%�h�/�/�"�?�?����#�7�7�#�%��/��
��F�� � ��!6�!6��?��
�	
 
���_���7�!*��� =� =�>� /�
>�!���%�%�h�0A�B�B��J�3�#�1�%�%��5
s�,+D)c���tjtjtj}}}|j||||�\}}|dkDr|j
||�S|dk(r|dSy)Nrr)rr�r�r�r�rr�)r�r�r;rrrrs       rv�_construct_for_whereclausez,BooleanClauseList._construct_for_whereclause*s~��

�N�N������� '�+�� #�?�?�����	 
���_���7��%�%�h��@�@�
�A�X�#�1�%�%�ryc��|j|�}|rt|�nd|_d|_||_t
j|_d|_|S)NrqT)	r�r'r�ryr;rr�r�rr�s    rvr�z BooleanClauseList._construct_rawFsI���{�{�3���)0�u�W�~�b�����
� ��
��(�(��	�&*��#��ryc��|jtjtjt
j|g|���S)zwProduce a conjunction of expressions joined by ``AND``.

        See :func:`_sql.and_` for full documentation.
        )r$rr�r�r�r��r�r"r�s   rvr�zBooleanClauseList.and_Ts=���s�~�~��N�N��������	
�
�
�	
ryc��|jtjtjt
j|g|���S)zuProduce a conjunction of expressions joined by ``OR``.

        See :func:`_sql.or_` for full documentation.
        )r$rr�r�r�r�r)s   rvr�zBooleanClauseList.or_hs=���s�~�~��M�M��������	
�
�
�	
ryc��|fSrprqr�s rvr�z"BooleanClauseList._select_iterable|r�ryc�@��|js|St�|�	|��Sr�)r�r*r)r�rr�s  �rvrzBooleanClauseList.self_group�s$����|�|��K��7�%�g�%�6�6ry)
r;rPrrrrr��Iterable[ColumnElement[Any]]r�z+typing_Tuple[int, List[ColumnElement[Any]]])r;rPrrrrr"rr�rr�rr�r\)r�r-r��Optional[ColumnElement[bool]]rp)r;rPr�rr�ra)r"z=Union[Literal[True], _ColumnExpressionArgument[bool], _NoArg]r��_ColumnExpressionArgument[bool]r�r�)r"z>Union[Literal[False], _ColumnExpressionArgument[bool], _NoArg]r�r/r�r�r)rrSr�zUnion[Self, Grouping[bool]])r�r�r�r�rSrGr�rr)r.r$r&r�r�r�rmr�rr/r�s@rvrara�s����,�N��M�
�
�(M��(M��(M��	(M�
.�(M�
5�
(M��(M�T�%�m�m�:&��:&��:&��	:&�
�:&��
:&��:&�
�:&��:&�x��2��	&����6�;?����8��
�	����

�M�M�	
�
�
�
2�
�
�

��
�&�

�M�M�	
�
�
�
2�
�
�

��
�&����15�7�-�7�	$�7�7ryrac���eZdZUdZdZejgzZded<ded<ejd�dd	�			d�fd
��Z
edd��Zdd�Z
ddd
�Z�xZS)rzRepresent a SQL tuple.r'r\r2rYr��sqlalchemy.sql.sqltypesN)r�c	�F��tjj}|�2|D�cgc]&}tjt
j|���(}}n�t|�t|�k7r#tjdt|�|fz��t||�D��cgc]9\}}tjt
j||js|nd����;}}}|j|D�cgc]}|j��c}�|_
t�|�<|�ycc}wcc}}wcc}w)Nz*Wrong number of elements for %d-tuple: %r r�)r=r��sql_sqltypesrr}rrr�r;r��zip�_isnullrYr�r*rG)	r�r�r��sqltypesr��init_clauses�typrr�s	        �rvrGzTuple.__init__�s ����>�>�.�.���=�!�6� �A�� � ��!<�!<�a�@� �
�6�
�5�z�S��\�)��'�'�@��5�z�7�+�,���"�%��1�
�2�F�C��� � ��/�/��%(�[�[�#�d��
2�

��'�H�&�&�\�(J�\�c����\�(J�K��	�
���,�'��)6����)Ks�+D�>D�*Dc��|fSrprqr�s rvr�zTuple._select_iterable�r�ryc���|rtd||dd||j��Stt||jj�D��cgc]\}}td|||d|����c}}�Scc}}w)NT)rsr�rr�rtr�)r�r�rrt)r�r�rr4r�)r�r;r�rtr��o�compared_to_types       rvr�zTuple._bind_param�s���� ���&.����"&�)�)��
��03�3��	�	���/H�
�0I�+��+�"���.6�*:�#�#�
�0I�
��
��
s�A'
c��|Srprqrs  rvrzTuple.self_group�����ry)r�r�r�z,Optional[Sequence[_TypeEngineArgument[Any]]]rrrp�rrSr�rB)r�r�r�r�r�r�r2rWr=r�rGrmr�r�rr/r�s@rvrr�s���� ��N�	�&�&��+��/���O��T���2�3�?C�(�0�(�<�(�4�(�<�����4�ryr.c���eZdZUdZdZdejfdejfdejfgZde	d<de	d<d	e	d<d
e	d<ddd�					dd
�Z
ejdd��Z
y)�Casea�Represent a ``CASE`` expression.

    :class:`.Case` is produced using the :func:`.case` factory function,
    as in::

        from sqlalchemy import case

        stmt = select(users_table).where(
            case(
                (users_table.c.name == "wendy", "W"),
                (users_table.c.name == "jack", "J"),
                else_="E",
            )
        )

    Details on :class:`.Case` usage is at :func:`.case`.

    .. seealso::

        :func:`.case`

    �casers�whens�else_r\r2z:List[typing_Tuple[ColumnElement[bool], ColumnElement[_T]]]rrr�N)rsrDc	��tjdd|�}	tj|�}|D��cgc]]\}}tj
tj||��j�tj
tj|�f��_c}}|_	|�d|_
n)tj
tj|�|_
|�*tj
tj|�|_nd|_td�t|j�D�|j�|jjntj �}t#t$|�|_y#t$rY��NwxYwcc}}w)NrCrBr�c3�fK�|])�^}}|jjs|j���+y�wrp)r�r5)r�r��thens   rvr�z Case.__init__.<locals>.<genexpr>)
s1����
�!5�H�Q���y�y�(�(�	�	�	�!5�s�/1)r�!_expression_collection_was_a_listr=�dictlike_iteritemsrDr}rrrrCrsrD�next�reversedr�rr�r	rf)r�rsrDrC�	new_whensr��rrts        rvrGz
Case.__init__
sN��$-�#N�#N��V�U�$
�	�	��/�/�	�:�I�$�

�$���A�� � ��/�/��*.���*�,�� � ��!<�!<�a�@�

�$�

��
��=��D�J�"�)�)�%�*E�*E�u�M�D�J���"�)�)�%�*E�*E�u�M�D�J��D�J��
�!)���� 4�	
� $�z�z�5�D�J�J�O�O�8�;L�;L�	
����U�O��	��G�	��	��

s�E0�A"F�0	E=�<E=c��ttj|j�D�cgc]}|j��c}��Scc}wrp)r�r�r�r�r�)r��xs  rvr�zCase._from_objects4
s<����O�O�t�7H�7H�7J�K�7J�!�a�o�o�7J�K�L�
�	
��Ks�A)rCzLUnion[typing_Tuple[_ColumnExpressionArgument[bool], Any], Mapping[Any, Any]]rs�
Optional[Any]rDrPrO)r�r�r�r�r�r7�dp_clauseelement�dp_clauseelement_tuplesr2rWrGr=ror�rqryrvrArA�s����.�N�
�#�4�4�5�	�#�;�;�<�	�#�4�4�5�3��/��F�E�&�&�'�'� $�#�1$�
�1$��
1$��1$�f
�"�"�
�#�
ryrAc��eZdZUdZdZdejfdejfgZde	d<de	d<de	d<d	e	d
<				dd�Z
ejdd��Z
ed
��Zy)r�aORepresent a ``CAST`` expression.

    :class:`.Cast` is produced using the :func:`.cast` factory function,
    as in::

        from sqlalchemy import cast, Numeric

        stmt = select(cast(product_table.c.unit_price, Numeric(10, 4)))

    Details on :class:`.Cast` usage is at :func:`.cast`.

    .. seealso::

        :ref:`tutorial_casts`

        :func:`.cast`

        :func:`.try_cast`

        :func:`.type_coerce` - an alternative to CAST that coerces the type
        on the Python side only, which is often sufficient to generate the
        correct SQL and data coercion.

    r	r�r�r\r2r\r�rhric���tj|�|_tjt
j||j|��|_t|j�|_	y�N)rtr�)
rrr�rr}rrr�rhri�r�r�rts   rvrGz
Cast.__init__`
sP��
�(�(��/��	��&�&��'�'���)�)�"&�	
���%�T�Y�Y�/��ryc�.�|jjSrp�r�r�r�s rvr�zCast._from_objectsn
����{�{�(�(�(ryc��|jSrp�r�r�s rvr$zCast.wrapped_column_expressionr
����{�{�ryN�r�r�rt�_TypeEngineArgument[_T]rO)r�r�r�r�r�r7rQrcr2rWrGr=ror�rmr$rqryrvr�r�;
s����2�N�
�$�5�5�6�	�"�*�*�+�3��/��

��
����0�2�0�'�0�
�"�"�)�#�)����ryr�c��eZdZdZdZdZy)�TryCastz�Represent a TRY_CAST expression.

    Details on :class:`.TryCast` usage is at :func:`.try_cast`.

    .. seealso::

        :func:`.try_cast`

        :ref:`tutorial_casts`
    �try_castTN)r�r�r�r�r�rSrqryrvr`r`w
s��	� �N��Mryr`c���eZdZUdZdZdejfdejfgZde	d<de	d<de	d<				dd	�Z
ejdd
��Z
ejd��Zed��Z	d			dd�Zy
)�
TypeCoerceaRepresent a Python-side type-coercion wrapper.

    :class:`.TypeCoerce` supplies the :func:`_expression.type_coerce`
    function; see that function for usage details.

    .. seealso::

        :func:`_expression.type_coerce`

        :func:`.cast`

    �type_coercer�r�r\r2r\r�c��tj|�|_tjt
j||j|��|_yrU)rrr�rr}rrr�rVs   rvrGzTypeCoerce.__init__�
s>��
�(�(��/��	��&�&��'�'���)�)�"&�	
��ryc�.�|jjSrprXr�s rvr�zTypeCoerce._from_objects�
rYryc��t|jt�r-|jj�}|j|_|S|jSrp)r�r�r�r&r�)r��bps  rv�typed_expressionzTypeCoerce.typed_expression�
s<���d�k�k�=�1����#�#�%�B��i�i�B�G��I��;�;�ryc��|jSrpr[r�s rvr$z$TypeCoerce.wrapped_column_expression�
r\ryNc��|jj|��}||jurt||j�S|Sr�)r�rrcr�)r�rrAs   rvrzTypeCoerce.self_group�
s=���+�+�(�(��(�9���$�+�+�%��g�t�y�y�1�1��Kryr]rOrp)rrSr�zTypeCoerce[_T])r�r�r�r�r�r7rQrcr2rWrGr=ror�r,rprirmr$rrqryrvrcrc�
s����#�N�
�$�5�5�6�	�"�*�*�+�3��/��

��
��
�2�
�'�
�
�"�"�)�#�)��#�#��$������15��-��	�ryrcc��eZdZUdZdZdejfdejfgZde	d<de	d<de	d<dd	�Z
ejd
d
��Z
y)�Extractz=Represent a SQL EXTRACT clause, ``extract(field FROM expr)``.�extract�expr�fieldr\r2r\r�c��tj|_||_t	j
tj|�|_yrp)	r�INTEGERTYPEr�rprr}rrro)r�rpros   rvrGzExtract.__init__�
s0���(�(��	���
��$�$�U�%@�%@�$�G��	ryc�.�|jjSrp)ror�r�s rvr�zExtract._from_objects�
s���y�y�&�&�&ryN)rpr�ror�rO)r�r�r�r�r�r7rQr�r2rWrGr=ror�rqryrvrmrm�
sg��G��N�
�"�3�3�4�	�#�-�-�.�3��/��
���J�H�

�"�"�'�#�'ryrmc�v�eZdZUdZdZdejfgZded<ded<d
d�Z	e
jdd��Zy	)�_label_referencea�Wrap a column expression as it appears in a 'reference' context.

    This expression is any that includes an _order_by_label_element,
    which is a Label, or a DESC / ASC construct wrapping a Label.

    The production of _label_reference() should occur when an expression
    is added to this context; this includes the ORDER BY or GROUP BY of a
    SELECT statement, as well as a few other places, such as the ORDER BY
    within an OVER clause.

    �label_reference�elementr\r2r
c��||_yrp�rw�r�rws  rvrGz_label_reference.__init__�
�	����ryc��gSrprqr�s rvr�z_label_reference._from_objects�
r�ryN)rwr
rO)
r�r�r�r�r�r7rQr2rWrGr=ror�rqryrvruru�
sV��
�'�N�
�%�6�6�7�3��/�����
�"�"��#�ryruc�h�eZdZUdZdej
fgZded<dd�Ze	jd	d��Zy)
�_textual_label_reference�textual_label_referencerwr\r2c��||_yrpryrzs  rvrGz!_textual_label_reference.__init__r{ryc�,�t|j�Srp)rlrwr�s rv�_text_clausez%_textual_label_reference._text_clauses���$�,�,�'�'ryN)rwr�)r�rl)r�r�r�r�r7r�r2rWrGr=rTr�rqryrvr~r~�
sG��.�N�
�%�/�/�0�3��/���
���(��(ryr~c��eZdZUdZdZdejfdejfdejfgZde	d<de	d<				d									dd
�Z
e				dd��Ze				dd��Z
e				dd
��Ze				dd��Ze				dd��Ze				dd��Zedd��Zej*dd��Zd�Z	d			dd�Zy	)r?a�Define a 'unary' expression.

    A unary expression has a single column expression
    and an operator.  The operator can be placed on the left
    (where it is called the 'operator') or right (where it is called the
    'modifier') of the column expression.

    :class:`.UnaryExpression` is the basis for several unary operators
    including those used by :func:`.desc`, :func:`.asc`, :func:`.distinct`,
    :func:`.nulls_first` and :func:`.nulls_last`.

    �unaryrwr;�modifierr\r2r�Nc���||_||_|j|_|j|jxs|j��|_tj|�|_||_yr�)	r;r�r�rrwrrr�r�)r�rwr;r�rtr�s      rvrGzUnaryExpression.__init__"sc��!��
� ��
� '� 8� 8����)�)��M�M�2�T�]�]�*�
����(�(��/��	�'>��$ryc�~�ttjtj|�t
jd��S�NF)r�r�)r?rr}r�ByOfRoler�nulls_first_op�r��columns  rv�_create_nulls_firstz#UnaryExpression._create_nulls_first7s1��
����U�^�^�V�4��-�-�$)�
�	
ryc�~�ttjtj|�t
jd��Sr�)r?rr}rr�r�
nulls_last_opr�s  rv�_create_nulls_lastz"UnaryExpression._create_nulls_lastBs1��
����U�^�^�V�4��,�,�$)�
�	
ryc�~�ttjtj|�t
jd��Sr�)r?rr}rr�r�desc_opr�s  rv�_create_desczUnaryExpression._create_descMs1������U�^�^�V�4��&�&�$)�
�	
ryc�~�ttjtj|�t
jd��Sr�)r?rr}rr�r�asc_opr�s  rv�_create_asczUnaryExpression._create_ascWs1��
����U�^�^�V�4��%�%�$)�
�	
ryc��tjtj|�}t	|t
j|jd��S�NF�r;rtr�)rr}rrr?r�distinct_opr��r�ro�col_exprs   rv�_create_distinctz UnaryExpression._create_distinctbsD��
'0�&6�&6��'�'��'
�����*�*��-�-�$)�	
�	
ryc��tjtj|�}t	|t
j|jd��Sr�)rr}rrr?r�bitwise_not_opr�r�s   rv�_create_bitwise_notz#UnaryExpression._create_bitwise_notqsD��
'0�&6�&6��'�'��'
�����-�-��-�-�$)�	
�	
ryc�n�tj|j�r|jjSyrp)r�is_order_by_modifierr�rwr�r�s rvr�z'UnaryExpression._order_by_label_element�s'���)�)�$�-�-�8��<�<�7�7�7�ryc�.�|jjSrp�rwr�r�s rvr�zUnaryExpression._from_objects�����|�|�)�)�)ryc�2�|jjtjjurSt	|jtj��tjtj|j��Stj|�S)Nr:r�)r�r�rr�r?rrr=r�r�r7r�s rvr7zUnaryExpression._negate�sk���9�9�#�#�x�';�';�'J�'J�J�"����	�
�
��6�"����*�*�(,�(D�(D�	�
�!�(�(��.�.ryc�t�|jr+tj|j|�rt|�S|Srp)r;rr�r�rs  rvrzUnaryExpression.self_group�s-���=�=�Y�3�3�D�M�M�7�K��D�>�!��Kry)NNNF)
rwr\r;rSr�rSrtr`r�r()r��_ColumnExpressionArgument[_T]r��UnaryExpression[_T])r�z'_ColumnExpressionOrStrLabelArgument[_T]r�r�)ror�r�r�rNrOrpr�)r�r�r�r�r�r7rQr�r2rWrGr�r�r�r�r�r�r�rmr�r=ror�r7rrqryrvr?r?
s�����N�
�%�6�6�7�	�&�2�2�3�	�&�2�2�3�3��/����
,0�+/�37�(-�
?�#�?�)�?�)�	?�
1�?�"&�
?�*�
�-�
�
�
��
��
�-�
�
�
��
��
�<�
�	�
��
��
�7�
�
�
��
��
�+�
�
�
��
��
�+�
�
�
��
�����
�"�"�*�#�*�	/�15��-��	"�ryr?c�X�eZdZdZdZdZe				dd��Ze				dd��Zd�Z	d�Z
y)	�CollectionAggregateaForms the basis for right-hand collection operator modifiers
    ANY and ALL.

    The ANY and ALL keywords are available in different ways on different
    backends.  On PostgreSQL, they only work for an ARRAY type.  On
    MySQL, they only work for subqueries.

    Tc��tjtj|�}|j	�}t|tjtjd��Sr�)
rr}rrrr�rr�rr�r�s   rv�_create_anyzCollectionAggregate._create_any��U��'0�&6�&6��'�'��'
���&�&�(��"���%�%��&�&�$)�	
�	
ryc��tjtj|�}|j	�}t|tjtjd��Sr�)
rr}rrrr�rr�rr�r�s   rv�_create_allzCollectionAggregate._create_all�r�ryc���tj|�stjd��d|d<|jj
tj|�g|��i|��S)N�2Only comparison operators may be used with ANY/ALLT�reverse)rr�r;r�r�r~�mirrorr|s    rvr~zCollectionAggregate.operate�s^���&�&�r�*��#�#�D��
�!��y��&�t���&�&�y�'7�'7��';�N�e�N�v�N�Nryc�Z�tj|�rJ�tjd��)Nr�)rr�r;r�r|s    rvr�z#CollectionAggregate.reverse_operate�s,���*�*�2�.�.�.����@�
�	
ryN)ror�r�zCollectionAggregate[bool])r�r�r�r�rSrwr�r�r�r~r�rqryrvr�r��se����M�#���

�0�

�	"�

��

��

�0�

�	"�

��

�$O�
ryr�c�6�eZdZdZd�Zed��Zddd�Zd�Zy)	r�Tc��||_tj|_||_||_d|_d|_|j|_y�NT)	rwrr�r�r;r�r�r�r)r�rwr;r�s    rvrGzAsBoolean.__init__�sA������(�(��	� ��
������
�'+��$�&-�&D�&D��#ryc��|jSrpryr�s rvr$z#AsBoolean.wrapped_column_expression�s���|�|�ryNc��|Srprqrs  rvrzAsBoolean.self_group�����ryc���t|jttf�r|jj	�St|j|j|j�Srp)r�rwr�r�r7r�r�r;r�s rvr7zAsBoolean._negate�sB���d�l�l�U�F�O�4��<�<�'�'�)�)��T�\�\�4�;�;��
�
�F�Fryrpr?)	r�r�r�rSrGrmr$rr7rqryrvr�r��s,���M�E������Gryr�c��eZdZUdZdZdejfdejfdejfdejfdejfdejfgZ
d	ed
<dejfdejfdejfdejfdejfgZdZ
	ded<d
ed<d
ed<			d											dd�Ze		dd��Zd�Zej&r				dd�Zej,dd��Zd�Zy)r�a�Represent an expression that is ``LEFT <operator> RIGHT``.

    A :class:`.BinaryExpression` is generated automatically
    whenever two column expressions are used in a Python binary expression:

    .. sourcecode:: pycon+sql

        >>> from sqlalchemy.sql import column
        >>> column("a") + column("b")
        <sqlalchemy.sql.expression.BinaryExpression object at 0x101029dd0>
        >>> print(column("a") + column("b"))
        {printsql}a + b

    �binaryr�r�r;r�r�r�r\r2TrRr\Nc���t|t�rtj|�}|j	�|j	�f|_|jxs|j|_|j|��|_|j|��|_	||_
tj|�|_
||_tj|�|_|�i|_y||_yr�)r�r�r�	custom_opr��_origr�rr�r�r;rrr�r�r�rr�)r�r�r�r;rtr�r�s       rvrGzBinaryExpression.__init__/s����h��$� �*�*�8�4�H��m�m�o�u�~�~�'7�8��
� $� 5� 5� O��9O�9O����O�O�H�O�5��	��%�%�h�%�7��
� ��
��(�(��/��	����&/�&:�&:�8�&D��#����D�N�&�D�Nryc�2�|j|jfSrp)r�r�r�s rvr�z,BinaryExpression._flattened_operator_clausesNs���	�	�4�:�:�&�&ryc��|jtjtjfvr|j|j�Std��)aImplement Python-side "bool" for BinaryExpression as a
        simple "identity" check for the left and right attributes,
        if the operator is "eq" or "ne".  Otherwise the expression
        continues to not support "bool" like all other column expressions.

        The rationale here is so that ColumnElement objects can be hashable.
        What?  Well, suppose you do this::

            c1, c2 = column("x"), column("y")
            s1 = set([c1, c2])

        We do that **a lot**, columns inside of sets is an extremely basic
        thing all over the ORM for example.

        So what happens if we do this? ::

            c1 in s1

        Hashing means it will normally use ``__hash__()`` of the object,
        but in case of hash collision, it's going to also do ``c1 == c1``
        and/or ``c1 == c2`` inside.  Those operations need to return a
        True/False value.   But because we override ``==`` and ``!=``, they're
        going to get a BinaryExpression.  Hence we implement ``__bool__`` here
        so that these comparisons behave in this particular context mostly
        like regular object comparisons.  Thankfully Python is OK with
        that!  Otherwise we'd have to use special set classes for columns
        (which we used to do, decades ago).

        rC)r;r�eq�ner�rDr�s rvrEzBinaryExpression.__bool__Ts@��<�=�=�Y�\�\�9�<�<�8�8�!�4�=�=�$�*�*�-�-��I�J�Jryc��yrprqr�s rvr8zBinaryExpression.__invert__|s��#&ryc�\�|jj|jjzSrp)r�r�r�r�s rvr�zBinaryExpression._from_objects�s!���y�y�&�&����)A�)A�A�Aryc�8�|j�qt|j|jj	|j|j
�|j|j
|j|j��S|j�j�S)N)r�rtr�)
r�r�r�r�r�r;r�r�rr7r�s rvr7zBinaryExpression._negate�sp���;�;�"�#��	�	��
�
�,�,�T�[�[�$�-�-�H�����}�}��i�i��.�.�
�
��?�?�$�,�,�.�.ry)NNN)r�r\r�r\r;rPrtr`r�rSr�rRr�)r��BinaryExpression[_T]r�r�rO)r�r�r�r�r�r7rQr�rdrcr2rWr�rrGrmr�rErnrr8r=ror�r7rqryrvr�r��s���
��N�
�"�3�3�4�	�#�4�4�5�	�&�2�2�3�	�$�0�0�1�	�'�5�5�6���%�%�	
�
3��/�
�
�"�3�3�4�	�#�4�4�5�	�&�2�2�3�	�'�5�5�6�
��%�%�	
���"���
+�*�
����48�)-�15�'� �'�"�'��	'�
1�'�'�
'�/�'�>�'�	.�'��'�
$K�L���	'�&�	'�
!�	'�
�"�"�B�#�B�/ryr�c��eZdZUdZdZdejfdejfdejfgZded<dd	�Z	ddd
�Z
y)
�Slicez�Represent SQL for a Python array-slice object.

    This is not a specific SQL construct at this level, but
    may be interpreted by specific dialects, e.g. PostgreSQL.

    �slice�start�stop�stepr\r2Nc��tjtj||tj
��|_tjtj||tj
��|_tjtj||tj
��|_tj|_
y)N)r�rt)rr}rrrrrr�r�r�r�r�)r�r�r�r��_names     rvrGzSlice.__init__�s����%�%��'�'����&�&�	
��
��$�$��'�'����&�&�	
��	��$�$��'�'����&�&�	
��	��%�%��	ryc�.�|tjusJ�|Srp)r;�getitemrs  rvrzSlice.self_group�s���(�*�*�*�*�*��ryrpr?)r�r�r�r�r�r7rQr2rWrGrrqryrvr�r��sW����N�
�#�4�4�5�	�"�3�3�4�	�"�3�3�4�3��/��&�*ryr�c��eZdZdZdZy)�IndexExpressionzJRepresent the class of expressions that are like an "index"
    operation.TN)r�r�r�r�rSrqryrvr�r��s����Mryr�c�0�eZdZUdZdZded<dd	d�Zd�Zy)
�GroupedElementz&Represent any parenthesized expression�groupingr�rwNc��|Srprqrs  rvrzGroupedElement.self_group�r�ryc�6�|jj�Srp)rwr r�s rvr zGroupedElement._ungroup�s���|�|�$�$�&�&ryrpr?)r�r�r�r�r�rWrr rqryrvr�r��s��0��N�
���'ryr�c�N�eZdZUdZdej
fdejfgZded<dej
fgZ	ded<		dd�Z
d�Zejd	��Zejdd
��Zejdd��Zej$dd��Zd
�Zd�Zd�Zer
	d			dd�Zyy)r�z/Represent a grouping within a column expressionrwr�r\r2�0Union[TextClause, ClauseList, ColumnElement[_T]]c�t�||_t|dtj�|_|j
|_y)Nr�)rwr�rr�r�r�rzs  rvrGzGrouping.__init__�s1������G�V�X�->�->�?��	� '� 8� 8��ryc�V�|j|jj|��Srp)r�rwr�r�s  rvr�z"Grouping._with_binary_element_type�s ���~�~�d�l�l�D�D�U�K�L�Lryc�.�|jjSrp�rwrr�s rvrzGrouping._is_implicitly_boolean�����|�|�2�2�2ryc�L�t|jdd�xs|jSr)r�rwr�r�s rvrxzGrouping._tq_label�s$��
�D�L�L�+�t�4�M��8M�8M�	
ryc�T�t|jt�r
|jgSgSrp)r�rwr>r�s rvrvzGrouping._proxies�s!���d�l�l�M�2��L�L�>�!��Iryc�.�|jjSrpr�r�s rvr�zGrouping._from_objects�r�ryc�.�t|j|�Srp)r�rw)r��attrs  rvr�zGrouping.__getattr__s���t�|�|�T�*�*ryc�4�|j|jd�S)N�rwr�r�r�s rvr�zGrouping.__getstate__s���<�<����;�;ryc�,�|d|_|d|_y)Nrwr�r�r�s  rvr�zGrouping.__setstate__s���Y�'����&�M��	ryNc��yrprqrs  rvrzGrouping.self_groups��ry)rwr�rLrrOrpr?)r�r�r�r�r7rQrcr2rWr�rGr�r=rTrrkrxrvror�r�r�r�rrrqryrvr�r��s��9�
�%�6�6�7�	�"�*�*�+�3��/��
�%�6�6�7���>�=�9�G�9�M�
���3��3�
���
� �
�

���� ��
�"�"�*�#�*�+�<�"��59�	�1�	�
�	�ryr�c�<�eZdZdZdZ						dd�Z						dd�Zy)�_OverrideBindsaused by cache_key->_apply_params_to_element to allow compilation /
    execution of a SQL element that's been cached, using an alternate set of
    bound parameter values.

    This is used by the ORM to swap new parameter values into expressions
    that are embedded into loader options like with_expression(),
    selectinload().  Previously, this task was accomplished using the
    .params() method which would perform a deep-copy instead.  This deep
    copy proved to be too expensive for more complex expressions.

    See #11085

    �override_bindsc��||_t||�D��cic]\}}|j|j��c}}|_ycc}}wrp)rwr4r�rs�	translate)r�rwr��replaces_paramsr�r�s      rvrGz_OverrideBinds.__init__"sC�����'*�?�J�'G�
�'G�t�q�!�A�E�E�1�7�7�N�'G�
����
s�!Ac�x��g}�jj||�}|j�fd�|D��|S)ztgenerate a cache key for the given element, substituting its bind
        values for the translation values present.c3��K�|]I}|j�jvr+|j�j|jdd��n|���Ky�w)TF)rr
N)r�r�rJ)r�rhr�s  �rvr�z0_OverrideBinds._gen_cache_key.<locals>.<genexpr>6s[�����	
�#���6�6�T�^�^�+�����N�N�2�6�6�*������	�#�s�AA)rwrY�extend)r�r]r��existing_bps�cks`    rvrYz_OverrideBinds._gen_cache_key-sD���24��
�\�\�
(�
(��<�
@�����	
�#�	
�		
��	ryN)rwr
r�rQr�rQ)r]r]r�zList[BindParameter[Any]]r�z Optional[typing_Tuple[Any, ...]])r�r�r�r�r�rGrYrqryrvr�r�sL���&�N�	
�"�	
�1�	
�6�		
�� ��.F��	)�ryr�c��eZdZdZdZy)�
_OverRangerrN)r�r�r��RANGE_UNBOUNDED�
RANGE_CURRENTrqryrvr�r�Ds���O��Mryr�c�l�eZdZUdZdZdejfdejfdejfdejfdejfgZde	d	<d
Z
de	d<d
Zde	d<de	d<	d
e	d<d
e	d<				d									dd�Zd�Z
				dd�Zesej"dd��Zej&dd��Zy
)�OveraRepresent an OVER clause.

    This is a special operator against a so-called
    "window" function, as well as any aggregate function,
    which produces results relative to the result set
    itself.  Most modern SQL backends now support window functions.

    �overrw�order_by�partition_by�range_�rowsr\r2N�Optional[ClauseList]r
z0Optional[typing_Tuple[_IntOrRange, _IntOrRange]]c��||_|�1ttj|�dtj
i�|_|�1ttj|�dtj
i�|_|r5|j|�|_	|rtjd��d|_y|r|j|�|_d|_	ydx|_|_	y)Nr�z*'range_' and 'rows' are mutually exclusive)
rwr�r=�to_listrr�r�r��_interpret_ranger�r;r�r)r�rwr�r�r�rs      rvrGz
Over.__init__ms��������&����h�'��?D�~�~��D�M��#� *����l�+�!�&+�n�n�!�D��
��/�/��7�D�K���'�'�@���!��	�
��-�-�d�3�D�I��D�K�&*�*�D�I��ryc��|j|j|j|j|j|j
ffSrp)r�rwr�r�r�rr�s rv�
__reduce__zOver.__reduce__�s=���~�~��L�L�����M�M��K�K��I�I� 
�
�	
ryc���t|t�rt|�dk7rtjd��|\}}|�t
}n+t|t�r|}n	t|�}|dk(rt}	|�
t
}||fSt|t�r|}||fS	t|�}|dk(rt}||fS#t$r}tjd�|�d}~wwxYw#t$r}tjd�|�d}~wwxYw)Nr:z2-tuple expected for range/rowsrz(Integer or None expected for range value)
r�r'r�r;r�r�r�r]r��
ValueError)r�r��r0�r1�lowerr��uppers       rvrzOver._interpret_range�s���&�%�(�C��K�1�,<��#�#�$E�F�F����B�
�:�#�E�
��J�
'��E�
*��B����A�:�)�E�
�:�#�E��e�|����J�
'��E��e�|��
*��B����A�:�)�E��e�|���/�
��'�'�>�����
���
��'�'�>�����
�s0�B*�C�*	C�3C	�	C�	C5�C0�0C5c�.�|jjSrpr�r�s rvr�z	Over.type�s���<�<�$�$�$ryc��ttj|j|j|j
fD�cgc]}|�|j��c}��Scc}wrp)r�r�r�rwr�r�r�r�s  rvr�zOver._from_objects�s[����O�O�#�l�l�D�,=�,=�t�}�}�M��M���}��O�O�M��
�
�	
��s�A�NNNN)
rwr
r��Optional[_ByArgument]r�rr��4Optional[typing_Tuple[Optional[int], Optional[int]]]rr)r�z:typing_Tuple[Optional[_IntOrRange], Optional[_IntOrRange]]r�z&typing_Tuple[_IntOrRange, _IntOrRange]rrO)r�r�r�r�r�r7rQrer2rWr�r�rGrrrr=rTr�ror�rqryrvr�r�Os6����N�
�%�6�6�7�	�&�7�7�8�	�*�;�;�<�	�$�1�1�2�	�"�/�/�0�3��/��&*�H�"�)�)-�L�&�-�
���
=�<�
:�:�
/3�*.�GK�EI�
+�"�+�,�+�(�	+�
E�+�C�
+�B
�*�J�*�
0�*�X�	
�	�	�	%�
 �	%�
�"�"�	
�#�	
ryr�c�2�eZdZUdZdZdejfdejfgZded<dZ	ded<				dd	�Z
d
�Zddddd�									dd�Ze
dd
��Ze
						dd��Z				dd�Zesej"dd��Zej&dd��Zy)�WithinGroupa%Represent a WITHIN GROUP (ORDER BY) clause.

    This is a special operator against so-called
    "ordered set aggregate" and "hypothetical
    set aggregate" functions, including ``percentile_cont()``,
    ``rank()``, ``dense_rank()``, etc.

    It's supported only by certain database backends, such as PostgreSQL,
    Oracle Database and MS SQL Server.

    The :class:`.WithinGroup` construct extracts its type from the
    method :meth:`.FunctionElement.within_group_type`.  If this returns
    ``None``, the function's ``.type`` is used.

    �withingrouprwr�r\r2Nrc�z�||_|�2ttj|�dtj
i�|_yy)Nr�)rwr�r=rrr�r�)r�rwr�s   rvrGzWithinGroup.__init__�s:��
�����&����h�'��?D�~�~��D�M� ryc��|j|jf|j�t|j�zfSdzfSrp)r�rwr�r'r�s rvrzWithinGroup.__reduce__�sG���~�~�����$(�M�M�$=�E�$�-�-� � 
�
�	
�CE� 
�
�	
ry)r�r�rr�c�"�t|||||��S)z�Produce an OVER clause against this :class:`.WithinGroup`
        construct.

        This function has the same signature as that of
        :meth:`.FunctionElement.over`.

        �r�r�r�r�r�)r�r�r�rr�s     rvr�zWithinGroup.overs ����%����
�	
ryc��yrprqr�s rv�filterzWithinGroup.filters��!ryc��yrprq)r��_WithinGroup__criterion0�	criterions   rvrzWithinGroup.filters��
!ryc�"�|s|St|g|���S)z.Produce a FILTER clause against this function.)�FunctionFilter)r�rs  rvrzWithinGroup.filter!s����K��d�/�Y�/�/ryc�l�|jj|�}|�|S|jjSrp)rw�within_group_typer�)r��wgts  rvr�zWithinGroup.type+s0���,�,�0�0��6�C����
��|�|�(�(�(ryc��ttj|j|jfD�cgc]}|�|j
��c}��Scc}wrp)r�r�r�rwr�r�r�s  rvr�zWithinGroup._from_objects3sS����O�O�#�l�l�D�M�M�:��:���}��O�O�:��
�
�	
����A)rwz.Union[FunctionElement[_T], FunctionFilter[_T]]r�r�)
r�rr�rrrr�rr��Over[_T])r�rB)rr/rr/r�zFunctionFilter[_T])rr/r�zUnion[Self, FunctionFilter[_T]]rrO)r�r�r�r�r�r7rQr2rWr�rGrr�rrrr=rTr�ror�rqryrvrr�s8��� #�N�
�%�6�6�7�	�&�7�7�8�3��/��
&*�H�"�)�	�?�	�2�	�
�/3�*.�EI�GK�

�,�
�(�	
�
C�
�E�

�
�
�.�!��!�
�!�5�!�4�!�
�	!��!�0�9�0�	(�0��	
�	�	�	)�
 �	)�
�"�"�	
�#�	
ryrc�.�eZdZUdZdZdejfdejfgZded<dZ	ded<				dd	�Z
edd
��Z				d									dd�Z
				dd�Z				dd
�Z	d			dd�Zesej&dd��Zej*dd��Zy)r a�Represent a function FILTER clause.

    This is a special operator against aggregate and window functions,
    which controls which rows are passed to it.
    It's supported only by certain database backends.

    Invocation of :class:`.FunctionFilter` is via
    :meth:`.FunctionElement.filter`::

        func.count(1).filter(True)

    .. seealso::

        :meth:`.FunctionElement.filter`

    �
funcfilter�funcrr\r2Nr.c�L�||_|jj|g|���yrp)r)r�non_generative)r�r)rs   rvrGzFunctionFilter.__init__[s$��
��	�"����"�"�4�4�)�4ryc��t|�D]N}tjtj|�}|j
�|j
|z|_�H||_�P|S)a
Produce an additional FILTER against the function.

        This method adds additional criteria to the initial criteria
        set up by :meth:`.FunctionElement.filter`.

        Multiple criteria are joined together at SQL render time
        via ``AND``.


        )r�rr}rr�r)r�r�crits   rvrzFunctionFilter.filtercsR����O�D��#�#�E�$9�$9�4�@�D��~�~�)�!%���$�!6���!%���
$��ryc�"�t|||||��S)a�Produce an OVER clause against this filtered function.

        Used against aggregate or so-called "window" functions,
        for database backends that support window functions.

        The expression::

            func.rank().filter(MyClass.y > 5).over(order_by="x")

        is shorthand for::

            from sqlalchemy import over, funcfilter

            over(funcfilter(func.rank(), MyClass.y > 5), order_by="x")

        See :func:`_expression.over` for a full description.

        rr)r�r�r�r�rs     rvr�zFunctionFilter.overzs!��F��%����
�	
ryc��t|g|���S)zUProduce a WITHIN GROUP (ORDER BY expr) clause against
        this function.
        )r)r�r�s  rv�within_groupzFunctionFilter.within_group�s���4�+�(�+�+ryc��yrprq)r�r0s  rvr"z FunctionFilter.within_group_type�s��ryc�d�tjtj|�rt|�S|Srp)rr��	filter_opr�rs  rvrzFunctionFilter.self_group�s)���!�!�)�"5�"5�w�?��D�>�!��Kryc�.�|jjSrp)r)r�r�s rvr�zFunctionFilter.type�s���9�9�>�>�!ryc��ttj|j|jfD�cgc]}|�|j
��c}��Scc}wrp)r�r�r�r)rr�r�s  rvr�zFunctionFilter._from_objects�sS����O�O�#�i�i����8��8���}��O�O�8��
�
�	
��r%)r)z+Union[FunctionElement[_T], WithinGroup[_T]]rr/)rr/r�rBr)
r��YOptional[Union[Iterable[_ColumnExpressionArgument[Any]], _ColumnExpressionArgument[Any]]]r�r6r�rrrr�r&)r�r�r��WithinGroup[_T])r0r7r�rrpr�rrO)r�r�r�r�r�r7rQr2rWrrGr(rr�r0r"rrr=rTr�ror�rqryrvr r @s;���""�N�
�"�3�3�4�	�'�8�8�9�3��/��
04�I�,�3�5�9�5�4�5�����:
�
�GK�EI�)
�
�)
�
�)
�E�)
�C�)
� 
�!)
�V,�7�,�	�,��+��	!��15��-��	"���	
�	�	�	"�
 �	"�
�"�"�	
�#�	
ryr c�f�eZdZUdZdZded<ded<ded<d�Zejdd	��Z	e
jdd
��Ze
jdd��Z
e
jd��Ze
jd
��Z	d					dd�Z		d									dd�Zdddddd�																			dd�Zy)�NamedColumnFN�Optional[FromClause]�tabler�r�r�c��t|d�xr|j|jk(xs't|d�xr|j|jk(S)Nr�r�)r6r�r�r�s  rvr�z$NamedColumn._compare_name_for_result�sD����v�&�B�4�9�9��
�
�+B�
��E�8�$�D�������)D�	
ryc��|jSrp�r�r�s rvr�zNamedColumn.description�����y�y�ryc�v�|j}|r ||jk7r|j|�S|jS)z�table qualified label based on column key.

        for table-bound columns this is <tablename>_<column key/proxy key>;

        all other expressions it resolves to key/proxy key.

        )rzr��
_gen_tq_labelrx)r�r�s  rvr{zNamedColumn._tq_key_label�s6���O�O�	���d�i�i�/��%�%�i�0�0��>�>�!ryc�8�|j|j�S)z�table qualified label based on column name.

        for table-bound columns this is <tablename>_<columnname>; all other
        expressions it resolves to .name.

        �rAr�r�s rvrxzNamedColumn._tq_label�s���!�!�$�)�)�,�,ryc��yr�rqr�s rvrz+NamedColumn._render_label_in_columns_clause�r�ryc��|jSrpr>r�s rvr�zNamedColumn._non_anon_label�r?ryc��|Srprq)r�r��
dedupe_on_keys   rvrAzNamedColumn._gen_tq_label�s	���ryc	�N�t|j|||j|d|��S)NT)r�r�rtrr�)r�r�r�r�s     rvr�zNamedColumn._bind_params.����H�H��"*�"�i�i����
�	
ry�r�r�r�r��disallow_is_literalc���t|r2tjtj|xs|j
�n|xs|j
|j|d��}
|j|
_|�|j|
_|rt|�|
_
n|g|
_
|j�4|jjj|
j�|
_|
j|
fS)NF�rtr�r�)r�rr}rr�r�r�r�r�r�rvr�r�r))r�r�rqrtr�r�r�r�rJr�r�s           rvr�zNamedColumn._make_proxys���
�'�� � ��!9�!9�4�;L�4�9�9�M��'�d�i�i��)�)�"��	
��(�8�8����<��H�H�A�E���2�3�A�J���A�J��"�"�.�'�4�4�<�<�@�@����G�A�N��u�u�a�x�ryr�rL�T�r�r�rGr(r�rMr)
r;rPr�rrtrr�r(r�r�r�rVrqrJrtrr�rMr�rMr�r(r�rrJr(r�rr�r)r�r�r�r�r;rWr�r=rVr�r,rpr{rxrr�rAr�r�rqryrvr9r9�s{���J�"&�E��&�

�I�	�H�
�

�������#�#�"�$�"��#�#�-�$�-��#�#��$���#�#��$��04����(,��	��+/��
��
��
�(�	
�
�
�
�

�.#�!�$)�GK�$)�"��"��	"�
3�"��
"��"�"�"�E�"�"�"��"�
-�"ryr9�_PSc�:�eZdZUdZdZdejfdejfdejfgZ	de
d<dejfdejfgZde
d<d	e
d<	d					dd�Zd�Z
ejd
��Zd d�Zej&d��Zejd��Zed��Zejd!d��Zdd"d�Zd�Z								d#d�Zed��Zed��Zedd�							d$d�Zej@d%d��Z!d
d
d�													d&d�Z"y
)'r�z�Represents a column label (AS).

    Represent a label, as typically applied to any column-level
    element using the ``AS`` sql keyword.

    r�r�r��_elementr\r2r
r�Nc�"�|}tjtj||��}t	|t
�r|j}t	|t
�r�|r||_nPtjt|�t|dd��|_t	|t
�r|j|_
|jx|_x|_|_||_|�t%j&|�n|j"j(|_|g|_y)Nr�r�r�)rr}rrr�r�rwr�r�r�rIr�r��_resolve_labelr�rxr{rRrrr�rv)r�r�rwrt�orig_elements     rvrGzLabel.__init__Ss������"�"��'�'��"&�
��
��%�(��o�o�G���%�(�
��D�I�(�7�7��4��'�'�6�6�:��D�I��,��.�'3�&9�&9��#�9=���B���B�4�>�D�$6���
�� �
� � ��'����#�#�	
�	�!�	��
ryc�`�|j|j|j|jffSrp)r�r�rRr�r�s rvrzLabel.__reduce__zs$���~�~��	�	�4�=�=�$�)�)�D�D�Dryc��yr�rqr�s rvrz%Label._render_label_in_columns_clause}r�ryFc	�:�td||||jd|��Sr�r�r�s     rvr�zLabel._bind_param�s(�����"*��"�i�i���
�	
ryc�.�|jjSrpr�r�s rvrzLabel._is_implicitly_boolean�r�ryc�.�|jjSrp)rwrr�s rvrzLabel._allow_label_resolve�s���|�|�0�0�0ryc��|Srprqr�s rvr�zLabel._order_by_label_element�r>ryc�V�|jjtj��Sr�)rRrr�as_r�s rvrwz
Label.element�s���}�}�'�'�	�
�
�'�>�>ryc�P�|j|jj|��Sr�)�_apply_to_innerrRrrs  rvrzLabel.self_group�s"���#�#�D�M�M�$<�$<�g�#�N�Nryc�L�|j|jj�Srp)r_rRr7r�s rvr7z
Label._negate�s���#�#�D�M�M�$9�$9�:�:ryc�v�||i|��}||jur"t|j||j��S|S�Nr�)rRr�r�r�)r��fnrr��sub_elements     rvr_zLabel._apply_to_inner�s9���#�n��n���d�m�m�+�����K�t�y�y�A�A��Kryc�.�|jjSrp)rwrqr�s rvrqzLabel.primary_key�s���|�|�'�'�'ryc�.�|jjSrp)rwrtr�s rvrtzLabel.foreign_keys�s���|�|�(�(�(ry)�clone�anonymize_labelsc�
�|j�||jfi|��|_|rYtjt	|�t|jdd��|_|jx|_x|_	|_
yy)Nr�r�)�_reset_memoizationsrRr�r�rIr�rwr�r�rxr{)r�rgrhr�s    rv�_copy_internalszLabel._copy_internals�sr��	
� � �"��d�m�m�2�r�2��
��(�7�7��4��'�$�,�,���?��D�I�>B�Y�Y�F�D�H�F�t�~��(:�	ryc�.�|jjSrpr�r�s rvr�zLabel._from_objects�r�ry)r�r�c	���|s|jn|}|jj||dt|t�|||��\}}||jk7r<t|jt
�s"t
jd|jz��|j|_|jj|�|j�|j|_|j|fS)NT)r�rJr�r�rqrtz�Label name %s is being renamed to an anonymous label due to disambiguation which is not supported right now.  Please use unique names for explicit labels.)
r�rwr�r��_truncated_labelr�r;�InvalidRequestErrorr�rvr�r�r�)	r�r�rqrtr�r�r�r��es	         rvr�zLabel._make_proxy�s���!%�t�y�y�$�����)�)��� $� *�4�1A� B�!5�#�%�*�
���Q�"�$�)�)��J�t�y�y�:J�$K��)�)�'�+/�)�)�5��
�(�8�8���	�
�
���$���9�9� ��Y�Y�A�F��x�x��{�ryrp)r�rMrwr�rtr`rr.)rrSr�r)rcz Callable[_PS, ColumnElement[_T]]rz_PS.argsr�z
_PS.kwargsr�r)rgr[rhr(r�rr�rrO)r�rVrqrJrtrr�rMr�rr�rr�r)#r�r�r�r�r�r7rbrcrQr2rWr�rGrr,rprr�r=rTrrrmr�rwrr7r_rqrtr&rkror�r�rqryrvr�r�;s4����N�
�"�/�/�0�	�"�*�*�+�	�&�7�7�8�3��/��
�"�/�/�0�	�&�7�7�8���
 ��

�I�48�	%"��%"�/�%"�1�	%"�NE��#�#��$��	
�
���3��3��#�#�1�$�1������#�#�?�$�?�O�;�
�,�
��
��	
�

�
��(��(��)��)�%+�!&�	
G�"�
G��	
G�
�
G�
�

G�
�"�"�*�#�*�#�GK�*��*��	*�
3�*��
*�E�*��*�
-�*ryr�c����eZdZUdZded<ded<dZdejfdejfdejfdejfgZd	ed
<dZded
<dZ
ded<dZded<dZded<dZed��Z			d 							d!d�Zdd�d�Ze�fd��Zd"�fd�	Zed#d��Zej4d��Zed��Zd�Z	d$					d%d�Zdddddd�																			d&d�Z�xZ S)'r�a�Represents a column expression from any textual string.

    The :class:`.ColumnClause`, a lightweight analogue to the
    :class:`_schema.Column` class, is typically invoked using the
    :func:`_expression.column` function, as in::

        from sqlalchemy import column

        id, name = column("id"), column("name")
        stmt = select(id, name).select_from("user")

    The above statement would produce SQL like:

    .. sourcecode:: sql

        SELECT id, name FROM user

    :class:`.ColumnClause` is the immediate superclass of the schema-specific
    :class:`_schema.Column` object.  While the :class:`_schema.Column`
    class has all the
    same capabilities as :class:`.ColumnClause`, the :class:`.ColumnClause`
    class is usable by itself in those cases where behavioral requirements
    are limited to simple SQL expression generation.  The object has none of
    the associations with schema-level metadata or with execution-time
    behavior that :class:`_schema.Column` does,
    so in that sense is a "lightweight"
    version of :class:`_schema.Column`.

    Full details on :class:`.ColumnClause` usage is at
    :func:`_expression.column`.

    .. seealso::

        :func:`_expression.column`

        :class:`_schema.Column`

    r:r;r(r�r�r�r�r\r2NzOptional[DefaultGenerator]�onupdater�zOptional[FetchedValue]�server_default�server_onupdateFc�<�|jxr|jdk(Sru)r�r�r�s rvrlzColumnClause._is_star7s�����3�4�9�9��#3�3ryc�p�|x|_|_||_tj|�|_||_yrp)r�r�r;rrr�r�)r�r�rtr�r�s     rvrGzColumnClause.__init__;s4�� $�#���4�9� ��
��(�(��/��	�$��ry)�
column_tablesc��gSrprq)r�rwr�s   rvr�zColumnClause.get_childrenKs	���	ryc�\��|j�|jjSt�|�Srp)r;r�r*)r�r�s �rvr�zColumnClause.entity_namespaceQs(����:�:�!��:�:�.�.�.��7�+�+ryc����|rc|j�W|jjrA|jd�}||jfi|��}|jj	|�}|St�|�di|��S)Nrgrq)r;�_is_subqueryr�r��corresponding_columnr*r&)r�rr�rgr;�newr�s      �rvr&zColumnClause._cloneXsh��� ��
�
�&��
�
�'�'��F�F�7�O�E��$�*�*�+��+�E��'�'�.�.�t�4�C��J��w�~�#��#�#ryc�(�|j}|�|gSgSrp�r;)r��ts  rvr�zColumnClause._from_objectses���J�J���=��3�J��Iryc��|jduSrprr�s rvrz,ColumnClause._render_label_in_columns_clausems���z�z��%�%ryc�<�|j|jd��S)NF)rGrCr�s rv�
_ddl_labelzColumnClause._ddl_labelqs���!�!�$�)�)�5�!�A�Aryc���|jsl|j�`|jjsJt|d�r>t	|t
�r~|js"|j�|jjrPt|d�xr|j|jk(xs't|d�xr|j|jk(S|jj|j�S)Nr�r�rx)
r�r;r_r6r�r�r�rxr�r�r�s  rvr�z%ColumnClause._compare_name_for_resultus����O�O��z�z�!��z�z�%�%��5�+�.��5�,�/��$�$��{�{�*��{�{�.�.��E�6�*�F�t�y�y�E�J�J�/F����{�+�6��N�N�e�o�o�5�
�
�?�?�/�/����?�?ryc�h�|j}|jry|���t|��r�t|�r?|jr3|jjdd�dz|jzdz|z}n*trt|t�sJ�|jdz|z}t|�r@|j�4t|�r|j|_ntt||j�}n]t|j�rH|jj�2t|t�rJ�t||jj�}|rG||jvr9|}d}||jvr%|dzt|�z}|dz
}||jvr�%|}tj t"j$|�S|S)z�generate table-qualified label

        for a table-bound column this is <tablename>_<columnname>.

        used primarily for LABEL_STYLE_TABLENAME_PLUS_COL
        as well as the .columns collection on a Join object.

        N�.r�r)r;r�r!r �schema�replacer�rr�rWr"rDr8r�r�rr}rr�)r�r�rGr�r�r��counters       rvrAzColumnClause._gen_tq_label�sm��
�J�J���?�?��
�]�3�A�6��q�!�a�h�h����(�(��c�2�S�8�1�6�6�A�C�G�$�N��(�J�q�/�,J�J�J������t�+���d�#��
�
�(>�!�%�(�"&�*�*�E�K�'��t�z�z�:�E�����'�A�F�F�L�L�,D�&�e�[�9�9�9�#�E�1�6�6�<�<�8����A�C�C�<�"�F��G� �A�C�C�-�!&���s�7�|�!;���1���!�A�C�C�-�#�E��#�#�E�$<�$<�e�D�D��KryrIc�.�|xr#|jxr|duxs||jk(}
|j|r2tjt
j|xs|j�n|xs|j|j||
��}|j|_|�|j|_	|rt|�|_n|g|_|j�4|jjj|j�|_|j|fS)NrL)r�r�r�rr}rr�r�r�r�r�rvr�r�r))r�r�rqrtr�r�r�r�rJr�r�r�s            rvr�zColumnClause._make_proxy�s��($�#�
����
�
���%��4�9�9�$�	�
���'�� � ��!9�!9�4�;L�4�9�9�M��'�d�i�i��)�)�"�!�
�	
��(�8�8����<��H�H�A�E���2�3�A�J���A�J��"�"�.�'�4�4�<�<�@�@����G�A�N��u�u�a�x�ry)NFN)r�r�rtr`r�r(r�r:rhrOrMrNrO)!r�r�r�r�rWr�r7rbrcrQrfr2rrr�rsrt�_is_multiparam_columnrmrlrGr�r�r&r>r�r,rprr�r�rAr�r/r�s@rvr�r��s����%�N �����N�
�"�/�/�0�	�"�*�*�+�	�#�4�4�5�	�(�3�3�4�	3��/��,0�H�(�/�*.�G�
'�.�-1�N�*�1�.2�O�+�2�!��
�4��4�48� �,0�%��%�1�%��	%�
*�%� -2���,��,�$�'��'���#�#�&�$�&��B��B�@�.04�6��6�(,�6�	�6�|#�!�$)�GK�$)�1��1��	1�
3�1��
1��1�"�1�E�1�"�1��1�
-�1ryr�c��eZdZUdZdej
fdejfdejfgZde	d<dd�Z
ef					dd�Ze
jd
d	��Zy
)�TableValuedColumn�table_valued_columnr�r��scalar_aliasr\r2c�P�||_|jx|_|_||_yrp)r�r�r�r�)r�r�rts   rvrGzTableValuedColumn.__init__s%��(���+�0�0�0���4�9���	ryc�x�||jfi|��|_|jjx|_|_yrp)r�r�r�)r�rgr�s   rvrkz!TableValuedColumn._copy_internalss6��"�$�"3�"3�:�r�:���#�0�0�5�5�5���4�9ryc��|jgSrp)r�r�s rvr�zTableValuedColumn._from_objectss���!�!�"�"ryN)r�rWrtr�)rgr[r�rr�rrO)r�r�r�r�r7rbrcrQr2rWrGr&rkr=ror�rqryrvr�r��s���*�N�
�"�/�/�0�	�"�*�*�+�	�*�;�;�<�3��/���+1�6�'�6�8;�6�	
�6�
�"�"�#�#�#ryr�c��eZdZUdZdej
fgZded<ee	jd�						dd���Zd�Zy)	rgrr\r2r1c�l�tjj}tjt
jt|�}|jj|jur|jj|�}n|j}t|t|�tj|��Srb)r=r�r3rr}rrr�r�r��String�_with_collationr�rgrr)r�r�rr6ro�collate_types      rv�_create_collation_expressionz,CollationClause._create_collation_expressions����>�>�.�.������ ;� ;�C� @�*�M���9�9�#�#�x���6��9�9�4�4�Y�?�L��9�9�L����I�&�����	
�	
ryc��||_yrp)rrs  rvrGzCollationClause.__init__-s	��"��ryN)r�z_ColumnExpressionArgument[str]rr�r�zBinaryExpression[str])
r�r�r�r�r7r�r2rWr�r=r�r�rGrqryrvrgrgso�� �N�
�'�1�1�2�3��/����T���2�3�
�7�
�DG�
�	�
�4��
�(#ryrgc��eZdZdZd�Zy)�_IdentifiedClause�
identifiedc��||_yrp)�ident)r�r�s  rvrGz_IdentifiedClause.__init__4s	����
ryN)r�r�r�r�rGrqryrvr�r�1s��!�N�ryr�c��eZdZdZdZy)�SavepointClause�	savepointFN�r�r�r�r�rSrqryrvr�r�8s�� �N��Mryr�c��eZdZdZdZy)�RollbackToSavepointClause�rollback_to_savepointFNr�rqryrvr�r�=s��,�N��Mryr�c��eZdZdZdZy)�ReleaseSavepointClause�release_savepointFNr�rqryrvr�r�Bs��(�N��Mryr�c���eZdZUdZdZded<eedd���Zeed
d���Ze						dd��Zd�fd�Z	d	�Z
d
�Zd�Z�xZ
S)r8a�Represent a SQL identifier combined with quoting preferences.

    :class:`.quoted_name` is a Python unicode/str subclass which
    represents a particular identifier name along with a
    ``quote`` flag.  This ``quote`` flag, when set to
    ``True`` or ``False``, overrides automatic quoting behavior
    for this identifier in order to either unconditionally quote
    or to not quote the name.  If left at its default of ``None``,
    quoting behavior is applied to the identifier on a per-backend basis
    based on an examination of the token itself.

    A :class:`.quoted_name` object with ``quote=True`` is also
    prevented from being modified in the case of a so-called
    "name normalize" option.  Certain database backends, such as
    Oracle Database, Firebird, and DB2 "normalize" case-insensitive names
    as uppercase.  The SQLAlchemy dialects for these backends
    convert from SQLAlchemy's lower-case-means-insensitive convention
    to the upper-case-means-insensitive conventions of those backends.
    The ``quote=True`` flag here will prevent this conversion from occurring
    to support an identifier that's quoted as all lower case against
    such a backend.

    The :class:`.quoted_name` object is normally created automatically
    when specifying the name for key schema constructs such as
    :class:`_schema.Table`, :class:`_schema.Column`, and others.
    The class can also be
    passed explicitly as the name to any function that receives a name which
    can be quoted.  Such as to use the :meth:`_engine.Engine.has_table`
    method with
    an unconditionally quoted name::

        from sqlalchemy import create_engine
        from sqlalchemy import inspect
        from sqlalchemy.sql import quoted_name

        engine = create_engine("oracle+oracledb://some_dsn")
        print(inspect(engine).has_table(quoted_name("some_table", True)))

    The above logic will run the "has table" logic against the Oracle Database
    backend, passing the name exactly as ``"some_table"`` without converting to
    upper case.

    .. versionchanged:: 1.2 The :class:`.quoted_name` construct is now
       importable from ``sqlalchemy.sql``, in addition to the previous
       location of ``sqlalchemy.sql.elements``.

    )rDrrrarDc��yrprq�r�rsrDs   rvr9zquoted_name.construct|s��JMryc��yrprqr�s   rvr9zquoted_name.construct�s��DGryc� �|�yt||�Srp)r8r�s   rvr9zquoted_name.construct�s���=���u�e�,�,ryc���|�Jd��t||�r|�|j|k(r|St�|�
||�}||_|S)Nz0use quoted_name.construct() for None passthrough)r�rDr*r�)r�rsrDr�r�s    �rvr�zquoted_name.__new__�sS�����	>�=�	>���e�S�!�u�}����u�8L��L��w��s�E�*����
��ryc�<�tt|�|jffSrp)r8r�rDr�s rvrzquoted_name.__reduce__�s���S��Y��
�
�3�3�3ryc�P�|jr|St|�j�Srp)rDr�rr�s rv�_memoized_method_lowerz"quoted_name._memoized_method_lower�����:�:��K��t�9�?�?�$�$ryc�P�|jr|St|�j�Srp)rDr�rr�s rv�_memoized_method_upperz"quoted_name._memoized_method_upper�r�ry)rsr�rDrar�r8)rsrrDrar�r)rsrMrDrar�zOptional[quoted_name])r�r�r�r�r�rWrr�r9r�rr�r�r/r�s@rvr8r8Gs����.�`*�I���
��M���M�
��G���G��-�!�-�*8�-�	�-��-�	�4�%�%ryr8c�L�t�}t|id|ji�|S)z2locate Column objects within the given expression.r�)�setr8r�)r�r�s  rv�
_find_columnsr��s%��$'�5�D��V�R�(�D�H�H�-�.��Kryr�c�x�|D]&}|jjr�|jcStjSrp)r�r5rr�)�args�as  rv�_type_from_argsr��s.��
���v�v�~�~��6�6�M��� � � ryc
��|j||��}|�4tjd|�dt|dd��d|j�d���|S)N)�require_embeddedzGiven column 'z', attached to table 'r;z7', failed to locate a corresponding column from table '�')r|r;ror�r�)�
fromclauser�r�r�s    rv�_corresponding_column_or_errorr��s\���'�'��!1�	(�	�A�	�y��%�%��w�v�w��5�z�7M�7M�
O�
�	
�

�Hryc��eZdZdZd�Zy)�#_memoized_property_but_not_nulltypez,memoized property, but dont memoize NullTypec�z�|�|S|j|�}|js||j|j<|Srp)�fgetr5r�r�)r�r�r��results    rv�__get__z+_memoized_property_but_not_nulltype.__get__�s7���;��K����3����~�~�*0�C�L�L����'��
ryN)r�r�r�r�r�rqryrvr�r��s��7�ryr�c���eZdZUded<d�Z�fd�Zejd��Ze	d��Z
ejd��Zejd��Zejdd	��Z
ejdd
��Z�xZS)
�AnnotatedColumnElementr\�_Annotated__elementc��tj|||�dD]}|jj|d�� dD]:}|jj	|d��� |jj|��<y)N)r�rzr{rxr�r�)r�r�r;F)r$rGr�r�r))r�rwr�r�s    rvrGzAnnotatedColumnElement.__init__�sk�����4��&�1�
�D�
�M�M���d�D�)�
�-�D��}�}� � ��u�-�5��
�
�!�!�$�'�-ryc�l��t�|�|�}dD]}|jj|d�� |S)N)r�rzr{rxr�)r*�_with_annotationsr�r�)r�r�rgr�r�s    �rvr�z(AnnotatedColumnElement._with_annotations�s;�����)�&�1��
�D�
�N�N���t�T�*�
��ryc�.�|jjS)z'pull 'name' from parent, if not present)r�r�r�s rvr�zAnnotatedColumnElement.name�s���'�'�,�,�,ryc�.�|jjS)a�pull 'type' from parent and don't cache if null.

        type is routinely changed on existing columns within the
        mapped_column() initialization process, and "type" is also consulted
        during the creation of SQL expressions.  Therefore it can change after
        it was already retrieved.  At the same time we don't want annotated
        objects having overhead when expressions are produced, so continue
        to memoize, but only when we have a non-null type.

        )r�r�r�s rvr�zAnnotatedColumnElement.type�s���'�'�,�,�,ryc�.�|jjS)z(pull 'table' from parent, if not present)r�r;r�s rvr;zAnnotatedColumnElement.tables���'�'�-�-�-ryc�.�|jjS)z&pull 'key' from parent, if not present)r�r�r�s rvr�zAnnotatedColumnElement.key	s���'�'�+�+�+ryc�r�trt|jt�sJ�|jjSrp)rr�r�rQ�infor�s rvr�zAnnotatedColumnElement.infos-����d�6�6��?�?�?��'�'�,�,�,ryc�.�|jjSrp)r�r�r�s rvr�z'AnnotatedColumnElement._anon_name_labels���'�'�8�8�8ry)r�rGr�)r�r�r�rWrGr�r=rTr�r�r�r;r�r�r�r/r�s@rvr�r��s����+�+�
(�
�
���-��-�)�-�)�-�
���.��.�
���,��,�
���-��-�

���9��9ryr�c�:��eZdZdZdZdd�fd�
Zdd�Zd	d�Z�xZS)
rnzVA unicode subclass used to identify symbolic "
    "names that may require truncation.rqc�@��t|d|�}t�|�	|||�S)NrD)r�r*r�)r�rsrDr�s   �rvr�z_truncated_label.__new__s$�����w��.���w��s�E�5�1�1ryc�H�|jt|�|jffSrp)r�r�rDr�s rvrz_truncated_label.__reduce__$s���~�~��D�	�4�:�:�6�6�6ryc��|Srprq�r��map_s  rv�	apply_mapz_truncated_label.apply_map'r�ryrp)rsr�rDrar�rr
)r�rPr�r�)	r�r�r�r�r�r�rr�r/r�s@rvrnrns���+��I�2�
7�ryrnc��eZdZdZdZy)�convaMark a string indicating that a name has already been converted
    by a naming convention.

    This is a string subclass that indicates a name that should not be
    subject to any further naming conventions.

    E.g. when we create a :class:`.Constraint` using a naming convention
    as follows::

        m = MetaData(
            naming_convention={"ck": "ck_%(table_name)s_%(constraint_name)s"}
        )
        t = Table(
            "t", m, Column("x", Integer), CheckConstraint("x > 5", name="x5")
        )

    The name of the above constraint will be rendered as ``"ck_t_x5"``.
    That is, the existing name ``x5`` is used in the naming convention as the
    ``constraint_name`` token.

    In some situations, such as in migration scripts, we may be rendering
    the above :class:`.CheckConstraint` with a name that's already been
    converted.  In order to make sure the name isn't double-modified, the
    new name is applied using the :func:`_schema.conv` marker.  We can
    use this explicitly as follows::


        m = MetaData(
            naming_convention={"ck": "ck_%(table_name)s_%(constraint_name)s"}
        )
        t = Table(
            "t",
            m,
            Column("x", Integer),
            CheckConstraint("x > 5", name=conv("ck_t_x5")),
        )

    Where above, the :func:`_schema.conv` marker indicates that the constraint
    name here is final, and the name will render as ``"ck_t_x5"`` and not
    ``"ck_t_ck_t_x5"``

    .. seealso::

        :ref:`constraint_naming_conventions`

    rqNrnrqryrvr�r�+s��-�^�Iryr�c�P�eZdZdZdZe		d									d	d��Zd�Zd�Zd�Z	y)
r�zDA unicode subclass used to identify anonymously
    generated names.rqNc��tjdd|�}|r|jd�}d||jdd�fz}|r|�|��}t	|�S)Nz[%\(\) \$]+r�z
%%(%d %s)s�%�%%)r�r}�stripr�r�)r�r��bodyr�r7r�s      rvr�z_anonymous_label.safe_constructksX���v�v�n�c�4�0����:�:�c�?�D���d�l�l�3��&=�>�>���-�u�5�E���&�&ryc���d|vr,t|t�st|�jdd�}nt|�}tt	tj||�|j��S�Nr�r��r�r�r�r�r8r#rDr�s  rvr#z_anonymous_label.__add__�s\���%�<�
�5�2B� C���J�&�&�s�D�1�E���J�E������D�%�(��
�
�
�
�	
ryc���d|vr,t|t�st|�jdd�}nt|�}tt	tj||�|j��Sr�r�r�s  rvr*z_anonymous_label.__radd__�s\���%�<�
�5�2B� C���J�&�&�s�D�1�E���J�E������E�4�(��
�
�
�
�	
ryc�V�|j�t||z|j�S||zSrp)rDr8r�s  rvr�z_anonymous_label.apply_map�s-���:�:�!��t�d�{�D�J�J�7�7��$�;�ryr)
r�r]r�r�r�rMr7r(r�r�)
r�r�r�r�r�r�r�r#r*r�rqryrvr�r�esg����I��
*.�"�'��'��'�'�	'�
�'�
�
'��'�*
�
�ryr�rh)rsrrtr^rur(r�rr)rsrfrtrrur(r�r)rsrrtr`rur(r�rrp)r�r�rtr`r�zColumnClause[_T])r�r�r�zSet[ColumnClause[Any]])r�zSequence[ColumnElement[_T]]r�r�)�r��
__future__r�decimalr�enumrr�r;r�rnrrrr	r
rrr
rrrrrrrr�typing_Tuplerrrrr�rrrrr�_typingr r!r"r#�
annotationr$r%�baser&r'r(r)r*r+r,r-r.r/r$r0r1r2r3r4�visitorsr5r6r7r8r9r;r<r=r>r?�util.typingr@rArBrCrDrErFrGrHrIrJrKrL�compilerrMrN�	functionsrOrPr�rQrRrSrTr�rUrVrWrXr6rYrZr[r\r]�enginer^r_�engine.interfacesr`rarbrcrd�
engine.resultre�floatrlr]rnrfrhrjrkrmrwr�r��_self_inspectsr�rr�
DMLColumnRole�DDLConstraintColumnRole�ColumnsClauseRolervryrrm�_SQO�ColumnArgumentOrKeyRole�StatementOptionRoler��BinaryElementRole�OrderByRole�LimitOffsetRole�DDLExpressionRoler>rr �
InElementRoler�rh�FromClauseRole�SelectStatementRole�Inspectablerl�
ConstExprRoler��_create_singletonr(r�r�r�r�r�rar�r�rAr�r`rcrmrur~r?r�r�r�r�r�r�r�r�r�r�r��_IntOrRanger�rr r9rPr�r��DDLReferredColumnRole�StrAsPlainColumnRoler�r�r�rgr�r�r�r��
MemoizedSlotsr8r�r�r�rTr�r�rnr��_generated_labelr�rqryrv�<module>r
s����
#�����	�
����������������(�� ��������$�)�#�"�!�3�� ��������#�*��.�&�(�%�+�'������4��!�#��	���$�2�<�$�"�,�,��1�#�"�%�*�'��(�$�"�+�&�+�)�#�$�,�0�"�#� �;�.�5�?�:�&����� ��
��s�G�#�
$���T������s�d�3���v�U�#��
�e�:�&���v�Y�'��
�"����"�����	�
��
��!��
�������	�
��
�15�!����-�����	�
��15�!�"��"�-�"��"��	"�L;?�#<�

�#<�7�#<��#<�L]#�i�]#�@���y������y��y�x
�-��.%�	���	�!�!�	����	%�*xG������xG�v��e��e�9�9�%�@�*��(��r	5�	�!�!�	���	���	���B��	���	���	���	���	�!�!�	�������r	5�j
��r�*�
�?"�M�"�-�?"�D[
�E�'�'�);�B�)?�[
�|�$��"A�	�!�!�	���	���	���	���	���	���	������	���C� ����<�(�A�H��e�1�1�$�7��t�9L��4����!��u�*�*�4�0�-��2E�!�8����! ��u�2�2�4�8�-��:M�! �H����i�	���	���	���	����i�XU
��r�*�U
�p\
�-�b�1�\
�~M7�,�T�2�M7�`��������J�J�
�l�3��8�&<�=�J�Z^
�=���^
�B9� ��$�9�x
�d�2�h�
� =�&�r�*�=�@'�m�C� �'�.�}�R�(��:(�}�S�1�(�R�m�B�'�R�j=
�/�"�-�=
�@G�%�d�+�_�T�-B�G�4V/�)�"�-�V/�r'�M�#��'�T�&�s�+��'�(�'�=�~�}�R�0�=�@0�X�b�\�0�f���
�,�,���(�(�
��C��O�$��D
�=���D
�Ng
�-��#�g
�TJ
�Z��r�!2�J
�Zh�$�R�(�h�V����x�E�'�'��+�[��_�x�v~�	���	����#�	���
���O�~�B#��B��#�2#�m�C�(�#�B�
�M���'��
� 1��
�.��
^%�$�$�$�c�^%�B�!�

�����+�,��C9�Y�C9�L�{��$0��0�n$��<�'�<ry

ZeroDay Forums Mini