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__/base.cpython-312.pyc
�

���g� ����dZddlmZddlZddlmZddlZddlmZddlZddl	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
mZddl
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,d&d'l!m-Z-d&d(l!m.Z.d&d)l!m/Z/d&d*l/m0Z0d&d+l/m1Z1d&d,l/m
Z2d&d-l3m4Z4d&d.l3m5Z5d&d/l3m6Z6er�dd0l!m7Z7dd1l!m8Z8dd2l!m9Z9dd3l:m;Z;dd4l:m<Z<dd5l=m>Z>dd6l?m@Z@dd7l8mAZAdd8l8mBZBdd9l8mCZCdd:l8mDZDdd;l8mEZEdd<l8mFZFdd=l8mGZGdd>lHmIZIdd?lHmJZJdd@lKmLZLddAlKmMZMddBlKmNZNd&dClOmPZPd&dDlOmQZQd&dElRmSZSd&dFlRmTZTd&dGlRmUZUd&dHlRmVZVd&dIlRmWZWd&dJlRmXZXd&dKlRmYZYd&dLlRmZZZd&dMlRm[Z[d&dNlRm\Z\d&dOl-m]Z]esdZ7dZ8dZ9GdP�dQe�Z^e^j�Z_GdR�dSe�Z`e`j�ZbedTe�U�ZcedVedWef�U�ZdeeeeefZfGdX�dYe�Zgej�dZ�ZiGd[�d\e4�ZjGd]�d^e4�Zkd�d_�Zled`e�U�ZmGda�db�ZnGdc�dden�Zo				d�de�Zp				d�df�Zqedgdh�U�ZrGdi�dhe2jh�Zsd�dj�Ztd�dk�Zudl�Zv				d�dm�Zw				d�dn�Zxd�do�Zyd�dp�ZzGdq�dreeeef�Z{Gds�dteeeef�Z|e/j�du�dv��Z~Gdw�dx�ZGdy�dz�Z�Gd{�d|e0�Z�Gd}�d~e0�Z�Gd�d�e��Z�Gd��d�e��Z�Gd��d�e����Z�Gd��d�e�e%�Z�Gd��d�e(�Z�Gd��d�e"�j�Z�Gd��d�e-�j�Z�Gd��d�e)�Z�Gd��d�e�Z�Gd��d�e�Z�ed�e deefee�Z�ed�d�d����Z�ed�d��U�Z�Gd��d�ee��Z�Gd��d�ee�e�f�Z�ed�d��U�Z�Gd��d�e�eee�f�Z�Gd��d�e/�j.e�e�e�f�Z�Gd��d�e/�j2d��Z�				d�d��Z�e_f							d�d��Z�y)�z4Foundational utilities common to many sql modules.

�)�annotationsN)�Enum��zip_longest)�Any)�Callable)�cast)�Dict)�	FrozenSet)�Generic)�Iterable)�Iterator)�List)�Mapping)�MutableMapping)�
NamedTuple)�NoReturn)�Optional)�overload)�Sequence)�Set)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union�)�roles)�visitors)�HasCacheKey)�MemoizedHasCacheKey)�HasCopyInternals)�
ClauseVisitor)�ExtendedInternalTraversal)�ExternallyTraversible)�InternalTraversal�)�event)�exc)�util)�HasMemoized)�hybridmethod)�typing)�Protocol)�Self)�	TypeGuard)�	coercions)�elements)�type_api)�DMLStrategyArgument)�SynchronizeSessionArgument)�_CLE)�SQLCompiler)�
BindParameter)�
ClauseList)�ColumnClause)�
ColumnElement)�NamedColumn)�SQLCoreOperations)�
TextClause)�Column)�DefaultGenerator)�_JoinTargetElement)�_SelectIterable)�
FromClause)�
Connection)�CursorResult)�_CoreMultiExecuteParams)�_ExecuteOptions)�_ImmutableExecuteOptions)�
CacheStats)�Compiled)�CompiledCacheType)�CoreExecuteOptionsParameter)�Dialect)�IsolationLevel)�SchemaTranslateMapType)�
dispatcherc��eZdZdZd�Zy)�_NoArgrc� �d|j��S)Nz_NoArg.)�name��selfs �D/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/base.py�__repr__z_NoArg.__repr__ks�������$�$�N)�__name__�
__module__�__qualname__�NO_ARGrX�rYrWrRrRhs��
�F�%rYrRc��eZdZdZy)�	_NoneNamerN)rZr[r\�	NONE_NAMEr^rYrWr`r`rs
���I�HrYr`�_T)�bound�_Fn.c�P�eZdZUded<ded<ded<ded<e				d	d��Zy)
�_DefaultDescriptionTupler�argzOptional[bool]�	is_scalar�is_callable�is_sentinelc���|rZ|js|jsB|jr6t|j|j
|j|j�Stdddd�S�N)�has_arg�
for_updaterjrfrgrhri)�cls�defaults  rW�_from_column_defaultz-_DefaultDescriptionTuple._from_column_default�se�������*�*�w�/B�/B�
%�����!�!��#�#��#�#�	
�
	
�*�$��d�D�A�
	
rYN)rpzOptional[DefaultGenerator]�returnrf)rZr[r\�__annotations__�classmethodrqr^rYrWrfrf�s;��	�H��������
�0�
�	!�
��
rYrf�_omit_from_statementsc��eZdZdd�Zy)�_EntityNamespacec��yrlr^�rV�keys  rW�__getattr__z_EntityNamespace.__getattr__�s��srYN)rz�strrr�SQLCoreOperations[Any])rZr[r\r{r^rYrWrwrw�s��BrYrwc�2�eZdZejdd��Zy)�_HasEntityNamespacec��yrlr^rUs rW�entity_namespacez$_HasEntityNamespace.entity_namespace�s��47rYN)rrrw)rZr[r\r*�ro_non_memoized_propertyr�r^rYrWrr�s��	�"�"�7�#�7rYrc��t|d�S)Nr�)�hasattr)�elements rW�_is_has_entity_namespacer��s���7�.�/�/rY�_Selfc�D�eZdZdZdZdZd�Zd�Zd
d�Zdd�					dd�Z	y	)�	Immutablea%mark a ClauseElement as 'immutable' when expressions are cloned.

    "immutable" objects refers to the "mutability" of an object in the
    context of SQL DQL and DML generation.   Such as, in DQL, one can
    compose a SELECT or subquery of varied forms, but one cannot modify
    the structure of a specific table or column within DQL.
    :class:`.Immutable` is mostly intended to follow this concept, and as
    such the primary "immutable" objects are :class:`.ColumnClause`,
    :class:`.Column`, :class:`.TableClause`, :class:`.Table`.

    r^Tc��td���Nz(Immutable objects do not support copying��NotImplementedError�rV�optionaldict�kwargss   rW�
unique_paramszImmutable.unique_params����!�"L�M�MrYc��td��r�r�r�s   rW�paramszImmutable.params�r�rYc��|Srlr^�rV�kws  rW�_clonezImmutable._clone�s���rY)�
omit_attrsc��yrlr^)rVr�r�s   rW�_copy_internalszImmutable._copy_internals�s��	
rYN)rVr�r�rrrr�)r�z
Iterable[str]r�rrr�None)
rZr[r\�__doc__�	__slots__�
_is_immutabler�r�r�r�r^rYrWr�r��sF��
��I��M�N�N��.0�
�*�
�7:�
�	
�
rYr�c�^�eZdZUdZdZded<dd�Zejd	d��Z	e
d��Zy)
�SingletonConstantz.Represent SQL constants like NULL, TRUE, FALSET�
_singletonc�6�tt|j�Srl)r	rbr�)rorgr�s   rW�__new__zSingletonConstant.__new__�s���B����'�'rYc��t��rlr�rUs rW�	proxy_setzSingletonConstant.proxy_set����!�#�#rYc�~�tj|�}|j�t|g�|_||_yrl)�objectr��__init__�	frozensetr�r�)ro�objs  rW�_create_singletonz#SingletonConstant._create_singleton�s0���n�n�S�!������"�3�%�(��
���rYN)rorbrgrr�rrrrb)rrzFrozenSet[ColumnElement[Any]])rZr[r\r��_is_singleton_constantrsr�r*�non_memoized_propertyr�rtr�r^rYrWr�r��sD��8�!��!�!�(�
���$� �$����rYr�c�z�tjj|D�cgc]}|j��c}�Scc}wrl)�	itertools�chain�
from_iterable�
_from_objects)r2r�s  rWr�r��s6��
�?�?�(�(�.6�7�h�7��	�	�h�7����7��8c�z�tjj|D�cgc]}|j��c}�Scc}w)zXexpand tables into individual columns in the
    given list of column expressions.

    )r�r�r��_select_iterable)r2�cs  rW�_select_iterablesr��s6���?�?�(�(�%-�.�X���	�	�X�.����.r��_SelfGenerativeType�_GenerativeTypec��eZdZdd�Zy)r�c��yrlr^rUs rW�	_generatez_GenerativeType._generates��rYN�rrr/)rZr[r\r�r^rYrWr�r�s��$rYc�f�tj										dd��}||�}||_|S)z�non-caching _generative() decorator.

    This is basically the legacy decorator that copies the object and
    runs a method on the new copy.

    c�T�|j�}||g|��i|��}||usJd��|S)zMark a method as generative.z#generative methods must return self)r�)�fnrV�argsr��xs     rW�_generativez _generative.<locals>._generatives;���~�~����t�!�d�!�b�!���D�y�?�?�?�y��rY)
r�rdrVr�r�rr�rrrr�)r*�	decorator�non_generative)r�r��	decorateds   rWr�r�	s[��
�^�^����*��36��>A��	�����B��I�!�I���rYc	����|jdi��|jdi�}|D�cgc]*}|tj|�|j|d�f��,c}�tj
��fd��}|Scc}w)N�msgs�defaultsc	����|d}|dd}�D]R\}}}||�|us��	j|d|j�d|j�d��}tj|��||g|��i|��S)NrrzMethod z$() has already been invoked on this z
 construct)�getrZ�	__class__r)�InvalidRequestError)
r�r�r�rVrT�getter�default_�msg�gettersr�s
        ��rW�checkz!_exclusive_against.<locals>.check+s�����A�w���A�B�x��&-�"�D�&�(��d�|�8�+��h�h���{�{�D�N�N�4���
�-�-�c�2�2�'.��$�$��$��$�$rY)�pop�operator�
attrgetterr�r*r�)�namesr�r�rTr�r�r�s     @@rW�_exclusive_againstr�!s����
�6�6�&�"��D��v�v�j�"�%�H����D�
�x�"�"�4�(�(�,�,�t�T�*B�C���G�

�^�^�
%��
%��L��+s�/A8c�&�|jdi|��S�Nr^)r�)r�r�s  rWr�r�>s���7�>�>��B��rYc�`�tj|D�cgc]}|j��c}�Scc}w)z\expand the given set of ClauseElements to be the set of all 'cloned'
    predecessors.

    )r�r��_cloned_set�r2r�s  rW�_expand_clonedr�Bs)���?�?�H�=�H�q�Q�]�]�H�=�>�>��=s�+c#�lK�|D]+}|j�|j}|j��|���-y�wrl)�_is_clone_ofr�s  rW�	_de_cloner�Ms6�������n�n�(����A��n�n�(����s�*4�4c��tt|��jt|��}|D�chc] }|j|j�s�|��"c}Scc}w)z�return the intersection of sets a and b, counting
    any overlap between 'cloned' predecessors.

    The returned set is in terms of the entities present within 'a'.

    ��setr��intersectionr���a�b�all_overlap�elems    rW�_cloned_intersectionr�VsN���n�Q�'�(�5�5�n�Q�6G�H�K��M�Q�T�+�":�":�4�;K�;K�"L�D�Q�M�M��M�� A�Ac��tt|��jt|��}|D�chc] }|j|j�r�|��"c}Scc}wrlr�r�s    rW�_cloned_differencer�asU���n�Q�'�(�5�5�n�Q�6G�H�K�����+�":�":�4�;K�;K�"L������r�c�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�_DialectArgViewzaA dictionary view of dialect-level arguments in the form
    <dialectname>_<argument_name>.

    c��||_yrl)r�)rVr�s  rWr�z_DialectArgView.__init__ns	����rYc�p�	|jdd�\}}||fS#t$r}t|�|�d}~wwxYw)N�_r)�split�
ValueError�KeyError)rVrz�dialect�	value_key�errs     rW�_keyz_DialectArgView._keyqsG��	&�!$���3��!2��G�Y��I�%�%���	)��3�-�S�(��	)�s��	5�0�5c��|j|�\}}	|jj|}||S#tj$r}t|�|�d}~wwxYwrl)r�r��dialect_optionsr)�NoSuchModuleErrorr�)rVrzr�r��optr�s      rW�__getitem__z_DialectArgView.__getitem__ys]��!�Y�Y�s�^����	"��(�(�*�*�7�3�C��y�>�!���$�$�	)��3�-�S�(��	)�s�4�A�A�Ac��	|j|�\}}||jj||<y#t$r}t	j
d�|�d}~wwxYw)Nz0Keys must be of the form <dialectname>_<argname>)r�r�r�r�r)�
ArgumentError)rVrz�valuer�r�r�s      rW�__setitem__z_DialectArgView.__setitem__�sa��	A�!%���3���G�Y�<A�D�H�H�$�$�W�-�i�8���	��#�#�B���
��	�s�3�	A�A�Ac�`�|j|�\}}|jj||=yrl)r�r�r�)rVrzr�r�s    rW�__delitem__z_DialectArgView.__delitem__�s+��!�Y�Y�s�^�����H�H�$�$�W�-�i�8rYc�j�td�|jjj�D��S)Nc3�FK�|]}t|j����y�wrl)�len�
_non_defaults)�.0r�s  rW�	<genexpr>z*_DialectArgView.__len__.<locals>.<genexpr>�s#����
�9��
��"�"�#�9�s�!)�sumr�r��valuesrUs rW�__len__z_DialectArgView.__len__�s/���
����0�0�7�7�9�
�
�	
rYc�B���fd��jjD�S)Nc3�|�K�|]3}�jj|jD]}|�d|�����
�5y�w)r�N)r�r�r
)r�dialect_name�
value_namerVs   �rWrz+_DialectArgView.__iter__.<locals>.<genexpr>�sI�����
� 8��"�h�h�6�6����m��
�$�Z�0��
1� 8�s�9<)r�r�rUs`rW�__iter__z_DialectArgView.__iter__�s���
� $��� 8� 8�
�	
rYN)rZr[r\r�r�r�rrrrrr^rYrWr�r�hs+���
�&�"�A�9�
�
rYr�c�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�_DialectArgDictz�A dictionary view of dialect-level arguments for a specific
    dialect.

    Maintains a separate collection of user-specified arguments
    and dialect-specified default arguments.

    c� �i|_i|_yrl�r
�	_defaultsrUs rWr�z_DialectArgDict.__init__�s�������rYc�p�tt|j�j|j��Srl)r	r�r
�unionrrUs rWrz_DialectArgDict.__len__�s'���3�t�)�)�*�0�0����@�A�ArYc�p�tt|j�j|j��Srl)�iterr�r
rrrUs rWrz_DialectArgDict.__iter__�s'���C��*�*�+�1�1�$�.�.�A�B�BrYc�Z�||jvr|j|S|j|Srlrrys  rWrz_DialectArgDict.__getitem__�s0���$�$�$�$��%�%�c�*�*��>�>�#�&�&rYc�"�||j|<yrl�r
�rVrzrs   rWrz_DialectArgDict.__setitem__�s��"'����3�rYc��|j|=yrlr rys  rWrz_DialectArgDict.__delitem__�s�����s�#rYN)
rZr[r\r�r�rrrrrr^rYrWrr�s'����B�C�'�(�$rYrzsqlalchemy.dialectsc��tjjjj	|�}|j
�yt
|j
�Srl)r*�	preloaded�dialects�registry�load�construct_arguments�dict)r�dialect_clss  rW�_kw_reg_for_dialectr+�sB���.�.�)�)�2�2�7�7��E�K��&�&�.����/�/�0�0rYc���eZdZdZdZdejfgZed��Z	e
jd��Ze
d��Ze
je�Zd�Ze
jd��Zdd	�Zy
)�
DialectKWArgsa9Establish the ability for a class to have dialect-specific arguments
    with defaults and constructor validation.

    The :class:`.DialectKWArgs` interacts with the
    :attr:`.DefaultDialect.construct_arguments` present on a dialect.

    .. seealso::

        :attr:`.DefaultDialect.construct_arguments`

    r^r�c��tj|}|�tjd|z��||vri||<||||<y)a_Add a new kind of dialect-specific keyword argument for this class.

        E.g.::

            Index.argument_for("mydialect", "length", None)

            some_index = Index("a", "b", mydialect_length=5)

        The :meth:`.DialectKWArgs.argument_for` method is a per-argument
        way adding extra arguments to the
        :attr:`.DefaultDialect.construct_arguments` dictionary. This
        dictionary provides a list of argument names accepted by various
        schema-level constructs on behalf of a dialect.

        New dialects should typically specify this dictionary all at once as a
        data member of the dialect class.  The use case for ad-hoc addition of
        argument names is typically for end-user code that is also using
        a custom compilation scheme which consumes the additional arguments.

        :param dialect_name: name of a dialect.  The dialect must be
         locatable, else a :class:`.NoSuchModuleError` is raised.   The
         dialect must also include an existing
         :attr:`.DefaultDialect.construct_arguments` collection, indicating
         that it participates in the keyword-argument validation and default
         system, else :class:`.ArgumentError` is raised.  If the dialect does
         not include this collection, then any keyword argument can be
         specified on behalf of this dialect already.  All dialects packaged
         within SQLAlchemy include this collection, however for third party
         dialects, support may vary.

        :param argument_name: name of the parameter.

        :param default: default value of the parameter.

        NzRDialect '%s' does have keyword-argument validation and defaults enabled configured)r-�_kw_registryr)r)ror�
argument_namerp�construct_arg_dictionarys     rW�argument_forzDialectKWArgs.argument_for�sc��L$1�#=�#=�l�#K� �#�+��#�#�=�?K�L��
��.�.�,.�$�S�)�7>� ��%�m�4rYc��t|�S)a�A collection of keyword arguments specified as dialect-specific
        options to this construct.

        The arguments are present here in their original ``<dialect>_<kwarg>``
        format.  Only arguments that were actually passed are included;
        unlike the :attr:`.DialectKWArgs.dialect_options` collection, which
        contains all options known by this dialect including defaults.

        The collection is also writable; keys are accepted of the
        form ``<dialect>_<kwarg>`` where the value will be assembled
        into the list of options.

        .. seealso::

            :attr:`.DialectKWArgs.dialect_options` - nested dictionary form

        )r�rUs rW�dialect_kwargszDialectKWArgs.dialect_kwargss��&�t�$�$rYc��|jS)z4A synonym for :attr:`.DialectKWArgs.dialect_kwargs`.)r4rUs rWr�zDialectKWArgs.kwargs!s���"�"�"rYc��tj|}t�}|�|jj	ddi�|St|jj�D]%}||vs�|jj	||��'|S)N�*)r-r/rr�update�reversedr��__mro__)rVrr1�dros     rW�_kw_reg_for_dialect_clsz%DialectKWArgs._kw_reg_for_dialect_cls(s���#0�#=�#=�l�#K� ����#�+�
�K�K����T�{�+�
�� ���� 6� 6�7���2�2��K�K�&�&�'?��'D�E�8��rYc�f�tjtj|j��S)a�A collection of keyword arguments specified as dialect-specific
        options to this construct.

        This is a two-level nested registry, keyed to ``<dialect_name>``
        and ``<argument_name>``.  For example, the ``postgresql_where``
        argument would be locatable as::

            arg = my_object.dialect_options["postgresql"]["where"]

        .. versionadded:: 0.9.2

        .. seealso::

            :attr:`.DialectKWArgs.dialect_kwargs` - flat dictionary form

        )r*�PopulateDict�portable_instancemethodr<rUs rWr�zDialectKWArgs.dialect_options4s+��&� � ��(�(��)E�)E�F�
�	
rYc	��|sy|D]�}tjd|�}|std|z��|jdd�\}}	|j|}d|vr,||vr(tjd|�d|�d|j����||||<��y#t
j$rgtjd	|�d
|���t�x|j|<}|jjddi�|||j|<Y��wxYw)Nz^(.+?)_(.+)$zGAdditional arguments should be named <dialectname>_<argument>, got '%s'rr'r7z	Argument z is not accepted by dialect z on behalf of zCan't validate argument z,; can't locate any SQLAlchemy dialect named )�re�match�	TypeError�groupr�r)rr�r�r*�warnrrr8r
)rVr��k�mr�arg_namer1r;s        rW�_validate_dialect_kwargsz&DialectKWArgs._validate_dialect_kwargsKs,�����A������+�A���?�AB�C���&'�W�W�Q��]�"�L�(�
C�+/�+?�+?��+M�(��7�7� �(@�@��+�+��l�D�N�N�<���:@���,�X�6�?���(�(�
6��	�	��,�(��
:I�9J�J��$�$�\�2�Q����"�"�C��;�/�,2�1�I�����)�
6�s�B�A6D	�D	N)r��Dict[str, Any]rrr�)rZr[r\r�r�r&�dp_dialect_options�"_dialect_kwargs_traverse_internalsrtr2r*�memoized_propertyr4�propertyr�r>r+r/r<r�rIr^rYrWr-r-�s���
��I�
�-�@�@�A�*�&��-?��-?�^
���%��%�(�#��#�%�4�$�$�%8�9�L�
�
���
��
�,%CrYr-c��eZdZUdZdZiZded<ded<e								d
d��Zd�Z	e				dd	��Z
e						dd
��Ze						dd��Zy)�CompileStateaProduces additional object state necessary for a statement to be
    compiled.

    the :class:`.CompileState` class is at the base of classes that assemble
    state for a particular statement object that is then used by the
    compiler.   This process is essentially an extension of the process that
    the SQLCompiler.visit_XYZ() method takes, however there is an emphasis
    on converting raw user intent into more organized structures rather than
    producing string output.   The top-level :class:`.CompileState` for the
    statement being executed is also accessible when the execution context
    works with invoking the statement and collecting results.

    The production of :class:`.CompileState` is specific to the compiler,  such
    as within the :meth:`.SQLCompiler.visit_insert`,
    :meth:`.SQLCompiler.visit_select` etc. methods.  These methods are also
    responsible for associating the :class:`.CompileState` with the
    :class:`.SQLCompiler` itself, if the statement is the "toplevel" statement,
    i.e. the outermost SQL statement that's actually being executed.
    There can be other :class:`.CompileState` objects that are not the
    toplevel, such as when a SELECT subquery or CTE-nested
    INSERT/UPDATE/DELETE is generated.

    .. versionadded:: 1.4

    )�	statement�_ambiguous_table_name_mapz)Dict[Tuple[str, str], Type[CompileState]]�pluginsz Optional[_AmbiguousTableNameMap]rRc�X�|jrb|jjdd�}|jj||jfd�}|�7|jd|jf}n|jd|jf}||ur
|||fi|��S|j||fi|��S�N�compile_state_pluginrp)�_propagate_attrsr�rS�_effective_plugin_target�create_for_statement)rorQ�compilerr��plugin_name�klasss      rWrYz!CompileState.create_for_statement�s����%�%�#�4�4�8�8�&�	��K��K�K�O�O��i�@�@�A�4��E��}�����	� B� B�C���
�K�K��I�>�>�?��E��C�<��y�(�1�b�1�1�-�5�-�-�i��H�R�H�HrYc��||_yrl)rQ)rVrQrZr�s    rWr�zCompileState.__init__�s	��"��rYc���|jjdd�}|r+||jf}||jvr|j|S	|jd|jfS#t$rYywxYwrU)rWr�rXrSr�)rorQr[rzs    rW�get_plugin_classzCompileState.get_plugin_class�s��� �0�0�4�4�"�D�
����	� B� B�C�C��c�k�k�!��{�{�3�'�'�	��;�;�	�9�+M�+M�N�O�O���	��	�s�A&�&	A2�1A2c�X�	|j||jfS#t$rYywxYwrl)rSrXr�)rorQr[s   rW�_get_plugin_class_for_pluginz)CompileState._get_plugin_class_for_plugin�s:��	��;�;��i�@�@�A��
���	��	�s��	)�)c��������fd�}|S)Nc�*��|�j��f<|Srl)rS)�cls_to_decorateror[�
visit_names ���rW�decoratez)CompileState.plugin_for.<locals>.decorate�s���5D�C�K�K��j�1�2�"�"rYr^)ror[rerfs``` rW�
plugin_forzCompileState.plugin_for�s���	#��rYN)rQ�
ExecutablerZr7r�rrrrP)rQrhrr�Optional[Type[CompileState]])rQrhr[r|rrri)r[r|rer|rr�Callable[[_Fn], _Fn])
rZr[r\r�r�rSrsrtrYr�r_rargr^rYrWrPrPss����4;�I�9;�G�
6�;�?�?��I�"�I�.9�I�AD�I�	�I��I�6#���"��	%����*��"��14��	%��������+.��	���rYrPc��eZdZdZdd�Zy)�
GenerativezUProvide a method-chaining pattern in conjunction with the
    @_generative decorator.c�6�|j}|j}|j|�}|rH|jj	�j�D��cic]
\}}||vs�||��c}}|_|S|jj	�|_|Scc}}wrl)�_memoized_keysr�r��__dict__�copy�items)rV�skipro�srF�vs      rWr�zGenerative._generate�s����"�"���n�n���K�K�����"&���!3�!3�!5�!;�!;�!=��!=���A��$���1��!=��A�J�
�����+�+�-�A�J����s�B�$BNr�)rZr[r\r�r�r^rYrWrlrl�s���rYrlc��eZdZdZdZd�Zy)�InPlaceGenerativezkProvide a method-chaining pattern in conjunction with the
    @_generative decorator that mutates in place.r^c�d�|j}|D]}|jj|d�� |Srl)rnror�)rVrrrFs   rWr�zInPlaceGenerative._generate�s0���"�"���A��M�M���a��&���rYN)rZr[r\r�r�r�r^rYrWrvrv�s��5��I�rYrvc�Z�eZdZUdZdZded<ejZded<e	jZy)�HasCompileStatez=A class that has a :class:`.CompileState` associated with it.Nri�_compile_state_plugin�util.immutabledict[str, Any]�_attributes)rZr[r\r�rzrsr*�
EMPTY_DICTr|rPrY�_compile_state_factoryr^rYrWryry�s,��G�:>��7�>�04���K�-�?�)�>�>�rYryc�@�eZdZUdZded<d�Zer
d	d�Zd
d�Zdd�Z	yy)�_MetaOptionsz�metaclass for the Options class.

    This metaclass is actually necessary despite the availability of the
    ``__init_subclass__()`` hook as this type also provides custom class-level
    behavior for the ``__add__()`` method.

    �Tuple[str, ...]�_cache_attrsc��|�}t|�j|j�r3td|�dt|�j|j�����|jj|�|S�Nz<dictionary contains attributes not covered by Options class z: )r��
differencer�rCror8�rV�other�o1s   rW�__add__z_MetaOptions.__add__si��
�V���u�:� � ��!2�!2�3����U��.�.�t�/@�/@�A�C��
�	�����5�!��	rYc��yrlr^rys  rWr{z_MetaOptions.__getattr__#���rYc��yrlr^r!s   rW�__setattr__z_MetaOptions.__setattr__%���SrYc��yrlr^rys  rW�__delattr__z_MetaOptions.__delattr__'���rYN�rzr|rrr�rzr|rrrrr��rzr|rrr�)
rZr[r\r�rsr�rr{r�r�r^rYrWr�r�	s'���"�!���3�@�4�
rYr�c���eZdZUdZdZded<d�fd�Zd�Zd�Zd�Z	d	�Z
edd
��Ze
d��Ze
dd��Zej"Zd
ed<ej&dd��Zed��Zed��Zerdd�Zdd�Zdd�Z�xZS�xZS)�Optionsz,A cacheable option dictionary with defaults.r^r�r�c�z��|j}ttd�|D���|_t�|��y)Nc3�JK�|]}|jd�s|dvr|���y�w)�__)�_cache_key_traversalN)�
startswith)rr;s  rWrz,Options.__init_subclass__.<locals>.<genexpr>4s-������A��|�|�D�)��6�6���s�!#)ro�tuple�sortedr��super�__init_subclass__)ro�dict_r�s  �rWr�zOptions.__init_subclass__1s;������� �����
�
���	��!�#rYc�:�|jj|�yrl)ror8r�s  rWr�zOptions.__init__=s���
�
���R� rYc�~�|jj|j�}|jj|j�t	|�j|j�r3td|�dt	|�j|j�����|jj|�|Sr�)r�r�ror8r�r�r�rCr�s   rWr�zOptions.__add__@s���
�^�^�
#�
#�D�N�N�
3��
�����4�=�=�)��u�:� � ��!2�!2�3����U��.�.�t�/@�/@�A�C��
�	�����5�!��	rYc��t|j|j�D] \}}t||�t||�k7s� yy�NFT)rr��getattr)rVr�r�r�s    rW�__eq__zOptions.__eq__NsD�� �� 1� 1�5�3E�3E�F�D�A�q��t�Q��7�5�!�#4�4��G�rYc����jj�ddj�fd��jD���d�S)N�(�, c3�b�K�|]&}|�jvr|�d�j|�����(y�w)�=N�ro)rrFrVs  �rWrz#Options.__repr__.<locals>.<genexpr>[s3������*�A���
�
�%��d�m�m�A�.�/�*�s�,/�))r�rZ�joinr�rUs`rWrXzOptions.__repr__Vs;���
�N�N�#�#��I�I���*�*��
�
�	
rYc��t||�Srl)�
issubclass)ror\s  rW�
isinstancezOptions.isinstancebs���#�u�%�%rYc�*�||t||�|zizSrl)r�)rVrTrs   rW�add_to_elementzOptions.add_to_elementfs���t�W�T�4�0�5�8�9�9�9rYc��|jSrlr�rUs rW�_state_dict_instzOptions._state_dict_instjs���}�}�rYr{�_state_dict_constc��|jSrl)r�)ros rW�_state_dictzOptions._state_dictps���$�$�$rYc
�<�|j�}||jurz|jrnt|j�j	|j�r@td|�d|�dt|j�j	|j�����||zS)Nzother element z is not empty, is not of type z+, and contains attributes not covered here )r�r�r�r�r�rC)ror�r;s   rW�
safe_mergezOptions.safe_mergets��������
�u���&��"�"��E�&�&�'�2�2�3�3C�3C�D������*�*�+�6�6�s�7G�7G�H���
��Q�w�rYc�2�|jt|�j|��}|j||�}|rWi}|D]!}d|z}	||vr	||||	<�||vs�||||	<�#||z}
t	j
�j
|||
i�}|
|fS||fS)a-process Options argument in terms of execution options.


        e.g.::

            (
                load_options,
                execution_options,
            ) = QueryContext.default_load_options.from_execution_options(
                "_sa_orm_load_options",
                {"populate_existing", "autoflush", "yield_per"},
                execution_options,
                statement._execution_options,
            )

        get back the Options and refresh "_sa_orm_load_options" in the
        exec options dict w/ the Options as well

        r�)r�r�rr�r*�
immutabledict�
merge_with)rorz�attrs�exec_options�statement_exec_options�check_argnames�existing_options�result�argname�local�new_optionss           rW�from_execution_optionszOptions.from_execution_options�s���4�+�+����#�#�$:�;�
��(�+�+�C��5����F�)���g�
���l�*�$0��$9�F�5�M�� 6�6�$:�7�$C�F�5�M�*�+�V�3�K��-�-�/�:�:��s�K�0��L���,�,�$�\�1�1rYc��yrlr^rys  rWr{zOptions.__getattr__�r�rYc��yrlr^r!s   rWr�zOptions.__setattr__�r�rYc��yrlr^rys  rWr�zOptions.__delattr__�r�rY)rrr�)r\z	Type[Any]rr�bool)rrzMapping[str, Any]r�r�r�)rZr[r\r�r�rsr�r�r�r�rXrtr�r,r�r�r*r}r��
classlevelr�r�r�rr{r�r��
__classcell__)r�s@rWr�r�*s����6��I�!�!�
$�!���

��&��&��:��:�����7;�o�o��3�E�� � �%�!�%�����0�/2��/2�b�3�@�4�
rYr�)�	metaclassc�T�eZdZdZed��Zejd��Zed��Zy)�CacheableOptionsr^c�0�tj|||�Srl)r �_gen_cache_key)rV�anon_map�
bindparamss   rW�_gen_cache_key_instz$CacheableOptions._gen_cache_key_inst�s���)�)�$��*�E�ErYc�
�|dfSr�r^)ror�r�s   rWr�zCacheableOptions._gen_cache_key�s���R�y�rYc�,�tj|�Srl)r �_generate_cache_key_for_objectrUs rW�_generate_cache_keyz$CacheableOptions._generate_cache_key�s���9�9�$�?�?rYN)	rZr[r\r�r,r�r�r�r�r^rYrWr�r��sK���I��F��F��#�#��$���@��@rYr�c�:�eZdZdZej
ZdZdZdZ	d�Z
y)�ExecutableOptionr^�executable_optionFTc��|jj|j�}t|j�|_|S)z/Create a shallow copy of this ExecutableOption.)r�r�r)ro)rVr�r�s   rWr�zExecutableOption._clone�s/���N�N�"�"�4�>�>�2���$�-�-�(��
��rYN)rZr[r\r�r*r}�_annotations�__visit_name__�_is_has_cache_key�_is_corer�r^rYrWr�r��s%���I��?�?�L�(�N����H�rYr�c�z�eZdZUdZdZded<ejZded<dZ	dZ
d	ed
<dZded<d
ed<d
ejfdejfdej fgZdZdZdZdZdZdZdZer2ded<ddd�													d#d�Z								d$d�Z								d%d�Zej:d��Zed&d��Z e!d'd��Z"e!d(d��Z#e!d)d��Z$e!						d*d��Z%e&dddddddddddddddddd�																																					d+d��Z'e&d,d ��Z'e!d-d!��Z'd.d"�Z(y)/rhz�Mark a :class:`_expression.ClauseElement` as supporting execution.

    :class:`.Executable` is a superclass for all "statement" types
    of objects, including :func:`select`, :func:`delete`, :func:`update`,
    :func:`insert`, :func:`text`.

    Tr��supports_executionrH�_execution_optionsFr^zTuple[ExecutableOption, ...]�
_with_optionsz6Tuple[Tuple[Callable[[CompileState], None], Any], ...]�_with_context_optionsz9Optional[Union[Type[CacheableOptions], CacheableOptions]]�_compile_optionsrWr|r�N)�for_executemany�schema_translate_mapc��yrlr^)rVr��compiled_cache�column_keysr�r�r�s       rW�_compile_w_cachezExecutable._compile_w_caches��rYc��yrlr^�rV�
connection�distilled_params�execution_optionss    rW�_execute_on_connectionz!Executable._execute_on_connections��
!$rYc��yrlr^r�s    rW�_execute_on_scalarzExecutable._execute_on_scalar$s��
rYc��t��rlr�rUs rW�_all_selected_columnsz Executable._all_selected_columns+r�rYc��|jSrl)r�rUs rWrXz#Executable._effective_plugin_target/s���"�"�"rYc�P�|xjtd�|D��z
c_|S)aJApply options to this statement.

        In the general sense, options are any kind of Python object
        that can be interpreted by the SQL compiler for the statement.
        These options can be consumed by specific dialects or specific kinds
        of compilers.

        The most commonly known kind of option are the ORM level options
        that apply "eager load" and other loading behaviors to an ORM
        query.   However, options can theoretically be used for many other
        purposes.

        For background on specific kinds of options for specific kinds of
        statements, refer to the documentation for those option objects.

        .. versionchanged:: 1.4 - added :meth:`.Executable.options` to
           Core statement objects towards the goal of allowing unified
           Core / ORM querying capabilities.

        .. seealso::

            :ref:`loading_columns` - refers to options specific to the usage
            of ORM queries

            :ref:`relationship_loader_options` - refers to options specific
            to the usage of ORM queries

        c3�dK�|](}tjtj|����*y�wrl)r1�expectr�ExecutableOptionRole)rr�s  rWrz%Executable.options.<locals>.<genexpr>Qs+����$
���
���U�7�7��=��s�.0)r�r��rV�optionss  rWr�zExecutable.options3s0��<	
���e�$
��$
�
�	
���rYc��||_|S)z|Assign the compile options to a new value.

        :param compile_options: appropriate CacheableOptions structure

        �r�)rV�compile_optionss  rW�_set_compile_optionszExecutable._set_compile_optionsWs��!0����rYc�L�|j�J�|xj|z
c_|S)z*update the _compile_options with new keys.rr�s  rW�_update_compile_optionsz"Executable._update_compile_optionsbs,���$�$�0�0�0�����(���rYc�6�|xj||ffz
c_|S)aMAdd a context option to this statement.

        These are callable functions that will
        be given the CompileState object upon compilation.

        A second argument cache_args is required, which will be combined with
        the ``__code__`` identity of the function itself in order to produce a
        cache key.

        )r�)rV�	callable_�
cache_argss   rW�_add_context_optionzExecutable._add_context_optionjs"�� 	
�"�"�	�:�'>�&@�@�"��rY.)r��
logging_token�isolation_level�
no_parameters�stream_results�max_row_buffer�	yield_per�insertmanyvalues_page_sizer��populate_existing�	autoflush�synchronize_session�dml_strategy�render_nulls�is_delete_using�is_update_from�preserve_rowcountc��yrlr^)rVr�r	r
rrr
rrr�rrrrrrrrr�s                   rWr�zExecutable.execution_options}s��,rYc��yrlr^)rVr�s  rWr�zExecutable.execution_options�s��58rYc��d|vrtjd��d|vrtjd��|jj|�|_|S)a�Set non-SQL options for the statement which take effect during
        execution.

        Execution options can be set at many scopes, including per-statement,
        per-connection, or per execution, using methods such as
        :meth:`_engine.Connection.execution_options` and parameters which
        accept a dictionary of options such as
        :paramref:`_engine.Connection.execute.execution_options` and
        :paramref:`_orm.Session.execute.execution_options`.

        The primary characteristic of an execution option, as opposed to
        other kinds of options such as ORM loader options, is that
        **execution options never affect the compiled SQL of a query, only
        things that affect how the SQL statement itself is invoked or how
        results are fetched**.  That is, execution options are not part of
        what's accommodated by SQL compilation nor are they considered part of
        the cached state of a statement.

        The :meth:`_sql.Executable.execution_options` method is
        :term:`generative`, as
        is the case for the method as applied to the :class:`_engine.Engine`
        and :class:`_orm.Query` objects, which means when the method is called,
        a copy of the object is returned, which applies the given parameters to
        that new copy, but leaves the original unchanged::

            statement = select(table.c.x, table.c.y)
            new_statement = statement.execution_options(my_option=True)

        An exception to this behavior is the :class:`_engine.Connection`
        object, where the :meth:`_engine.Connection.execution_options` method
        is explicitly **not** generative.

        The kinds of options that may be passed to
        :meth:`_sql.Executable.execution_options` and other related methods and
        parameter dictionaries include parameters that are explicitly consumed
        by SQLAlchemy Core or ORM, as well as arbitrary keyword arguments not
        defined by SQLAlchemy, which means the methods and/or parameter
        dictionaries may be used for user-defined parameters that interact with
        custom code, which may access the parameters using methods such as
        :meth:`_sql.Executable.get_execution_options` and
        :meth:`_engine.Connection.get_execution_options`, or within selected
        event hooks using a dedicated ``execution_options`` event parameter
        such as
        :paramref:`_events.ConnectionEvents.before_execute.execution_options`
        or :attr:`_orm.ORMExecuteState.execution_options`, e.g.::

             from sqlalchemy import event


             @event.listens_for(some_engine, "before_execute")
             def _process_opt(conn, statement, multiparams, params, execution_options):
                 "run a SQL function before invoking a statement"

                 if execution_options.get("do_special_thing", False):
                     conn.exec_driver_sql("run_special_function()")

        Within the scope of options that are explicitly recognized by
        SQLAlchemy, most apply to specific classes of objects and not others.
        The most common execution options include:

        * :paramref:`_engine.Connection.execution_options.isolation_level` -
          sets the isolation level for a connection or a class of connections
          via an :class:`_engine.Engine`.  This option is accepted only
          by :class:`_engine.Connection` or :class:`_engine.Engine`.

        * :paramref:`_engine.Connection.execution_options.stream_results` -
          indicates results should be fetched using a server side cursor;
          this option is accepted by :class:`_engine.Connection`, by the
          :paramref:`_engine.Connection.execute.execution_options` parameter
          on :meth:`_engine.Connection.execute`, and additionally by
          :meth:`_sql.Executable.execution_options` on a SQL statement object,
          as well as by ORM constructs like :meth:`_orm.Session.execute`.

        * :paramref:`_engine.Connection.execution_options.compiled_cache` -
          indicates a dictionary that will serve as the
          :ref:`SQL compilation cache <sql_caching>`
          for a :class:`_engine.Connection` or :class:`_engine.Engine`, as
          well as for ORM methods like :meth:`_orm.Session.execute`.
          Can be passed as ``None`` to disable caching for statements.
          This option is not accepted by
          :meth:`_sql.Executable.execution_options` as it is inadvisable to
          carry along a compilation cache within a statement object.

        * :paramref:`_engine.Connection.execution_options.schema_translate_map`
          - a mapping of schema names used by the
          :ref:`Schema Translate Map <schema_translating>` feature, accepted
          by :class:`_engine.Connection`, :class:`_engine.Engine`,
          :class:`_sql.Executable`, as well as by ORM constructs
          like :meth:`_orm.Session.execute`.

        .. seealso::

            :meth:`_engine.Connection.execution_options`

            :paramref:`_engine.Connection.execute.execution_options`

            :paramref:`_orm.Session.execute.execution_options`

            :ref:`orm_queryguide_execution_options` - documentation on all
            ORM-specific execution options

        r
z�'isolation_level' execution option may only be specified on Connection.execution_options(), or per-engine using the isolation_level argument to create_engine().r�zm'compiled_cache' execution option may only be specified on Connection.execution_options(), not per statement.)r)rr�rr�s  rWr�zExecutable.execution_options�sh��P��"��#�#�/��
��r�!��#�#�H��
�#'�"9�"9�"?�"?��"C����rYc��|jS)z�Get the non-SQL options which will take effect during execution.

        .. versionadded:: 1.3

        .. seealso::

            :meth:`.Executable.execution_options`
        )r�rUs rW�get_execution_optionsz Executable.get_execution_optionss���&�&�&rY)r�rMr��Optional[CompiledCacheType]r�z	List[str]r�r�r�� Optional[SchemaTranslateMapType]r�rrrzCTuple[Compiled, Optional[Sequence[BindParameter[Any]]], CacheStats])r�rDr�rFr�rLrrzCursorResult[Any])r�rDr�rFr�rLrrr�rrr|)r�r�rrr/)rr�rrr/)r�r�rrr/)rzCallable[[CompileState], None]rrrrr/)&r�rr	r|r
rNrr�rr�r
�intrr rr r�rrr�rr�rr5rr4rr�rr�rr�rr�r�rrrr/)r�rrrr/)r�rrrr/)rrrG))rZr[r\r�r�rsr*r}r��_is_default_generatorr�r�r&�dp_executable_optionsr$�dp_with_context_options�dp_propagate_attrs�_executable_traverse_internals�	is_select�is_from_statement�	is_update�	is_insert�is_text�	is_delete�is_dmlrr�r�r�r�r�rNrXr�r�rrrrr�rr^rYrWrhrh�s0��� $���#�37�?�?��0�B�!��24�M�/�4�	����P�O�
�+�A�A�B�#�%�=�=�	
�
�6�I�I�J�
&�"��I����I��I��G��I�
�F����%*�EI�	��	�8�		�
#�	�"�
	�#C�	��	�
�	�	$�"�	$�6�	$� ;�		$�
�	$�	�"�	�6�	� ;�		�
�	�
�"�"�$�#�$��#��#��!��!�F����������1����
�	���$�7:� �*-�#�$�!��*-�AD�"'��:=�,/� � #�"�"'�'�4���	�
(���
�������%(��?�� ����8��*�� �!�"�#�$�%�& �'�(�)�*
�+���.�8��8��t��t�l	'rYrhc�8�eZdZUdZded<dd�Z						dd�Zy)�SchemaEventTargetz�Base class for elements that are the targets of :class:`.DDLEvents`
    events.

    This includes :class:`.SchemaItem` as well as :class:`.SchemaType`.

    zdispatcher[SchemaEventTarget]�dispatchc��y)z0Associate with this SchemaEvent's parent object.Nr^�rV�parentr�s   rW�_set_parentzSchemaEventTarget._set_parent%s�rYc��|jj||�|j|fi|��|jj||�yrl)r/�before_parent_attachr3�after_parent_attachr1s   rW�_set_parent_with_dispatchz+SchemaEventTarget._set_parent_with_dispatch(sA��	
�
�
�*�*�4��8������&�2�&��
�
�)�)�$��7rYN)r2r.r�rrrr�)rZr[r\r�rsr3r7r^rYrWr.r.s1���,�+�?�8�'�8�/2�8�	
�8rYr.c��eZdZdZddiZy)�
SchemaVisitorz/Define the visiting for ``SchemaItem`` objects.�schema_visitorTN)rZr[r\r��__traverse_options__r^rYrWr9r90s��9�,�d�3�rYr9c�(�eZdZdZdZdZdZdZdZdZ	y)	� _SentinelDefaultCharacterization�none�unknown�
clientside�sentinel_default�
serverside�identity�sequenceN)
rZr[r\�NONE�UNKNOWN�
CLIENTSIDE�SENTINEL_DEFAULT�
SERVERSIDE�IDENTITY�SEQUENCEr^rYrWr=r=6s&���D��G��J�)���J��H��HrYr=c�Z�eZdZUdZded<dZded<dZded<ejZ	ded	<y)
�_SentinelColumnCharacterizationNzOptional[Sequence[Column[Any]]]�columnsFr��is_explicit�
is_autoincr=�default_characterization)
rZr[r\rNrsrOrPr=rErQr^rYrWrMrM@s7��/3�G�
,�3��K����J���(�-�-��>�rYrM�_COLKEY�_COL_co�ColumnElement[Any]T)rc�	covariant�_COLc�H�eZdZUdZded<				d	d�Zd�Zd�Z				d
d�Zy)�_ColumnMetrics)�columnrSrYc�z�||_|j}|r&|jD]}||j|��yyrl)rY�_proxy_index�_expanded_proxy_set�add)rV�
collection�col�pi�eps_cols     rWr�z_ColumnMetrics.__init__Ts@������
$�
$��
��2�2���7�����%�3�rYc�.�|jjSrl)rYr\rUs rW�get_expanded_proxy_setz%_ColumnMetrics.get_expanded_proxy_set`s���{�{�.�.�.rYc��|j}|sy|jjD]0}|j|d�}|r|j	|�|��+|r�.||=�2yrl)r[rYr\r��discard)rVr^r`r_�colsets     rW�disposez_ColumnMetrics.disposecsU��
�
$�
$�����;�;�2�2�C��V�V�C��&�F�����t�$��!�&��s�G�3rYc��|jj}|j|�D]}|jt	|g��r�yyr�)rYr\r�r�r�)rV�
target_set�expanded_proxy_set�ts    rW�embeddedz_ColumnMetrics.embeddednsG��"�[�[�<�<���&�&�'9�:�A�%�2�2�>�1�#�3F�G��;�rYN)r^zColumnCollection[Any, _COL_co]r_rS)riz=Union[Set[ColumnElement[Any]], FrozenSet[ColumnElement[Any]]]rrr�)	rZr[r\r�rsr�rcrgrlr^rYrWrXrXOsD���I��O�
&�8�
&�?F�
&�/�	�
�
�
�

�
rYrXc� �eZdZUdZdZded<ded<ded<d	ed
<	d1	d2d�Zejd
�d3d��Z					d4d�Z
ed5d��Zd6d�Z
d5d�Zd7d�Zd8d�Zd9d�Zd:d�Zed;d��Ze				d<d��Ze				d=d��Z				d>d�Zd?d�Zd@d�ZdAd�ZdBd�Zed1dCd��ZedDd ��Z	d1					dEd!�ZdFd"�ZdGd#�ZdHd$�ZdId%�ZdJd&�ZdKd'�ZdLd(�Z dZ!				d4d)�Z"	d1					dMd*�Z#dNd+�Z$dOd,�Z%dPd-�Z&dQd.�Z'd/�Z(	dR					dSd0�Z)y)T�ColumnCollectiona�Collection of :class:`_expression.ColumnElement` instances,
    typically for
    :class:`_sql.FromClause` objects.

    The :class:`_sql.ColumnCollection` object is most commonly available
    as the :attr:`_schema.Table.c` or :attr:`_schema.Table.columns` collection
    on the :class:`_schema.Table` object, introduced at
    :ref:`metadata_tables_and_columns`.

    The :class:`_expression.ColumnCollection` has both mapping- and sequence-
    like behaviors. A :class:`_expression.ColumnCollection` usually stores
    :class:`_schema.Column` objects, which are then accessible both via mapping
    style access as well as attribute access style.

    To access :class:`_schema.Column` objects using ordinary attribute-style
    access, specify the name like any other object attribute, such as below
    a column named ``employee_name`` is accessed::

        >>> employee_table.c.employee_name

    To access columns that have names with special characters or spaces,
    index-style access is used, such as below which illustrates a column named
    ``employee ' payment`` is accessed::

        >>> employee_table.c["employee ' payment"]

    As the :class:`_sql.ColumnCollection` object provides a Python dictionary
    interface, common dictionary method names like
    :meth:`_sql.ColumnCollection.keys`, :meth:`_sql.ColumnCollection.values`,
    and :meth:`_sql.ColumnCollection.items` are available, which means that
    database columns that are keyed under these names also need to use indexed
    access::

        >>> employee_table.c["values"]


    The name for which a :class:`_schema.Column` would be present is normally
    that of the :paramref:`_schema.Column.key` parameter.  In some contexts,
    such as a :class:`_sql.Select` object that uses a label style set
    using the :meth:`_sql.Select.set_label_style` method, a column of a certain
    key may instead be represented under a particular label name such
    as ``tablename_columnname``::

        >>> from sqlalchemy import select, column, table
        >>> from sqlalchemy import LABEL_STYLE_TABLENAME_PLUS_COL
        >>> t = table("t", column("c"))
        >>> stmt = select(t).set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL)
        >>> subq = stmt.subquery()
        >>> subq.c.t_c
        <sqlalchemy.sql.elements.ColumnClause at 0x7f59dcf04fa0; t_c>

    :class:`.ColumnCollection` also indexes the columns in order and allows
    them to be accessible by their integer position::

        >>> cc[0]
        Column('x', Integer(), table=None)
        >>> cc[1]
        Column('y', Integer(), table=None)

    .. versionadded:: 1.4 :class:`_expression.ColumnCollection`
       allows integer-based
       index access to the collection.

    Iterating the collection yields the column expressions in order::

        >>> list(cc)
        [Column('x', Integer(), table=None),
         Column('y', Integer(), table=None)]

    The base :class:`_expression.ColumnCollection` object can store
    duplicates, which can
    mean either two columns with the same key, in which case the column
    returned by key  access is **arbitrary**::

        >>> x1, x2 = Column("x", Integer), Column("x", Integer)
        >>> cc = ColumnCollection(columns=[(x1.name, x1), (x2.name, x2)])
        >>> list(cc)
        [Column('x', Integer(), table=None),
         Column('x', Integer(), table=None)]
        >>> cc["x"] is x1
        False
        >>> cc["x"] is x2
        True

    Or it can also mean the same column multiple times.   These cases are
    supported as :class:`_expression.ColumnCollection`
    is used to represent the columns in
    a SELECT statement which may include duplicates.

    A special subclass :class:`.DedupeColumnCollection` exists which instead
    maintains SQLAlchemy's older behavior of not allowing duplicates; this
    collection is used for schema level objects like :class:`_schema.Table`
    and
    :class:`.PrimaryKeyConstraint` where this deduping is helpful.  The
    :class:`.DedupeColumnCollection` class also has additional mutation methods
    as the schema constructs have more use cases that require removal and
    replacement of columns.

    .. versionchanged:: 1.4 :class:`_expression.ColumnCollection`
       now stores duplicate
       column keys as well as the same column in multiple positions.  The
       :class:`.DedupeColumnCollection` class is added to maintain the
       former behavior in those cases where deduplication as well as
       additional replace/remove operations are needed.


    )�_collection�_index�_colsetr[z6List[Tuple[_COLKEY, _COL_co, _ColumnMetrics[_COL_co]]]roz4Dict[Union[None, str, int], Tuple[_COLKEY, _COL_co]]rpz6Dict[ColumnElement[Any], Set[_ColumnMetrics[_COL_co]]]r[zSet[_COL_co]rqNc�6�tj|dt��tj|di�tj|dtjt
j��tj|dg�|r|j|�yy)Nrqrpr[ro)r�r�r��collections�defaultdictr*�
OrderedSet�_initial_populate)rVrNs  rWr�zColumnCollection.__init__�sx��	���4��C�E�2����4��2�.�����.�+�"9�"9�$�/�/�"J�	
�	���4���3���"�"�7�+�rYzsqlalchemy.sql.elementsc��tjj}|j|jt
jdd��S)NF)�_literal_as_text_rolerD)r*r$�sql_elementsr9�_all_columnsr�ColumnsClauseRole�rVr2s  rW�__clause_element__z#ColumnCollection.__clause_element__�s?���>�>�.�.��"�x�"�"��
�
�#(�"9�"9��
�	
rYc�&�|j|�yrl��_populate_separate_keys�rV�iter_s  rWrvz"ColumnCollection._initial_populates��	
�$�$�U�+rYc�N�|jD��cgc]\}}}|��
c}}Scc}}wrl�ro�rVr�r_s   rWrzzColumnCollection._all_columns
s(��'+�'7�'7�8�'7���C���'7�8�8��8��
!c�N�|jD��cgc]\}}}|��
c}}Scc}}w)zQReturn a sequence of string key names for all columns in this
        collection.r�)rVrFr�s   rW�keyszColumnCollection.keyss*��$(�#3�#3�4�#3�i�q�!�Q��#3�4�4��4r�c�N�|jD��cgc]\}}}|��
c}}Scc}}w)z�Return a sequence of :class:`_sql.ColumnClause` or
        :class:`_schema.Column` objects for all columns in this
        collection.r�r�s   rWrzColumnCollection.valuess*��(,�'7�'7�8�'7���C���'7�8�8��8r�c�X�|jD���cgc]
\}}}||f��c}}}Scc}}}w)z�Return a sequence of (key, column) tuples for all columns in this
        collection each consisting of a string key name and a
        :class:`_sql.ColumnClause` or
        :class:`_schema.Column` object.
        r�)rVrFr_r�s    rWrqzColumnCollection.itemss.��-1�,<�,<�=�,<�[�a��a��C��,<�=�=��=s�%c�,�t|j�Srl)r�rorUs rW�__bool__zColumnCollection.__bool__"s���D�$�$�%�%rYc�,�t|j�Srl)r	rorUs rWrzColumnCollection.__len__%s���4�#�#�$�$rYc	�`�t|jD��cgc]\}}}|��
c}}�Scc}}wrl)rror�s   rWrzColumnCollection.__iter__(s-���$�*:�*:�;�*:�Y�Q��Q�S�*:�;�<�<��;s�
*
c��yrlr^rys  rWrzColumnCollection.__getitem__,s��<?rYc��yrlr^rys  rWrzColumnCollection.__getitem__/���69rYc��yrlr^rys  rWrzColumnCollection.__getitem__4r�rYc�|��	t|ttf�rKt|t�rd��j|D�}n�fd�|D�}t	|�j�S�j|dS#t$r<}t|jdt�rt|jd�|��d}~wwxYw)Nc3�,K�|]\}}}||f���y�wrlr^)r�sub_keyr_r�s    rWrz/ColumnCollection.__getitem__.<locals>.<genexpr>?s#�����1F�-�W�c�1�!�#��1F�s�c3�<�K�|]}�j|���y�wrl�rp)rr�rVs  �rWrz/ColumnCollection.__getitem__.<locals>.<genexpr>Ds�����D��W�D�K�K��0��s�rr)r�r��slicerorn�as_readonlyrpr�r�r �
IndexError)rVrz�colsr�s`   rWrzColumnCollection.__getitem__9s����	��#��u�~�.��c�5�)��15�1A�1A�#�1F��D�
E��D�D�'��-�9�9�;�;��{�{�3�'��*�*���	��#�(�(�1�+�s�+� ����!��-�3�6���		�s�A A6�$A6�6	B;�?7B6�6B;c�b�	|j|dS#t$r}t|�|�d}~wwxYw)Nr)rpr��AttributeError)rVrzr�s   rWr{zColumnCollection.__getattr__Os8��	/��;�;�s�#�A�&�&���	/� ��%�3�.��	/�s��	.�)�.c�l�||jvr&t|t�stjd��yy)Nz'__contains__ requires a string argumentFT)rpr�r|r)rrys  rW�__contains__zColumnCollection.__contains__Us6���d�k�k�!��c�3�'��'�'�=����rYc�8�t||�D]\}}||us�yy)zdCompare this :class:`_expression.ColumnCollection` to another
        based on the names of the keysFTr)rVr��l�rs    rW�comparezColumnCollection.compare_s(�� ��e�,�D�A�q���z��-�rYc�$�|j|�Srl)r�)rVr�s  rWr�zColumnCollection.__eq__is���|�|�E�"�"rYc��yrlr^�rVrzrps   rWr�zColumnCollection.getls��HKrYc��yrlr^r�s   rWr�zColumnCollection.getos��DGrYc�F�||jvr|j|dS|S)z�Get a :class:`_sql.ColumnClause` or :class:`_schema.Column` object
        based on a string key name from this
        :class:`_expression.ColumnCollection`.rr�r�s   rWr�zColumnCollection.getrs)���$�+�+���;�;�s�#�A�&�&��NrYc�f�|jj�ddjd�|D���d�S)Nr�r�c3�2K�|]}t|����y�wrl)r|)rr�s  rWrz+ColumnCollection.__str__.<locals>.<genexpr>�s����+�d��c�!�f�d�s�r�)r�rZr�rUs rW�__str__zColumnCollection.__str__~s+���N�N�#�#��I�I�+�d�+�+�
�	
rYc��t��rlr�r!s   rWrzColumnCollection.__setitem__����!�#�#rYc��t��rlr�rys  rWrzColumnCollection.__delitem__�r�rYc��t��rlr�)rVrzr�s   rWr�zColumnCollection.__setattr__�r�rYc��t��)zQDictionary clear() is not implemented for
        :class:`_sql.ColumnCollection`.r�rUs rW�clearzColumnCollection.clear��
��"�#�#rYc��t��rlr�)rVrYs  rW�removezColumnCollection.remove�r�rYc��t��)zRDictionary update() is not implemented for
        :class:`_sql.ColumnCollection`.r�r�s  rWr8zColumnCollection.update�r�rYc���|D��cgc]\}}||t||�f��c}}x|jdd}|jjd�|D��|jjt|�D����cic]\}\}}}|||f��c}}}}�|jjt
|�D���cic]\}}}|||f��
c}}}�ycc}}wcc}}}}wcc}}}w)�*populate from an iterator of (key, column)Nc3�DK�|]\}}}|j����y�wrl��_deannotate)rr�r�s   rWrz;ColumnCollection._populate_separate_keys.<locals>.<genexpr>�s����F�:���1�a�A�M�M�O�:��� )rXrorqr8rp�	enumerater9)rVr�rFr�r^�idxr�r_s        rWr�z(ColumnCollection._populate_separate_keys�s���9>�,
�8=���1�Q��>�$��*�+��,
�	
������j�	
�����F�:�F�F������/8��/D�E�/D�^�S�)�1�a��S�1�a�&�[�/D�E�	
�	
������*�9M�N�9M�I�A�s�A�A��3�x�K�9M�N�O��,
��

F��Ns�C�9C�:C"c�t�|�
|j}n|}t|j�}tt|�}|jj||t
||�f�|jj|j��||f|j|<||jvr||f|j|<yy)a�Add a column to this :class:`_sql.ColumnCollection`.

        .. note::

            This method is **not normally used by user-facing code**, as the
            :class:`_sql.ColumnCollection` is usually part of an existing
            object such as a :class:`_schema.Table`. To add a
            :class:`_schema.Column` to an existing :class:`_schema.Table`
            object, use the :meth:`_schema.Table.append_column` method.

        N)rzr	ror	rS�appendrXrqr]r�rp)rVrYrz�colkeyr��_columns      rWr]zColumnCollection.add�s��� �;��Z�Z�F��F��� � �!��
�w��'�������
�W�n�T�7�;�<�	
�	
������,�,�.�/� �'�*����A������$�#)�7�"3�D�K�K���%rYc�r�|jD���cgc]
\}}}||f��c}}}|jd�Scc}}}w)N�rorpr�)rVrFr�r�s    rW�__getstate__zColumnCollection.__getstate__�s:��26�2B�2B�C�2B�w�q�!�Q�Q��F�2B�C��k�k�
�	
��Cs�2c��tj|d|d�tj|dtjtj
��tj|d|dD��cgc]\}}||t
||�f��c}}�tj|d|jD���chc]\}}}|��
c}}}�ycc}}wcc}}}w)Nrpr[rorq)r�r�rsrtr*rurXro)rV�staterFr�r_r�s      rW�__setstate__zColumnCollection.__setstate__�s������4��5��?�;�����.�+�"9�"9�$�/�/�"J�	
�	�����$�M�2�
�2�F�Q���A�~�d�A�.�/�2�
�	
�	����)�4�3C�3C�D�3C�i�a��a�c�3C�D�	
��
��Es�,C�.
Cc�l�||jvr&t|t�rtjd��yy)z3Checks if a column object exists in this collectionzZcontains_column cannot be used with string arguments. Use ``col_name in table.c`` instead.FT)rqr�r|r)r�rVr_s  rW�contains_columnz ColumnCollection.contains_column�s8���d�l�l�"��#�s�#��'�'�;����rYc��t|�S)zIReturn a "read only" form of this
        :class:`_sql.ColumnCollection`.)�ReadOnlyColumnCollectionrUs rWr�zColumnCollection.as_readonly�s��(��-�-rYc��|j}|ry|jD]7\}}}|jj}|D]}||j	|���9y)a�populate the "proxy index", if empty.

        proxy index is added in 2.0 to provide more efficient operation
        for the corresponding_column() method.

        For reasons of both time to construct new .c collections as well as
        memory conservation for large numbers of large .c collections, the
        proxy_index is only filled if corresponding_column() is called. once
        filled it stays that way, and new _ColumnMetrics objects created after
        that point will populate it with new data. Note this case would be
        unusual, if not nonexistent, as it means a .c collection is being
        mutated after corresponding_column() were used, however it is tested in
        test/base/test_utils.py.

        N)r[rorYr\r])rVr`r��metrics�epsras      rW�_init_proxy_indexz"ColumnCollection._init_proxy_index�sT�� �
�
��
��!�-�-�M�A�q�'��.�.�4�4�C����7�����(��.rYc
�n��||jvr|Sd\}}|j}|j��s|j��fd�|D�D�]M}|r|j	|�s�|�|}�|j|jj�}|�%|j|jj�}t|�t|�kDr|}|}��||k(s��t|jj�D�cgc]/}|j|�r|jjdd���1c}�}	t|jj�D�cgc]/}|j|�r|jjdd���1c}�}
|
|	ks��J|}|}��P|r|jSdScc}wcc}w)a�Given a :class:`_expression.ColumnElement`, return the exported
        :class:`_expression.ColumnElement` object from this
        :class:`_expression.ColumnCollection`
        which corresponds to that original :class:`_expression.ColumnElement`
        via a common
        ancestor column.

        :param column: the target :class:`_expression.ColumnElement`
                      to be matched.

        :param require_embedded: only return corresponding columns for
         the given :class:`_expression.ColumnElement`, if the given
         :class:`_expression.ColumnElement`
         is actually present within a sub-element
         of this :class:`_expression.Selectable`.
         Normally the column will match if
         it merely shares a common ancestor with one of the exported
         columns of this :class:`_expression.Selectable`.

        .. seealso::

            :meth:`_expression.Selectable.corresponding_column`
            - invokes this method
            against the collection returned by
            :attr:`_expression.Selectable.exported_columns`.

        .. versionchanged:: 1.4 the implementation for ``corresponding_column``
           was moved onto the :class:`_expression.ColumnCollection` itself.

        )NNc3�@�K�|]}|�vs��|D]}|����y�wrlr^)r�ts�mmr`s   �rWrz8ColumnCollection.corresponding_column.<locals>.<genexpr>@s'����� 
�#�2�r�R�x�"�R�&�B�B�&�B��s�	�N�weightr)rqr�r[r�rlr�rYr\r	r
�_uncached_proxy_list�shares_lineager�r�)rVrY�require_embedded�selected_intersection�selected_metricsri�current_metrics�current_intersection�sc�selected_col_distance�current_col_distancer`s           @rW�corresponding_columnz%ColumnCollection.corresponding_columns����H�T�\�\�!��M�2<�/��/��%�%�
�
�
�
����"�"�$� 
�#� 
�O�$��'?�'?�
�'K�#�+�'6�$��'1�'>�'>�#�*�*�>�>�(�$�)�0�,6�,C�,C�(�/�/�C�C�-�)��+�,�s�3H�/I�I�(7�$�,@�)�)�-B�B�-0�!1� 7� 7� L� L� N��!O�!#� "�0�0��8�	�O�O�/�/��!�<� N��-�)�,/�!0� 6� 6� K� K� M��!N�!#� "�0�0��8�	�O�O�/�/��!�<� M��,�(�,�.C�C�+:�(�0D�-�q 
�t+;��&�&�D��D��+��s�84F-
�4F2
rl)rNz+Optional[Iterable[Tuple[_COLKEY, _COL_co]]])rrr9)r�z!Iterable[Tuple[_COLKEY, _COL_co]]rrr�)rrz
List[_COL_co])rrz
List[_COLKEY])rrzList[Tuple[_COLKEY, _COL_co]])rrr�)rrr )rrzIterator[_COL_co])rzzUnion[str, int]rrrS)rzzTuple[Union[str, int], ...]rr�*ReadOnlyColumnCollection[_COLKEY, _COL_co])rzr�rrr�)rzz3Union[str, int, slice, Tuple[Union[str, int], ...]]rrz:Union[ReadOnlyColumnCollection[_COLKEY, _COL_co], _COL_co])rzr|rrrS)rzr|rrr�)r�zColumnCollection[Any, Any]rrr�)r�rrrr�)rzr|rpr�rrzOptional[_COL_co])rzr|rprVrrzUnion[_COL_co, _COL])rzr|rpzOptional[_COL]rrzOptional[Union[_COL_co, _COL]]r)rzr|rrrrr)rzr|rrr)rzr|r�rrrr)rrr)rYrrrr�)r�rrrr)rYrTrzzOptional[_COLKEY]rrr�)rrrJ)r�rJrrr�)r_rTrrr�)rrr�)F)rYrVr�r�rrzOptional[Union[_COL, _COL_co]])*rZr[r\r�r�rsr�r*�preload_moduler}rvrNrzr�rrqr�rrrrr{r�r�r�r�r�rrr�r�r�r8�__hash__r�r]r�r�r�r�r�r�r^rYrWrnrn{s��j�XC�I�G�G�@�@�H�H�
��FJ�
,�B�
,��T���2�3�
�4�
�,�6�,�	
�,�
�9��9�5�
9�>�&�%�=��?��?�
�9�.�9�	3�9��9��9��9�	3�9��9��F��	C��,/���#��K��K�
�G��G�37�
��
�!/�
�	'�
�
�$�$�$�$�
$�$��H�P�6�P�	
�P�DH�"4�(�"4�/@�"4�	
�"4�H
�
�"
�.�)�66;�hE��hE�.2�hE�	'�hErYrn�	_NAMEDCOLzNamedColumn[Any]c�d�eZdZdZ	d						d
d�Zdd�Z				dd�Zd
d�Zdd�Z	d						dd�Z	y)�DedupeColumnCollectionauA :class:`_expression.ColumnCollection`
    that maintains deduplicating behavior.

    This is useful by schema level objects such as :class:`_schema.Table` and
    :class:`.PrimaryKeyConstraint`.    The collection includes more
    sophisticated mutator methods as well to suit schema objects which
    require mutable column collections.

    .. versionadded:: 1.4

    Nc�h�|�$|j|k7rtjd��|j}|�tjd��||jvrI|j|d}||ury|j	|�t
jj|d�y|j||�y)N�KDedupeColumnCollection requires columns be under the same key as their .keyz-Can't add unnamed column to column collectionrr�)	rzr)rrp�replacer*rM�reset�_append_new_column)rVrYrz�existings    rWr]zDedupeColumnCollection.add�s����?�v�z�z�S�0��#�#�-��
��j�j���;��#�#�?��
��$�+�+���{�{�3�'��*�H��6�!���L�L�� �

�"�"�(�(���=��#�#�C��0rYc��t|j�}|jj||t||�f�|jj|j
��||f|j|<||f|j|<yrl)r	ror�rXrqr]r�rp)rVrz�named_columnr�s    rWr�z)DedupeColumnCollection._append_new_column�sy���� � �!�������
�,��t�\� B�C�	
�	
������1�1�3�4��|�,����A����.����C�rYc	��t|�}g}|D]�\}}|j|k7rtjd��|j|j
vr+|j|jk7r|j
|��m|j|j
vr|j
|���||f|j
|<|jj
||t||�f���|jjd�|jD��|j
jd�t|j�D��|D]}|j|��y)r�r�c3�DK�|]\}}}|j����y�wrlr�)rrFr�r�s    rWrzADedupeColumnCollection._populate_separate_keys.<locals>.<genexpr>�s����N�=M�	��A�q�A�M�M�O�=M�r�c3�6K�|]\}\}}}|||ff���y�wrlr^)rr�rFr�r�s     rWrzADedupeColumnCollection._populate_separate_keys.<locals>.<genexpr>�s'����
�0K�n�c�9�A�q�!�S�1�a�&�M�0K�s�N)
�listrzr)rrTrpr�rorXrqr8r�r�)rVr�r��replace_colrFr_s      rWr�z.DedupeColumnCollection._populate_separate_keys�s%���E�{�����F�A�s��w�w�!�|��'�'�1����x�x�4�;�;�&�3�7�7�c�h�h�+>��"�"�3�'����D�K�K�'��"�"�3�'�"#�S�����A��� � �'�'��C���c�1J�(K�L��	
�����N�T�=M�=M�N�N������
�09�$�:J�:J�0K�
�	
��C��L�L���rYc�4�|jd�|D��y)Nc3�8K�|]}|j|f���y�wrl)rz)rr_s  rWrz0DedupeColumnCollection.extend.<locals>.<genexpr>�s����$E�u��c�g�g�s�^�u�s�rr�s  rW�extendzDedupeColumnCollection.extend�s���$�$�$E�u�$E�ErYc�f�||jvrtd|z��|j|j=|jj	|�|j
D���cgc]\}}}||ur|||f��c}}}|j
dd|jj|d�D]}|j|��|jjt|j
�D����cic]\}\}}}|||f��c}}}}�|jt|j
�=ycc}}}wcc}}}}w)Nz8Can't remove column %r; column is not in this collectionr^)rqr�rprzr�ror[r�rgr8r�r	)rVrYrFr�r�r�r_r�s        rWr�zDedupeColumnCollection.remove�s"������%��J����
�
�K�K��
�
�#������F�#�$(�#3�#3�
�#3���A�w������7�O�#3�
������
�(�(�,�,�V�R�8�G��O�O�D�!�9�	
�����3<�T�=M�=M�3N�O�3N�/�s�K�Q��Q�S�1�c�(�]�3N�O�	
�
�K�K��D�,�,�-�.��
��
Ps�D$�&D+c�z�|rt|�}n
t�}|j|jvr_|j|jk7rF|j|jd}|j|jk(r|j	|�|j|jvr+|j	|j|jd�|s|j|j|�yg}d}|jD]L\}}}	||vr.|r�d}|j|j|t||�f��9|j|||	f��N|rT|jj|�|D]4}
|jj|
d�D]}	|	j|���6|s(|j|j|t||�f�|jj	|j��||jdd|jj�|jj!t#|j�D����cic]\}\}}}|||f��c}}}}�|jj!|jD���cic]\}}}|||f��
c}}}�ycc}}}}wcc}}}w)aadd the given column to this collection, removing unaliased
        versions of this column  as well as existing columns with the
        same key.

        e.g.::

            t = Table("sometable", metadata, Column("col1", Integer))
            t.columns.replace(Column("col1", Integer, key="columnone"))

        will remove the original 'col1' from the collection, and add
        the new column under the name 'columnname'.

        Used by schema.Column to override columns during table reflection.

        rNFTr^)r�rTrprzr]r�ror�rXrq�difference_updater[r�rgr�r�r8r�)
rVrY�extra_remove�
remove_colr��new_cols�replacedrFr_r��rcr�r�s
             rWr�zDedupeColumnCollection.replace�sF��*��\�*�J���J��;�;�$�+�+�%�&�*�*����*C��K�K����,�Q�/�E��z�z�U�Y�Y�&����u�%��:�:����$��N�N�4�;�;�v�z�z�2�1�5�6���#�#�F�J�J��7��KM����#�/�/�O�A�s�G��j� ��#�H��O�O����V�^�D�&�-I�J������C�� 1�2� 0���L�L�*�*�:�6� ��#�0�0�4�4�R��<�G��O�O�D�)� =�!���O�O�V�Z�Z����f�1M�N�O�������+�+�-�.�&�����������������3<�T�=M�=M�3N�O�3N�/�s�K�Q��Q�S�1�c�(�]�3N�O�	
�	
�����4�;K�;K�L�;K�K�Q��Q�A��3�x�K�;K�L�M��
P��Ls�J.�J6rl)rYr�rzz
Optional[str]rrr�)rzr|r�r�rrr�)r�zIterable[Tuple[str, _NAMEDCOL]]rrr�)r�zIterable[_NAMEDCOL]rrr�)rYr�rrr�)rYr�r�zOptional[Iterable[_NAMEDCOL]]rrr�)
rZr[r\r�r]r�r�r�r�r�r^rYrWr�r��s|��
�7;�1��1�&3�1�	
�1�</��4��	
��8F�/�27;�CN��CN�4�CN�
�	CNrYr�c�<�eZdZdZd�Zd�Zd�Zd	d
d�Zdd�Zdd�Z	y)
r���_parentc�:�tj|d|�tj|d|j�tj|d|j�tj|d|j�tj|d|j
�y)Nrrqrpror[)r�r�rqrpror[)rVr^s  rWr�z!ReadOnlyColumnCollection.__init__4st�����4��J�7����4��J�,>�,>�?����4��:�+<�+<�=����4��
�0F�0F�G����4���1H�1H�IrYc��d|jiS�NrrrUs rWr�z%ReadOnlyColumnCollection.__getstate__;s���4�<�<�(�(rYc�0�|d}|j|�yr)r�)rVr�r2s   rWr�z%ReadOnlyColumnCollection.__setstate__>s���y�!���
�
�f�rYc�$�|j�yrl��	_readonly)rVrYrzs   rWr]zReadOnlyColumnCollection.addB������rYc�$�|j�yrlrr|s  rWr�zReadOnlyColumnCollection.extendEr	rYc�$�|j�yrlr)rV�items  rWr�zReadOnlyColumnCollection.removeHr	rYN).)rYrrzrrrr)r2rrrr)rrrrr)
rZr[r\r�r�r�r�r]r�r�r^rYrWr�r�/s(���I�J�)����rYr�c�$�eZdZd�Zd�Zd�Zd�Zy)�	ColumnSetc�
�||vSrlr^r�s  rWr�zColumnSet.contains_columnMs���d�{�rYc�4�|D]}|j|��yrl)r])rVr�r_s   rWr�zColumnSet.extendPs���C��H�H�S�M�rYc��g}|D]/}|D](}|j|�s�|j||k(��*�1tj|�Srl)r�r�r2�and_)rVr�r�r�r�s     rWr�zColumnSet.__eq__TsJ�����A����#�#�E�*��H�H�Q�%�Z�(����}�}�a� � rYc�8�ttd�|D���S)Nc3� K�|]}|���y�wrlr^)rr�s  rWrz%ColumnSet.__hash__.<locals>.<genexpr>]s����*�T��!�T�s�)�hashr�rUs rWr�zColumnSet.__hash__\s���E�*�T�*�*�+�+rYN)rZr[r\r�r�r�r�r^rYrWrrLs����!�,rYrzColumnClause[Any]c���	tt|�jS#t$rEt	j
tt|��D]}t|�s�|jccYS�wxYw)z�Return the nearest .entity_namespace for the given entity.

    If not immediately available, does an iterate to find a sub-element
    that has one, if any.

    )r	rr�r�r�iterater%r�)�entityr�s  rW�_entity_namespacer`sa����'��0�A�A�A�����$�$�T�*?��%H�I�D�'��-��,�,�,�J�
��s��:A*�A*�'A*c��	t|�}|tur
t|||�St||�S#t$r"}t	j
d|�d|�d��|�d}~wwxYw)z�Return an entry from an entity_namespace.


    Raises :class:`_exc.InvalidRequestError` rather than attribute error
    on not found.

    zEntity namespace for "z" has no property "�"N)rr]r�r�r)r�)rrzrp�nsr�s     rW�_entity_namespace_keyrssc��	�
�v�
&���&� ��2�s�G�,�,��2�s�#�#�����%�%�@F��L�
��	���s�.�.�	A�A�A)r�rrrzTypeGuard[_HasEntityNamespace])r2zEUnion[ColumnElement[Any], FromClause, TextClause, _JoinTargetElement]rrzIterator[FromClause])r2z!Iterable[roles.ColumnsClauseRole]rrrB)r�rdrrrd)r�r|r�rrrrj)r2�Iterable[_CLE]rrr)r�rr�rrrz	Set[_CLE])r�1Union[_HasEntityNamespace, ExternallyTraversible]rrrw)rrrzr|rpz%Union[SQLCoreOperations[Any], _NoArg]rrr})�r��
__future__rrs�enumrr�rr�rAr-rrr	r
rrr
rrrrrrrrrrrrrrr�rr�	cache_keyr r!�
traversalsr"r#r$r%r&r(r)r*r+r,�
compat_typing�util.typingr.r/r0r1r2r3�
_orm_typesr4r5�_typingr6rZr7r8r9r:r;r<r=r>�schemar?r@�
selectablerArBrC�enginerDrE�engine.interfacesrFrGrHrIrJrKrLrMrNrOrPrRr]r`ra�
_NONE_NAMErbrdr|�_AmbiguousTableNameMaprfr��_never_select_columnrwrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r+r-rPrlrvry�typer�r�r�r��
StatementRolerh�EventTargetr.r9r=rMrRrSrVrXrnr�r��ReadOnlyContainerr�rurrrr^rYrW�<module>r4s����
#����!��	�����������!��������� �����"�*�(�#�/�+�'����-��*�"��#�����/�6��%�'�$�&�'�%�+�$��(�.�+�&�#�%�;�3�<�.�,�5�?�+�2�:�"���I��H��H�%�T�%�
����I��I�
�
 �
 �
��T����
�e�8�C��H�-�.��'��S��1��
�z�
�4+�x�*�*�+B�C��C�x�C�8�(�8�
0�
	��s�#��
�
�@�	��<����	�	�/�	��	��3�;L�M��%�m�,�,�%��0�: �?��?��?������N��6
�n�S�#�X�.�6
�r$�n�S�#�X�.�$�@����*�+�1�,�1�gC�gC�Ti�i�X���$���?�j�?�5�4�5�B[5��[5�|
@�w��
@� �'��$n'��$�$�n'�b	8��)�)�8�*4�M�4��t���j���)�U�4��9�-�s�
3��
�)�#7�4�
H���v�1�2��)�W�W�%�)�XE�w�w��/�0�E�D
�K�'9�:�	�lN�-�c�9�n�=�lN�^����,�W�g�-=�>��:,���� 3�4�,�(�=����,6<��=��	��3���	rY

ZeroDay Forums Mini