Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/sql/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/sql/__pycache__/util.cpython-311.pyc

�

�܋fZu����dZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lm
Z
ddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddlm%Z%ddlm&Z&d d!lm'Z'd d"lm(Z(e(j)�*e#j+d#��Z,d$�Z-d%�Z.d&�Z/d'�Z0					dEd)�Z1d*�Z2d+�Z3d,�Z4d-�Z5d.�Z6d/�Z7d0�Z8dFd2�Z9d3�Z:d4�Z;d5�Z<Gd6�d7e=��Z>Gd8�d9e>��Z?Gd:�d;e>��Z@d<�ZAdGd>�ZBd?�ZC			dHd@�ZDGdA�dBejE��ZFGdC�dDeF��ZGd=S)Iz;High level utilities which build upon other modules here.

�)�deque)�chain�)�	operators)�visitors)�_deep_annotate)�_deep_deannotate)�_shallow_annotate)�
_from_objects)�	ColumnSet)�sort_tables)�_expand_cloned)�
_find_columns)�_label_reference)�_textual_label_reference)�
BindParameter)�ColumnClause)�
ColumnElement)�Grouping)�Label)�Null)�UnaryExpression)�Column)�Alias)�
FromClause)�FromGrouping)�Join)�ScalarSelect)�
SelectBase)�TableClause�)�exc)�utilz.sql.util.join_conditionc���tt|����}g}t|��D]4\}}|D],}|�|��r|�|���-�5|S)a�Given a list of FROM clauses and a selectable,
    return the first index and element from the list of
    clauses which can be joined against the selectable.  returns
    None, None if no match is found.

    e.g.::

        clause1 = table1.join(table2)
        clause2 = table4.join(table5)

        join_to = table2.join(table3)

        find_join_source([clause1, clause2], join_to) == clause1

    )�listr�	enumerate�is_derived_from�append)�clauses�join_to�selectables�idx�i�f�ss       �J/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/sql/util.py�find_join_sourcer13sz��"�}�W�-�-�.�.�K�
�C��'�"�"�����1��	�	�A�� � ��#�#�
��
�
�1�
�
�
��	��J�c���tt|����}g}t|��D]6\}}|D].}|�|��r|�|��n�/�7t|��dkrkg}|D]b}||}|D]U}t
t|�����t|����r|�|��n�V�c|r|S|S)z�Given a list of FROM clauses and a selectable,
    return the indexes from the list of
    clauses which is derived from the selectable.

    r)	r%rr&r'r(�len�set�surface_selectables�intersection)	r)�	join_fromr+�liberal_idxr-r.r/�conservative_idxr,s	         r0�#find_left_clause_that_matches_givenr;Ms,���}�Y�/�/�0�0�K��K��'�"�"�
�
���1��		�		�A�� � ��#�#�
��"�"�1�%�%�%���
���;���!������	�	�C����A� �
�
���*�1�-�-�.�.�;�;�'��*�*����%�+�+�C�0�0�0��E�	��
�	$�#�#��r2c����
�g}tt|����}t���dkr|�d}t|��}nd}d}t	���D]�\}}|�|g��D]�}	|rWt|j���|	j���|��r|�	|��n0�[tj||	��s|�|�	|��n����t|��dkr/ttd��D������
��
fd�|D��}|s|�tt�����S|S)aGiven a list of FROM clauses, a selectable,
    and optional ON clause, return a list of integer indexes from the
    clauses list indicating the clauses that can be joined from.

    The presence of an "onclause" indicates that at least one clause can
    definitely be joined from; if the list of clauses is of length one
    and the onclause is given, returns that index.   If the list of clauses
    is more than length one, and the onclause is given, attempts to locate
    which clauses contain the same columns.

    rNTFc�6�g|]}t|j����S�)r�_hide_froms)�.0r.s  r0�
<listcomp>z1find_left_clause_to_join_from.<locals>.<listcomp>�s"��C�C�C�a�N�1�=�1�1�C�C�Cr2c�(��g|]}�|�v�|��Sr>r>)r@r-r)�toremoves  ��r0rAz1find_left_clause_to_join_from.<locals>.<listcomp>�s'���<�<�<�Q����8�!;�!;�q�!;�!;�!;r2)r5rr4rr&�
difference�c�union�
issupersetr(r�	_can_joinr�range)r)r*�onclauser,r+�resolve_ambiguity�cols_in_onclauser-r.r/rCs`         @r0�find_left_clause_to_join_fromrMws�����
�C��m�G�,�,�-�-�K��7�|�|�a���H�0� ��(��2�2���!�����'�"�"�����1��'�'���,�,�	�	�A� �
��q�s�8�8�>�>�!�#�&�&�1�1�2B�C�C���J�J�q�M�M�M��E�����1�%�%�
��)=��
�
�1�
�
�
���*>���3�x�x�!�|�|���C�C�7�C�C�C�D�
�
��=�<�<�<�<�#�<�<�<����8�'��S��\�\�"�"�"��
r2c�R����g����fd��t�|����d�dS)a�Produce a traversal of the given expression, delivering
    column comparisons to the given function.

    The function is of the form::

        def my_fn(binary, left, right)

    For each binary expression located which has a
    comparison operator, the product of "left" and
    "right" will be delivered to that function,
    in terms of that binary.

    Hence an expression like::

        and_(
            (a + b) == q + func.sum(e + f),
            j == r
        )

    would have the traversal::

        a <eq> q
        a <eq> e
        a <eq> f
        b <eq> q
        b <eq> e
        b <eq> f
        j <eq> r

    That is, every combination of "left" and
    "right" that doesn't further contain
    a binary comparison is passed as pairs.

    c3��K�t|t��r|V�dS|jdkr�tj|j��r���d|���|j��D](}�|j��D]}��d||����)��	d��|�
��D]
}�|���dSt|t��r|V�|�
��D]}�|��D]}|V���dS)N�binaryr)�
isinstancer�__visit_name__r�
is_comparison�operator�insert�left�right�pop�get_childrenr)�element�l�r�elem�e�fn�stack�visits     ���r0raz#visit_binary_product.<locals>.visit�sf������g�|�,�,�	��M�M�M�M�M�
�
#�x�
/�
/�I�4K���5
�5
�
/�
�L�L��G�$�$�$��U�7�<�(�(�
'�
'����w�}�-�-�'�'�A��B�u�Q�x��A�&�&�&�&�'��I�I�a�L�L�L��,�,�.�.�
�
����d�����
�
��'�<�0�0�
��
�
�
��,�,�.�.�
�
����t�����A��G�G�G�G��
�
r2N)r%)r_�exprr`ras` @@r0�visit_binary_productrc�sQ�����F
�E��������,	���t�������E�E�Er2Fc����g�i}|r�jx|d<|d<|r
�j|d<|r
�j|d<|r�fd�x|d<x|d<|d<|r
�fd	�}||d
<�j|d<tj|dd
i|���S)z1locate Table objects within the given expression.�select�compound_select�join�aliasc�8����|j��S�N�r(�table)�ent�tabless �r0�<lambda>zfind_tables.<locals>.<lambda>s����
�
�c�i�0�0�r2rU�update�deletec�<����|j��dSrjrk)�columnrns �r0�visit_columnz!find_tables.<locals>.visit_columns����M�M�&�,�'�'�'�'�'r2rsrl�column_collectionsF)r(r�traverse)	�clause�
check_columns�include_aliases�
include_joins�include_selects�include_crud�	_visitorsrtrns	        @r0�find_tablesr~�s�����F��I��K�=C�]�J�	�(��i�(9�:��*�"�M�	�&���+�#�]�	�'���1�
1�0�0�0�	1�	�(��	1�i��1�I��5
��+�	(�	(�	(�	(�	(�+�	�(����I�g����f�3�U�;�Y�G�G�G��Mr2c���tj��}g}t|g��}|�rO|���}t	|t
��r�t	|t��rtj|j	��s�t	|t��rSt	|jt��s9|j}t	|t��r|j}|�|����t	|t��r|j}t	|t ��r��||vr*|�|��|�|��n,|���D]}|�|���|��O|S)zqBreak up an 'order by' expression into individual column-expressions,
    without DESC/ASC/NULLS FIRST/NULLS LAST)r#�
column_setr�popleftrQrrr�is_ordering_modifier�modifierrrZrrr(rr�addrY)rw�cols�resultr`�trEs      r0�unwrap_order_byr�sg���?���D�
�F��6�(�O�O�E�
� ��M�M�O�O���a��'�'�	 ��1�o�.�.�	 ��1�!�*�=�=�	 ��!�U�#�#�	
�J��	�<�-�-�	
��I���a��*�*�"��	�A����Q������!�-�.�.�
��I���!�6�8�8�
����}�}���������
�
�a� � � ���^�^�%�%�
 �
 �����Q�����5� �6�Mr2c�4�d�}tj|i|��S)Nc�L�t|ttf��r|jSdSrj)rQrrrZ)r]s r0�replacez'unwrap_label_reference.<locals>.replace8s-���d�-�/G�H�I�I�	 ��<��	 �	 r2)r�replacement_traverse)rZr�s  r0�unwrap_label_referencer�7s(�� � � ��(��"�g�>�>�>r2c���td�|D�����ttd�|D�����}�fd�|D��S)z�Given the columns clause and ORDER BY of a selectable,
    return a list of column expressions that can be added to the collist
    corresponding to the ORDER BY, without repeating those already
    in the collist.

    c�.�g|]}|j�|jn|��Srj)�_order_by_label_elementrZ)r@�cols  r0rAz4expand_column_list_from_order_by.<locals>.<listcomp>Gs6��	
�	
�	
���6�B�C�K�K��	
�	
�	
r2c�,�g|]}t|����Sr>)r�)r@�os  r0rAz4expand_column_list_from_order_by.<locals>.<listcomp>Ms ��D�D�D�a��q�1�1�D�D�Dr2c���g|]}|�v�|��	Sr>r>)r@r��cols_already_presents  �r0rAz4expand_column_list_from_order_by.<locals>.<listcomp>Os$���J�J�J�C�#�5I�*I�*I�C�*I�*I�*Ir2)r5r%r)�collist�order_by�to_look_forr�s   @r0� expand_column_list_from_order_byr�?sn����	
�	
��	
�	
�	
�����u�D�D�8�D�D�D�E�F�F�K�J�J�J�J�;�J�J�J�Jr2c�<�t|��D]}||krdS�dS)z�Given a target clause and a second to search within, return True
    if the target is plainly present in the search without any
    subqueries or aliases involved.

    Basically descends through Joins.

    TF)r6)rw�searchr]s   r0�clause_is_presentr�Rs7��$�F�+�+�����T�>�>��4�4���ur2c#�K�t|t��r8t|j��D]}|V��t|j��D]}|V��dSt|t
��rt|j��D]}|V��dS|V�dSrj)rQr�tables_from_leftmostrVrWrrZ)rwr�s  r0r�r�bs������&�$���	�%�f�k�2�2�	�	�A��G�G�G�G�%�f�l�3�3�	�	�A��G�G�G�G�	�	�	�F�L�	)�	)��%�f�n�5�5�	�	�A��G�G�G�G�	�	������r2c#�K�|g}|r�|���}|V�t|t��r"|�|j|jf��n/t|t��r|�|j��|��dSdSrj)	rXrQr�extendrVrWrr(rZ�rwr`r]s   r0r6r6os�����
�H�E�
�'��y�y�{�{���
�
�
��d�D�!�!�	'��L�L�$�)�T�Z�0�1�1�1�1�
��l�
+�
+�	'��L�L���&�&�&�
�'�'�'�'�'r2c#��K�|g}|r�|���}t|ttf��r|V�t|t��r"|�|j|jf��nrt|t��r|�	|j
��nBt|t��r'|j�|�	|j��n|V�n|�|V�|��dSdSrj)
rXrQr rrr�rVrWrr(rZrrlr�s   r0�surface_selectables_onlyr�zs����
�H�E�
���y�y�{�{���d�[�%�0�1�1�	��J�J�J��d�D�!�!�
	��L�L�$�)�T�Z�0�1�1�1�1�
��l�
+�
+�	��L�L���&�&�&�&�
��l�
+�
+�	��z�%����T�Z�(�(�(�(��
�
�
�
�
�
��J�J�J������r2Tc#�
K�tf}|s|tfz
}t|g��}|rY|���}|V�|���D](}t||��r�|�|���)|�WdSdS)z�traverse and yield only outer-exposed column elements, such as would
    be addressable in the WHERE clause of a SELECT if this element were
    in the columns clause.N)rrrr�rYrQr()rw�include_scalar_selects�filter_r`r]�subs      r0�surface_column_elementsr��s�����
�o�G�!�!��J�=� ���6�(�O�O�E�
���}�}�����
�
�
��$�$�&�&�	�	�C��#�w�'�'�
���L�L������
�����r2c��ttt|�����t|������S)z:Return True if left/right have some overlapping selectable)�boolr5r6r7)rVrWs  r0�selectables_overlapr��sA������%�%�&�&�3�3�4G��4N�4N�O�O���r2c�F��g��fd�}tj|id|i���S)z�Return an ordered list of "bound" values in the given clause.

    E.g.::

        >>> expr = and_(
        ...    table.c.foo==5, table.c.foo==7
        ... )
        >>> bind_values(expr)
        [5, 7]
    c�<����|j��dSrj)r(�effective_value)�bind�vs �r0�visit_bindparamz$bind_values.<locals>.visit_bindparam�s���	����%�&�&�&�&�&r2�	bindparam)rrv)rwr�r�s  @r0�bind_valuesr��sD���	�A�'�'�'�'�'�
��f�b�;��"@�A�A�A��Hr2c��t|tj��r|�dd��}d|zSt	|��S)N�'z''z'%s')rQr#�string_typesr��repr)rZs r0�_quote_ddl_exprr��sA���'�4�,�-�-���/�/�#�t�,�,�������G�}�}�r2c�$�eZdZdZdZdZdZd�ZdS)�
_repr_baserrr!)�	max_charsc��t|��}t|��}||jkr.|jdz}|d|�d||jz
zz||d�z}|S)Nr!rz# ... (%d characters truncated) ... )r�r4r�)�self�value�rep�lenrep�segment_lengths     r0�truncz_repr_base.trunc�sx���5�k�k���S�����D�N�"�"�!�^�q�0�N��A�n�$�%�9����.�0��
�~�o�&�&�'�(�
��
r2N)�__name__�
__module__�__qualname__�_LIST�_TUPLE�_DICT�	__slots__r�r>r2r0r�r��s7������
�E�
�F�
�E��I�
�
�
�
�
r2r�c�$�eZdZdZdZdd�Zd�ZdS)�	_repr_rowzProvide a string view of a row.)�row�,c�"�||_||_dSrj)r�r�)r�r�r�s   r0�__init__z_repr_row.__init__�s�����"����r2c���|j�dd��fd�|jD�����t|j��dkrdnd�d�S)N�(�, c3�.�K�|]}�|��V��dSrjr>�r@r�r�s  �r0�	<genexpr>z%_repr_row.__repr__.<locals>.<genexpr>�s+�����9�9�u�e�e�E�l�l�9�9�9�9�9�9r2r�,��))r�rgr�r4)r�r�s @r0�__repr__z_repr_row.__repr__�s^����
����I�I�9�9�9�9���9�9�9�9�9�9��t�x�=�=�A�%�%�C�C�2�-�-�
�	
r2N)r�)r�r�r��__doc__r�r�r�r>r2r0r�r��sB������)�)��I�#�#�#�#�
�
�
�
�
r2r�c�0�eZdZdZdZd	d�Zd�Zd�Zd�ZdS)
�_repr_paramsz�Provide a string view of bound parameters.

    Truncates display to a given numnber of 'multi' parameter sets,
    as well as long values to a given number of characters.

    )�params�batches�ismultir�Nc�>�||_||_||_||_dSrj)r�r�r�r�)r�r�r�r�r�s     r0r�z_repr_params.__init__�s"�����������"����r2c	�&�|j�|�|j��St|jt��r|j}n^t|jt��r|j}n<t|jt��r|j	}n|�|j��S|jr�t|j��|jkr�d}d�|�
|jd|jdz
�|��dd�||jt|j��fz|�
|jdd�|��dd�f��S|jr|�
|j|��S|�|j|��S)Nz8 ... displaying %i of %i total bound parameter sets ... � r!r������r)r�r�r�rQr%r��tupler��dictr�r4r�rg�_repr_multir�)r��typ�msgs   r0r�z_repr_params.__repr__�sz���<���:�:�d�k�*�*�*��d�k�4�(�(�	+��*�C�C�
���U�
+�
+�	+��+�C�C�
���T�
*�
*�	+��*�C�C��:�:�d�k�*�*�*��<�	7�C���,�,�t�|�;�;�L�C��8�8��$�$�T�[�1C�4�<�!�3C�1C�%D�c�J�J��"����4�<��T�[�)9�)9�:�:��$�$�T�[����%5�s�;�;�A�B�B�?����
��\�	7��#�#�D�K��5�5�5��$�$�T�[�#�6�6�6r2c����|r�t|dt��r�j�nft|dt��r�j�nCt|dt
��r�j�n Jdt|d��z���d���fd�|D����}nd}|�jkrd|zSd|zS)	NrFzUnknown parameter type %sr�c3�D�K�|]}��|���V��dSrj)r�)r@r��	elem_typer�s  ��r0r�z+_repr_params._repr_multi.<locals>.<genexpr>(sD�����!�!�9?��!�!�&�)�4�4�!�!�!�!�!�!r2r��[%s]z(%s))	rQr%r�r�r�r�r��typerg)r��multi_paramsr��elementsr�s`   @r0r�z_repr_params._repr_multis������	��,�q�/�4�0�0�	
� �J�	�	��L��O�U�3�3�
� �K�	�	��L��O�T�2�2�
� �J�	�	��9���a��)�)����u��y�y�!�!�!�!�!�CO�!�!�!���H�H��H��$�*����H�$�$��H�$�$r2c�b��|j�||jur6dd��fd�|���D����zS||jur<dd��fd�|D�����t|��dkrdnd�d	�Sd
d��fd�|D����zS)Nz{%s}r�c3�>�K�|]\}}|�d�|����V��dS)z: Nr>)r@�keyr�r�s   �r0r�z,_repr_params._repr_params.<locals>.<genexpr>7sN�������"��U�!$���U�U�5�\�\�\�2������r2r�c3�.�K�|]}�|��V��dSrjr>r�s  �r0r�z,_repr_params._repr_params.<locals>.<genexpr>>s+�����;�;�5�%�%��,�,�;�;�;�;�;�;r2rr�r�r�r�c3�.�K�|]}�|��V��dSrjr>r�s  �r0r�z,_repr_params._repr_params.<locals>.<genexpr>Bs+�����&H�&H��u�u�U�|�|�&H�&H�&H�&H�&H�&Hr2)r�r�rg�itemsr�r4)r�r�r�r�s   @r0r�z_repr_params._repr_params3s�����
���$�*�����	�	�����&,�l�l�n�n�������
��D�K�
�
�
��	�	�;�;�;�;�F�;�;�;�;�;�;��6�{�{�a�'�'���R�/�/��
�
�T�Y�Y�&H�&H�&H�&H��&H�&H�&H�H�H�I�Ir2)r�N)	r�r�r�r�r�r�r�r�r�r>r2r0r�r��sk��������/�I�#�#�#�#�7�7�7�<%�%�%�0J�J�J�J�Jr2r�c�>���fd�}tj|id|i��S)zWgiven criterion containing bind params, convert selected elements
    to IS NULL.

    c���t|jt��rQ|jj�vrC|j|_t��|_tj|_tj	|_
dSt|jt��rE|jj�vr9t��|_tj|_tj	|_
dSdSdSrj)rQrVr�_identifying_keyrWrr�is_rT�isnot�negate)rP�nullss �r0�visit_binaryz-adapt_criterion_to_null.<locals>.visit_binaryKs�����v�{�M�2�2�	,���,��5�5�!�,�F�K��6�6�F�L�'�m�F�O�%�O�F�M�M�M��v�|�]�3�3�	,���-��6�6��6�6�F�L�'�m�F�O�%�O�F�M�M�M�
	,�	,�6�6r2rP)r�cloned_traverse)�critr�r�s ` r0�adapt_criterion_to_nullrEs8���,�,�,�,�,�$�#�D�"�x��.F�G�G�Gr2Nc��|�|S|dfg}t|��}d}|r�|���\}}t|t��rh||urd|���}|���|�|j��|_|�|j	|f��n|�|��}|�||_	|�|}|��|Srj)
�
ClauseAdapterrXrQr�_clone�_reset_exportedrvrJr(rV)rVrW�stop_onr`�adapter�ret�	prevrights       r0�splice_joinsr
`s����|����T�]�O�E��D�!�!�G�
�C�
��"�Y�Y�[�[���	��e�T�"�"�	,�u�G�';�';��L�L�N�N�E��!�!�#�#�#�$�-�-�e�n�=�=�E�N��L�L�%�*�e�,�-�-�-�-��$�$�U�+�+�E�� �"�I�N��;��C����Jr2c�z��
��|�dd��}|�dd���tj����tj���
�D]�}t	d�|jD���D]~}�D]y}||ur�	|j}n+#tj$r|rY�#�tj	$r|rY�6�wxYw|�
|��r)�r|j|jkr�
�|��n�z���|r&��
�fd�}|D]}	|	�tj|	id|i���t���
����S)aCgiven a list of columns, return a 'reduced' set based on natural
    equivalents.

    the set is reduced to the smallest list of columns which have no natural
    equivalent present in the list.  A "natural equivalent" means that two
    columns will ultimately represent the same value because they are related
    by a foreign key.

    \*clauses is an optional list of join clauses which will be traversed
    to further identify columns that are "equivalent".

    \**kw may specify 'ignore_nonexistent_tables' to ignore foreign keys
    whose tables are not yet configured, or columns that aren't yet present.

    This function is primarily used to determine the most minimal "primary
    key" from a selectable, by reducing the set of primary key columns present
    in the selectable to just those that are not repeated.

    �ignore_nonexistent_tablesF�
only_synonymsc��g|]	}|j��
Sr>)�foreign_keys�r@rEs  r0rAz"reduce_columns.<locals>.<listcomp>�s��@�@�@�Q�!�.�@�@�@r2c���|jtjkr�tjtd������D�����}|j|vrf|j|vr_t���D]Q}|�
|j��r/�r|j|jjkr��|��dS�LdSdSdSdS)Nc��g|]	}|j��
Sr>)�	proxy_setrs  r0rAz8reduce_columns.<locals>.visit_binary.<locals>.<listcomp>�s��J�J�J�A�A�K�J�J�Jr2)
rTr�eqr#r�rrDrVrW�reversed�shares_lineage�namer�)rPr�rE�columns�omitr
s   ���r0r�z$reduce_columns.<locals>.visit_binary�s������)�,�.�.����J�J��1C�1C�D�1I�1I�J�J�J�K�����;�$�&�&�6�<�4�+?�+?�%�g�.�.�"�"���+�+�F�L�9�9�"� -�"�12��6�;�;K�1K�1K� �H�H�Q�K�K�K�!�E�E��/�.�'�&�+?�+?�"�"r2NrP)rXr#�ordered_column_setr�rrrsr"�NoReferencedColumnError�NoReferencedTableErrorrrr�rrvrrD)rr)�kwrr��fkrE�fk_colr�rwrr
s`         @@r0�reduce_columnsr ys������(!#���'B�E� J� J���F�F�?�E�2�2�M��%�g�.�.�G��?���D������@�@�#�-�@�@�@�A�	�	�B��
�
����8�8����Y�F�F���2����1�� ����1����1�� ���
�����(�(��+�+��%��)*��3�8�);�);��H�H�S�M�M�M��E���1	�4�H�	"�	"�	"�	"�	"�	"�	"��	H�	H�F��!��!�&�"�x��.F�G�G�G���W�'�'��-�-�.�.�.s�?B�B/	�B/	�-B/	c��������r�rtjd���d�������fd�}g�tj|id|i���S)z9traverse an expression and locate binary criterion pairs.zSCan only specify one of 'consider_as_foreign_keys' or 'consider_as_referenced_keys'c�,�|�|��Srj)�compare)�a�bs  r0�col_isz"criterion_as_pairs.<locals>.col_is�s���y�y��|�|�r2c����s|jtjurdSt|jt
��rt|jt
��sdS�r�|j�vrB�|j|j��s	|j�vr#��|j|jf��dS|j�vrB�|j|j��s	|j�vr%��|j|jf��dSdSdS�r�|j�vrB�|j|j��s	|j�vr#��|j|jf��dS|j�vrB�|j|j��s	|j�vr%��|j|jf��dSdSdSt|jt��r�t|jt��r�|j�	|j��r#��|j|jf��dS|j�	|j��r'��|j|jf��dSdSdSdSrj)
rTrrrQrVrrWr(r�
references)rP�any_operatorr&�consider_as_foreign_keys�consider_as_referenced_keys�pairss �����r0r�z(criterion_as_pairs.<locals>.visit_binary�s�����	���y�|� C� C��F��&�+�}�5�5�	�Z��L�-�>
�>
�	�
�F�#�	>��{�6�6�6���v�|�V�[�1�1�7��<�'?�?�?����f�l�F�K�8�9�9�9�9�9���!9�9�9���v�{�F�L�1�1�:��;�&>�>�>����f�k�6�<�8�9�9�9�9�9�	:�9�>�>�)�	>��{�9�9�9���v�|�V�[�1�1�:��<�'B�B�B����f�k�6�<�8�9�9�9�9�9���!<�<�<���v�{�F�L�1�1�=��;�&A�A�A����f�l�F�K�8�9�9�9�9�9�	=�<�A�A��&�+�v�.�.�
>�:���f�4�4�
>��;�)�)�&�,�7�7�>��L�L�&�,���!<�=�=�=�=�=��\�,�,�V�[�9�9�>��L�L�&�+�v�|�!<�=�=�=�=�=�

>�
>�
>�
>�
>�>r2rP)r"�
ArgumentErrorrrv)�
expressionr*r+r)r�r&r,s ``` @@r0�criterion_as_pairsr/�s�������� �
�$?�
���
,�
�
�	
����%>�%>�%>�%>�%>�%>�%>�%>�%>�N
�E���j�"�x��&>�?�?�?��Lr2c�>�eZdZdZ					dd�Zejfd�Zd�ZdS)ra5Clones and modifies clauses based on column correspondence.

    E.g.::

      table1 = Table('sometable', metadata,
          Column('col1', Integer),
          Column('col2', Integer)
          )
      table2 = Table('someothertable', metadata,
          Column('col1', Integer),
          Column('col2', Integer)
          )

      condition = table1.c.col1 == table2.c.col1

    make an alias of table1::

      s = table1.alias('foo')

    calling ``ClauseAdapter(s).traverse(condition)`` converts
    condition to read::

      s.c.col1 == table2.c.col1

    NFc��|g|d�|_||_||_||_t	j|pi��|_||_dS)N)r�anonymize_labels)�__traverse_options__�
selectable�
include_fn�
exclude_fnr#�column_dict�equivalents�adapt_on_names)r�r4r8r5r6r9r2s       r0r�zClauseAdapter.__init__sX��#�|� 0�%
�%
��!�%���$���$����+�K�,=�2�>�>���,����r2c�:�|j�||���}|�O||jvrF||vrB|j|D]4}|�|||�|g�����}|�|cS�5|jr&|�$|jj�|j��}|S)N)�require_embedded)r;�_seen)	r4�corresponding_columnr8�_corresponding_columnrFr9rE�getr)r�r�r;r<�newcol�equivs      r0r>z#ClauseAdapter._corresponding_column1s�����5�5��"2�6�
�
���>�c�T�%5�5�5�#�U�:J�:J��)�#�.�
"�
"���3�3��%5��+�+�s�e�,�,�4����
�%�!�M�M�M�&���	5�6�>��_�&�*�*�3�8�4�4�F��
r2c�@�t|t��r!|j�|��r|jSt|t��sdS|jr|�|��sdS|jr|�|��rdS|�|d��S)NT)rQrr4r'rr5r6r>)r�r�s  r0r�zClauseAdapter.replaceDs����c�:�&�&�	9�4�?�+J�+J��,
�,
�	9��?�"��C��/�/�	9��4�
�_�	9�T�_�_�S�%9�%9�	9��4�
�_�	9�����!5�!5�	9��4��-�-�c�4�8�8�8r2)NNNFF)	r�r�r�r�r�r#�	EMPTY_SETr>r�r>r2r0rrsm��������:�����-�-�-�-�(,0�>�����&9�9�9�9�9r2rc�t�eZdZdZ							d
d�ZGd�de��Zd�Zd	�ZeZ	e
jZd
�Z
d�Zd�ZdS)�
ColumnAdaptera�Extends ClauseAdapter with extra utility functions.

    Key aspects of ColumnAdapter include:

    * Expressions that are adapted are stored in a persistent
      .columns collection; so that an expression E adapted into
      an expression E1, will return the same object E1 when adapted
      a second time.   This is important in particular for things like
      Label objects that are anonymized, so that the ColumnAdapter can
      be used to present a consistent "adapted" view of things.

    * Exclusion of items from the persistent collection based on
      include/exclude rules, but also independent of hash identity.
      This because "annotated" items all have the same hash identity as their
      parent.

    * "wrapping" capability is added, so that the replacement of an expression
      E can proceed through a series of adapters.  This differs from the
      visitor's "chaining" feature in that the resulting object is passed
      through all replacing functions unconditionally, rather than stopping
      at the first one that returns non-None.

    * An adapt_required option, used by eager loading to indicate that
      We don't trust a result row column that is not translated.
      This is to prevent a column from being interpreted as that
      of the child row in a self-referential scenario, see
      inheritance/test_basic.py->EagerTargetingTest.test_adapt_stringency

    NFTc		�
�t�|||||||���tj|j��|_|js|jr |�||j��|_||_	||_
d|_dS)N)r5r6r9r2)rr�r#�WeakPopulateDict�_locate_colrr5r6�_IncludeExcludeMapping�adapt_required�allow_label_resolve�_wrap)	r�r4r8rJr5r6r9rKr2s	         r0r�zColumnAdapter.__init__rs���	������!�!�)�-�	�	
�	
�	
��,�T�-=�>�>����?�	K�d�o�	K��6�6�t�T�\�J�J�D�L�,���#6�� ���
�
�
r2c��eZdZd�Zd�ZdS)�$ColumnAdapter._IncludeExcludeMappingc�"�||_||_dSrj)�parentr)r�rPrs   r0r�z-ColumnAdapter._IncludeExcludeMapping.__init__�s�� �D�K�"�D�L�L�Lr2c��|jjr|j�|��r&|jjr?|j�|��r%|jjr|jjj|S|S|j|Srj)rPr5r6rLr)r�r�s  r0�__getitem__z0ColumnAdapter._IncludeExcludeMapping.__getitem__�s�����&�
�/3�{�/E�/E�c�/J�/J�
��+�(�
�-1�[�-C�-C�C�-H�-H�
��;�$���;�,�4�S�9�9��J��<��$�$r2N)r�r�r�r�rRr>r2r0rIrN�s2������	#�	#�	#�	%�	%�	%�	%�	%r2rIc�(�|j�|j��}|j�|j��||_tj|j��|_|j	s|j
r |�||j��|_|Srj)�	__class__�__new__�__dict__rprLr#rGrHrr5r6rI)r�r�acs   r0�wrapzColumnAdapter.wrap�s��
�^�
#�
#�D�N�
3�
3��
����4�=�)�)�)�����*�2�>�:�:��
�
�=�	E�B�M�	E��4�4�R���D�D�B�J��	r2c��|j|Srj)r)r��objs  r0rvzColumnAdapter.traverse�s���|�C� � r2c��t�||��}|jr|j�|��}|�|}|jr||urdS|j|_|Srj)rrvrLrHrJrK�_allow_label_resolve)r�r�rE�c2s    r0rHzColumnAdapter._locate_col�sh���"�"�4��-�-���:�	���'�'��*�*�B��~�����	�1��8�8��4�!%�!9����r2c�>�|j���}|d=|S)Nr)rV�copy)r��ds  r0�__getstate__zColumnAdapter.__getstate__�s!���M��� � ��
�i�L��r2c�v�|j�|��tj|j��|_dSrj)rVrpr#rGrHr)r��states  r0�__setstate__zColumnAdapter.__setstate__�s1���
���U�#�#�#��,�T�-=�>�>����r2)NFNNFTF)r�r�r�r�r��objectrIrXrv�adapt_clauser�copy_and_process�
adapt_listrHrardr>r2r0rErESs���������B����� ������8
%�
%�
%�
%�
%��
%�
%�
%����!�!�!��L��/�J���� ���
?�?�?�?�?r2rE)FFFFF)Trj)NNF)Hr��collectionsr�	itertoolsrr�rr�
annotationrr	r
�baserr�ddlr
r�rrrrrrrrrrr�schemarr4rrrrrrr r"r#�langhelpers�public_factory�_join_condition�join_conditionr1r;rMrcr~r�r�r�r�r�r6r�r�r�r�r�rer�r�r�rr
r r/�ReplacingCloningVisitorrrEr>r2r0�<module>rts�����������������������������&�&�&�&�&�&�(�(�(�(�(�(�)�)�)�)�)�)�������������������$�$�$�$�$�$�#�#�#�#�#�#�&�&�&�&�&�&�.�.�.�.�.�.�#�#�#�#�#�#�"�"�"�"�"�"�#�#�#�#�#�#�������������������%�%�%�%�%�%�������������"�"�"�"�"�"�$�$�$�$�$�$�������$�$�$�$�$�$�"�"�"�"�"�"�#�#�#�#�#�#��������������!�0�0���4����
���4'�'�'�T1�1�1�h<�<�<�B�����
%�%�%�%�P"�"�"�J?�?�?�K�K�K�&
�
�
� 
�
�
�'�'�'����&����&���
�
�
�*������������.
�
�
�
�
�
�
�
�
�"UJ�UJ�UJ�UJ�UJ�:�UJ�UJ�UJ�pH�H�H�6����2H/�H/�H/�Z"� $��	<�<�<�<�~M9�M9�M9�M9�M9�H�4�M9�M9�M9�`q?�q?�q?�q?�q?�M�q?�q?�q?�q?�q?r2

Hacked By AnonymousFox1.0, Coded By AnonymousFox