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

���gߍ��H�dZddlmZddlmZddlmZddlZddlZddl	Z	ddl	m
Z
ddl	mZddl	mZdd	l	m
Z
dd
l	mZddl	mZddl	mZdd
l	mZddl	mZddl	mZddl	mZddl	mZddl	mZddl	mZddl	mZddl	mZddlmZddlmZddlmZddlmZddl m!Z!ddl m"Z"ddl m#Z#erddl$m%Z%dd l&m'Z'e	j.ses
dd!l(m)Z)dd"l(m*Z+ndd!l,m)Z)dd"l,m*Z+gd#�Z-Gd$�d%e"�Z.Gd&�d'�Z/Gd(�d)e�Z0eee1e0fZ2	Gd*�d+�Z3Gd,�d-e"�Z4Gd.�d/�Z5e0Z6dPd0�Z7e5jpZ8e7�Gd1�d2e3e/�Z9ed3e9�4�Z:ed5d6�4�Z;ee:gdfZ<Gd7�d8e"�Z=Gd9�d:e"e:�Z>ed;d<�4�Z?Gd=�d<ej��ZAGd>�d?eA�ZBGd@�dAeB�ZCe/ZDeAZEeBZFeCZGej�f					dQdB�ZIe								dRdC��ZJe								dSdD��ZJ								dTdE�ZJe								dUdF��ZKe								dVdG��ZK								dWdH�ZKe								dUdI��ZLe								dXdJ��ZL								dWdK�ZLe								dYdL��ZMe								dZdM��ZMe								d[dN��ZM								d\dO�ZMy)]z5Visitor/traversal interface and library functions.


�)�annotations)�deque)�EnumN)�Any)�Callable)�cast)�ClassVar)�Dict)�Iterable)�Iterator)�List)�Mapping)�Optional)�overload)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union�)�exc)�util)�langhelpers)�HAS_CYEXTENSION)�Literal)�Protocol)�Self�)�_AnnotationDict)�
ColumnElement)�prefix_anon_map)�cache_anon_map)	�iterate�traverse_using�traverse�cloned_traverse�replacement_traverse�	Visitable�ExternalTraversal�InternalTraversal�anon_mapc��eZdZdd�Zy)�_CompilerDispatchTypec��y�N�)�_self�self�visitor�kws    �H/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/visitors.py�__call__z_CompilerDispatchType.__call__Ks��#�N)r2r(r3rr4r�returnr��__name__�
__module__�__qualname__r6r0r7r5r-r-Js��Mr7r-c�x��eZdZUdZdZded<ded<ejrdd�Zd�fd�Z	e
dd	��Zd
d
�Z�xZ
S)r(a,Base class for visitable objects.

    :class:`.Visitable` is used to implement the SQL compiler dispatch
    functions.    Other forms of traversal such as for cache key generation
    are implemented separately using the :class:`.HasTraverseInternals`
    interface.

    .. versionchanged:: 2.0  The :class:`.Visitable` class was named
       :class:`.Traversible` in the 1.4 series; the name is changed back
       to :class:`.Visitable` in 2.0 which is what it was prior to 1.4.

       Both names remain importable in both 1.4 and 2.0 versions.

    r0�str�__visit_name__r-�_original_compiler_dispatchc��yr/r0)r2r3r4s   r5�_compiler_dispatchzVisitable._compiler_dispatchfs��cr7c�^��d|jvr|j�t�|�
�y)Nr?)�__dict__�_generate_compiler_dispatch�super�__init_subclass__)�cls�	__class__s �r5rGzVisitable.__init_subclass__hs&����s�|�|�+��+�+�-�
��!�#r7c�0��|j}d|jvr|j|_yt	|t
�s#t
jd|j�d���d|z}tj|��								d�fd�}|x|_|_y)NrBz__visit_name__ on class z$ must be a string at the class level�visit_%sc�|��	�|�}||fi|��S#t$r}|j||fi|��cYd}~Sd}~wwxYw)zLook for an attribute named "visit_<visit_name>" on the
            visitor, and call it with the same kw params.

            N)�AttributeError�visit_unsupported_compilation)r2r3r4�meth�err�getters     �r5rBzAVisitable._generate_compiler_dispatch.<locals>._compiler_dispatch�sQ���
(��g����D�'�B�'�'��"�
N�<�w�<�<�T�3�M�"�M�M��
N�s��	;�6�;�;)r2r(r3rr4rr8r>)r?rDrBr@�
isinstancer>r�InvalidRequestErrorr:�operator�
attrgetter)rH�
visit_name�namerBrQs    @r5rEz%Visitable._generate_compiler_dispatchms�����'�'�
��3�<�<�/�/2�.D�.D�C�+���*�c�*��)�)�*�3�<�<�.�9%�%��
�
�J�&���$�$�T�*��	(��	(�&)�	(�14�	(�
�	(� 
�	����+r7c��|Sr/r0)rH�keys  r5�__class_getitem__zVisitable.__class_getitem__�s���
r7)r3rr4rr8r>�r8�None)rYrr8r)r:r;r<�__doc__�	__slots__�__annotations__�typingrrBrG�classmethodrErZ�
__classcell__)rIs@r5r(r(NsF���
��I���!6�6�
���I�$�
�#��#�Jr7r(c���eZdZdZdZ	dZ	dZ	dZ	dZ	dZ		dZ
	d	Zd
ZdZ
	dZ	d
Z	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZdZdZ	dZ 	dZ!	d Z"	d!Z#	d"Z$		d#Z%	d$Z&	d%Z'	d&Z(	d'Z)	d(Z*y))*r*a�Defines visitor symbols used for internal traversal.

    The :class:`.InternalTraversal` class is used in two ways.  One is that
    it can serve as the superclass for an object that implements the
    various visit methods of the class.   The other is that the symbols
    themselves of :class:`.InternalTraversal` are used within
    the ``_traverse_internals`` collection.   Such as, the :class:`.Case`
    object defines ``_traverse_internals`` as ::

        class Case(ColumnElement[_T]):
            _traverse_internals = [
                ("value", InternalTraversal.dp_clauseelement),
                ("whens", InternalTraversal.dp_clauseelement_tuples),
                ("else_", InternalTraversal.dp_clauseelement),
            ]

    Above, the :class:`.Case` class indicates its internal state as the
    attributes named ``value``, ``whens``, and ``else_``.    They each
    link to an :class:`.InternalTraversal` method which indicates the type
    of datastructure to which each attribute refers.

    Using the ``_traverse_internals`` structure, objects of type
    :class:`.InternalTraversible` will have the following methods automatically
    implemented:

    * :meth:`.HasTraverseInternals.get_children`

    * :meth:`.HasTraverseInternals._copy_internals`

    * :meth:`.HasCacheKey._gen_cache_key`

    Subclasses can also implement these methods directly, particularly for the
    :meth:`.HasTraverseInternals._copy_internals` method, when special steps
    are needed.

    .. versionadded:: 1.4

    �HC�HL�CE�FC�CTS�CL�CT�EO�WC�CO�S�SL�AN�B�O�T�PD�DO�CD�MD�AK�PO�DD�PS�TH�SJ�ME�SH�UK�DML_OV�DML_V�DML_MV�PA�IG�IS�M�MT�HT�ILN)+r:r;r<r]�dp_has_cache_key�dp_has_cache_key_list�dp_clauseelement�)dp_fromclause_canonical_column_collection�dp_clauseelement_tuples�dp_clauseelement_list�dp_clauseelement_tuple�dp_executable_options�dp_with_context_options�dp_fromclause_ordered_set�	dp_string�dp_string_list�dp_anon_name�
dp_boolean�dp_operator�dp_type�
dp_plain_dict�dp_dialect_options�dp_string_clauseelement_dict�dp_string_multi_dict�dp_annotations_key�dp_plain_obj�dp_named_ddl_element�dp_prefix_sequence�dp_table_hint_list�dp_setup_join_tuple�dp_memoized_select_entities�dp_statement_hint_list�dp_unknown_structure�dp_dml_ordered_values�
dp_dml_values�dp_dml_multi_values�dp_propagate_attrs�	dp_ignore�dp_inspectable�dp_multi�
dp_multi_list�dp_has_cache_key_tuples�dp_inspectable_listr0r7r5r*r*�s���%�N��/� ��8���<�04�-�	�$���
!���"���!��"�� $��K��I���N�"��L���J���K���G���M����,�#'� ��
 ���
����L�� ������
���
��"&��!��� ���%��+��M��
#���
��)���I���N�%��H���M�'�#���
��r7r*c�p�eZdZUdZdZded<dZded<ejd�dd	�					dd
��Z	y)
�HasTraverseInternalsa�base for classes that have a "traverse internals" element,
    which defines all kinds of ways of traversing the elements of an object.

    Compared to :class:`.Visitable`, which relies upon an external visitor to
    define how the object is travered (i.e. the :class:`.SQLCompiler`), the
    :class:`.HasTraverseInternals` interface allows classes to define their own
    traversal, that is, what attributes are accessed and in what order.

    r0�_TraverseInternalsType�_traverse_internalsF�bool�
_is_immutablezsqlalchemy.sql.traversals��
omit_attrsc����tjj}	|j}|j
j}tjj��fd�|||d�D��S#t$rgcYSwxYw)a�Return immediate child :class:`.visitors.HasTraverseInternals`
        elements of this :class:`.visitors.HasTraverseInternals`.

        This is used for visit traversal.

        \**kw may contain flags that change the collection that is
        returned, for example to return a subset of items in order to
        cut down on larger traversals, or to return child items from a
        different context (such as schema-level collections instead of
        clause-level).

        c3�D�K�|]\}}}|�vr
|�||fi������y�wr/r0)�.0�attrname�objrOr4r�s    ��r5�	<genexpr>z4HasTraverseInternals.get_children.<locals>.<genexpr>�s:�����-
�(�#��#�t��z�)�c�o�	
��O��O�(�s� �!_generated_get_children_traversal)
r�	preloaded�sql_traversalsr�rM�
_get_children�run_generated_dispatch�	itertools�chain�
from_iterable)r2r�r4�
traversals�traverse_internals�dispatchs ``   r5�get_childrenz!HasTraverseInternals.get_children�s����"�^�^�2�2�
�	�!%�!9�!9��
�+�+�B�B�����,�,�-
�'/��(�*M�(�-
�
�	
���	��I�	�s�A1�1A?�>A?N)r��Tuple[str, ...]r4rr8zIterable[HasTraverseInternals])
r:r;r<r]r^r_r�r�preload_moduler�r0r7r5r�r��sY����I�/�/��M�4���T���4�5�/1�
�,�
�9<�
�	'�
�6�
r7r�c��eZdZdd�Zy)�_InternalTraversalDispatchTypec��yr/r0)�sr2r3s   r5r6z'_InternalTraversalDispatchType.__call__�s��r7N)r2�objectr3�HasTraversalDispatchr8rr9r0r7r5r�r��s��Lr7r�c�p�eZdZUdZdZiZded<d
d�Z								dd�Z								dd�Z							d
d�Z
y	)r�zcDefine infrastructure for classes that perform internal traversals

    .. versionadded:: 2.0

    r0z2ClassVar[Dict[Union[InternalTraversal, str], str]]�_dispatch_lookupc�.�t|}t||d�S)ztGiven a method from :class:`.HasTraversalDispatch`, return the
        corresponding method on a subclass.

        N)r��getattr)r2�visit_symbolrWs   r5r�zHasTraversalDispatch.dispatch�s��
 ��-���t�T�4�(�(r7c��	|jj|}|||�S#t$r |j|j||�}Y�1wxYwr/)rIrD�KeyError�generate_dispatch)r2�target�internal_dispatch�generate_dispatcher_name�
dispatchers     r5r�z+HasTraversalDispatch.run_generated_dispatchs_��		��)�)�2�2�3K�L�J��&�$�'�'���	�
�/�/�� � �"3�5M��J�	�s�$�&A
�A
c�D�|j||�}t|||�|Sr/)�_generate_dispatcher�setattr)r2�
target_clsr�r�r�s     r5r�z&HasTraversalDispatch.generate_dispatchs/���.�.��7�
�
�	�
�4�j�A��r7c��g}|D]5\}}|j|�}|��t|}|j||f��7ddjd�|D��zdz}d|z|zdz}	t	t
t
j|	i|��S)Nz
    return [
z, 
c3�:K�|]\}}d|�d|�d|�d����y�w)z	        (z, self.z
, visitor.�)Nr0)r�r�rVs   r5r�z<HasTraversalDispatch._generate_dispatcher.<locals>.<genexpr>1s(�����16�,��*� ��:�7�05�s�z
    ]
zdef %s(self, visitor):
�
)r�r��append�joinrr�r�_exec_code_in_env)
r2r��method_name�namesr��	visit_symrOrV�code�	meth_texts
          r5r�z)HasTraversalDispatch._generate_dispatcher$s�����#4��H�i��=�=��+�D���-�i�8�
����h�
�3�4�	$5������16���
��
�	
�0�+�=��E��L�	��*��)�)�)�R��E�
�	
r7N)r�r*r8zCallable[..., Any])r�r�r�r�r�r>r8r)r�zType[object]r�r�r�r>r8r�)r�r�r�r>r8r�)r:r;r<r]r^r�r_r�r�r�r�r0r7r5r�r��s�����I�KM��H�M�)�(��(�2�(�#&�	(�


�(�&� ��2��#&�	�

(��
�!7�
�FI�
�	'�
r7r�c���t}tD]S}|j}|jd�s�!|j	dd�}|j
}||vsJ|��|x||<||<�Uy)N�dp_�visit_)r�r*rW�
startswith�replace�value)�lookup�symrY�	visit_key�sym_names     r5�_generate_traversal_dispatchr�Cse��
�F� ���h�h���>�>�%� ����E�8�4�I��y�y�H��6�)�3�8�3�)�-6�6�F�3�K�&��*�
!r7c��eZdZUdZej
Zded<ejrd
d�Z
dd�					dd�Zdd�Zdd�					d
d�Z
y	)�ExternallyTraversibler0zMapping[Any, Any]�_annotationsc��yr/r0)r2�valuess  r5�	_annotatezExternallyTraversible._annotateZs��cr7r�c��yr/r0�r2r�r4s   r5r�z"ExternallyTraversible.get_children\s��.1r7c��t��)zclone this element��NotImplementedError)r2r4s  r5�_clonezExternallyTraversible._clone`s��!�#�#r7c��t��)atReassign internal elements to be clones of themselves.

        Called during a copy-and-traverse operation on newly
        shallow-copied elements to create a deep copy.

        The given clone function should be used, which may be applying
        additional transformations to the element (i.e. replacement
        traversal, cloned traversal, annotations).

        rrs   r5�_copy_internalsz%ExternallyTraversible._copy_internalsds
��"�#�#r7N)r�rr8r)r�r�r4rr8�Iterable[ExternallyTraversible])r4rr8r)r�r�r4rr8r\)r:r;r<r^r�
EMPTY_DICTr�r_r`rrr�rrr0r7r5r�r�Ssk���I�&*�o�o�L�#�5�
���A�46�	2�!0�	2�=@�	2�
,�	2�$�
02�
$�,�
$�9<�
$�	
�
$r7r��_ET)�bound�_CEzColumnElement[Any]c��eZdZdd�Zy)�_CloneCallableTypec��yr/r0�r2�elementr4s   r5r6z_CloneCallableType.__call__|s��r7N)rrr4rr8rr9r0r7r5rr{s��;r7rc��eZdZdd�Zy)�_TraverseTransformCallableTypec��yr/r0rs   r5r6z'_TraverseTransformCallableType.__call__�s��#r7N)rrr4rr8z
Optional[_ET]r9r0r7r5rrs��Er7r�_ExtTr)c��eZdZUdZdZiZded<ded<dd�Z				dd�Ze	dd	��Z
e					dd
��Z
				dd�Z
		dd�Zedd
��Z
dd�Zy)r)z�Base class for visitor objects which can traverse externally using
    the :func:`.visitors.traverse` function.

    Direct usage of the :func:`.visitors.traverse` function is usually
    preferred.

    )�
_visitor_dict�_nextzDict[str, Any]�__traverse_options__zOptional[ExternalTraversal]rc�t�|jD])}t|d|jzd�}|s� ||fi|��cSy)NrK)�visitor_iteratorr�r?)r2r�r4�vrOs     r5�traverse_singlez!ExternalTraversal.traverse_single�s<���&�&�A��1�j�3�+=�+=�=�t�D�D���C��2��&�'r7c�.�t||j�S)zaTraverse the given expression structure, returning an iterator
        of all elements.

        )r#r�r2r�s  r5r#zExternalTraversal.iterate�s���s�D�5�5�6�6r7c��yr/r0r s  r5r%zExternalTraversal.traverse����47r7c��yr/r0r s  r5r%zExternalTraversal.traverse����!$r7c�D�t||j|j�S��2Traverse and visit the given expression structure.)r%rrr s  r5r%zExternalTraversal.traverse�s��
��T�6�6��8J�8J�K�Kr7c�r�i}t|�D]&}|jd�s�t||�||dd<�(|S)Nr��)�dirr�r�)r2�visitorsrWs   r5�_memoized_attr__visitor_dictz.ExternalTraversal._memoized_attr__visitor_dict�sA������I�D����x�(�%,�T�4�%8���a�b��"���r7c#�>K�|}|r|��t|dd�}|r�yy�w)z8Iterate through this visitor and each 'chained' visitor.rN)r�)r2rs  r5rz"ExternalTraversal.visitor_iterator�s(����*.����G���7�D�)�A��s��c�D�t|j�d}||_|S)z�'Chain' an additional ExternalTraversal onto this ExternalTraversal

        The chained visitor will receive all visit events after this one.

        ���)�listrr)r2r3�tails   r5r�zExternalTraversal.chain�s%���D�)�)�*�2�.����
��r7N)r�r(r4rr8r)r��Optional[ExternallyTraversible]r8�Iterator[ExternallyTraversible]�r��
Literal[None]r8r\�r�r�r8r��r�r2r8r2)r8z%Dict[str, _TraverseCallableType[Any]])r8zIterator[ExternalTraversal])r2rr3r)r8r)r:r;r<r]r^rr_rr#rr%r,�propertyrr�r0r7r5r)r)�s����+�I�+-��.�-�&�&�'�7�2�7�	(�7��7��7�
�$�(�$�	�$��$�L�2�L�	(�L��	.���*��*�r7c�`�eZdZdZdZ				dd�Zed	d��Ze				d
d��Z				dd�Zy)�CloningExternalTraversalz�Base class for visitor objects which can traverse using
    the :func:`.visitors.cloned_traverse` function.

    Direct usage of the :func:`.visitors.cloned_traverse` function is usually
    preferred.


    r0c�J�|D�cgc]}|j|���c}Scc}w)z`Apply cloned traversal to the given list of elements, and return
        the new list.

        )r%)r2�list_�xs   r5�copy_and_processz)CloningExternalTraversal.copy_and_process�s%��+0�0�%�Q��
�
�a� �%�0�0��0s� c��yr/r0r s  r5r%z!CloningExternalTraversal.traverse�r"r7c��yr/r0r s  r5r%z!CloningExternalTraversal.traverse�r$r7c�D�t||j|j�Sr&)r&rrr s  r5r%z!CloningExternalTraversal.traverse�s$��
���*�*�D�,>�,>�
�	
r7N)r<�List[ExternallyTraversible]r8rBr4r6r7)r:r;r<r]r^r>rr%r0r7r5r:r:�sj����I�1�0�1�	$�1��7��7�
�$�(�$�	�$��$�
�2�
�	(�
r7r:c�`�eZdZdZdZ				dd�Zed	d��Ze				d
d��Z				dd�Zy)�ReplacingExternalTraversalz�Base class for visitor objects which can traverse using
    the :func:`.visitors.replacement_traverse` function.

    Direct usage of the :func:`.visitors.replacement_traverse` function is
    usually preferred.

    r0c��y)aReceive pre-copied elements during a cloning traversal.

        If the method returns a new element, the element is used
        instead of creating a simple copy of the element.  Traversal
        will halt on the newly returned element if it is re-encountered.
        Nr0)r2�elems  r5r�z"ReplacingExternalTraversal.replaces��r7c��yr/r0r s  r5r%z#ReplacingExternalTraversal.traverse
r"r7c��yr/r0r s  r5r%z#ReplacingExternalTraversal.traverser$r7c�J��						d�fd�}t|�j|�S)r'c�r���jD]'}tt|�j|�}|��%|cSyr/)rrrDr�)rr4r�er2s    �r5r�z4ReplacingExternalTraversal.traverse.<locals>.replaces<����*�*���3�Q�7�?�?��H���=��H�+�
r7)rr�r4rr8r2)r'r)r2r�r�s`  r5r%z#ReplacingExternalTraversal.traverses9���
		�*�		��		�-�		�$�C��)B�)B�G�L�Lr7N)rFr�r8r2r4r6r7)r:r;r<r]r^r�rr%r0r7r5rDrD�sm����I�	�)�	�	(�	��7��7�
�$�(�$�	�$��$�M�2�M�	(�Mr7rDc#��K�|�y|��|jdi|��}|syt|g�}|r@|j�}|D]'}|��|j|jdi|����)|r�?yy�w)aHTraverse the given expression structure, returning an iterator.

    Traversal is configured to be breadth-first.

    The central API feature used by the :func:`.visitors.iterate`
    function is the
    :meth:`_expression.ClauseElement.get_children` method of
    :class:`_expression.ClauseElement` objects.  This method should return all
    the :class:`_expression.ClauseElement` objects which are associated with a
    particular :class:`_expression.ClauseElement` object. For example, a
    :class:`.Case` structure will refer to a series of
    :class:`_expression.ColumnElement` objects within its "whens" and "else\_"
    member variables.

    :param obj: :class:`_expression.ClauseElement` structure to be traversed

    :param opts: dictionary of iteration options.   This dictionary is usually
     empty in modern usage.

    Nr0)r�r�popleftr�)r��opts�children�stack�
t_iterator�ts      r5r#r#0sx����0�{��

�I��s���'�$�'�H����8�*��E�
��]�]�_�
��A��G��L�L�����/�$�/�0���s�A)A.�,A.c��yr/r0��iteratorr�r+s   r5r$r$Y���
r7c��yr/r0rTs   r5r$r$a���
 r7c�b�|D])}|j|jd�}|s�"||��+|S)a�Visit the given expression structure using the given iterator of
    objects.

    :func:`.visitors.traverse_using` is usually called internally as the result
    of the :func:`.visitors.traverse` function.

    :param iterator: an iterable or sequence which will yield
     :class:`_expression.ClauseElement`
     structures; the iterator is assumed to be the
     product of the :func:`.visitors.iterate` function.

    :param obj: the :class:`_expression.ClauseElement`
     that was used as the target of the
     :func:`.iterate` function.

    :param visitors: dictionary of visit functions.  See :func:`.traverse`
     for details on this dictionary.

    .. seealso::

        :func:`.traverse`


    N)�getr?)rUr�r+r�rOs     r5r$r$is5��:���|�|�F�1�1�4�8�����L���Jr7c��yr/r0�r�rNr+s   r5r%r%�rVr7c��yr/r0r\s   r5r%r%�rXr7c�0�tt||�||�S)aTraverse and visit the given expression structure using the default
    iterator.

     e.g.::

        from sqlalchemy.sql import visitors

        stmt = select(some_table).where(some_table.c.foo == "bar")


        def visit_bindparam(bind_param):
            print("found bound value: %s" % bind_param.value)


        visitors.traverse(stmt, {}, {"bindparam": visit_bindparam})

    The iteration of objects uses the :func:`.visitors.iterate` function,
    which does a breadth-first traversal using a stack.

    :param obj: :class:`_expression.ClauseElement` structure to be traversed

    :param opts: dictionary of iteration options.   This dictionary is usually
     empty in modern usage.

    :param visitors: dictionary of visit functions.   The dictionary should
     have strings as keys, each of which would correspond to the
     ``__visit_name__`` of a particular kind of SQL expression object, and
     callable functions  as values, each of which represents a visitor function
     for that kind of object.

    )r$r#r\s   r5r%r%�s��H�'�#�t�,�c�8�<�<r7c��yr/r0r\s   r5r&r&�rVr7c��yr/r0r\s   r5r&r&����
r7c�������i�t�jdg���				d��fd�}d����fd��|��|fd|i���}d�|S)aClone the given expression structure, allowing modifications by
    visitors for mutable objects.

    Traversal usage is the same as that of :func:`.visitors.traverse`.
    The visitor functions present in the ``visitors`` dictionary may also
    modify the internals of the given structure as the traversal proceeds.

    The :func:`.cloned_traverse` function does **not** provide objects that are
    part of the :class:`.Immutable` interface to the visit methods (this
    primarily includes :class:`.ColumnClause`, :class:`.Column`,
    :class:`.TableClause` and :class:`.Table` objects). As this traversal is
    only intended to allow in-place mutation of objects, :class:`.Immutable`
    objects are skipped. The :meth:`.Immutable._clone` method is still called
    on each object to allow for objects to replace themselves with a different
    object based on a clone of their sub-internals (e.g. a
    :class:`.ColumnClause` that clones its subquery to return a new
    :class:`.ColumnClause`).

    .. versionchanged:: 2.0  The :func:`.cloned_traverse` function omits
       objects that are part of the :class:`.Immutable` interface.

    The central API feature used by the :func:`.visitors.cloned_traverse`
    and :func:`.visitors.replacement_traverse` functions, in addition to the
    :meth:`_expression.ClauseElement.get_children`
    function that is used to achieve
    the iteration, is the :meth:`_expression.ClauseElement._copy_internals`
    method.
    For a :class:`_expression.ClauseElement`
    structure to support cloning and replacement
    traversals correctly, it needs to be able to pass a cloning function into
    its internal members in order to make copies of them.

    .. seealso::

        :func:`.visitors.traverse`

        :func:`.visitors.replacement_traverse`

    �stop_onc���t|���Sr/)r&r\s ��r5�deferred_copy_internalsz0cloned_traverse.<locals>.deferred_copy_internalss����s�D�(�3�3r7c���|�vr|St|��vr�d|vr2ttt|d|��}|�|�t|�<|S|jdd�i|��x�t|�<}|j
dd�i|��|js&�j|jd�}|r||��t|�S)Nr��cloner0)	�idrrr�rrr�rZr?)rFr4�newelemrOrg�clonedrcr+s    ����r5rgzcloned_traverse.<locals>.clone
s�����7�?��K��$�x�v�%���?�"� �!6�7���I��t�9L��G��*�+2��r�$�x�(�&��.9�T�[�[�-K�u�-K��-K�K��r�$�x� �7�'��'�'�:�e�:�r�:�
�)�)�#�<�<��(>�(>��E�D���W�
��"�T�(�#�#r7Nrer6�rFr�r4rr8r�)�setrZ)r�rNr+rergrjrcs `` @@@r5r&r&�so���Z02�F��$�(�(�9�b�)�*�G�4�
"�4�	�4�
$�$�<����
�)@�
�DH�
��
�E��Jr7c��yr/r0�r�rNr�s   r5r'r'3rVr7c��yr/r0rns   r5r'r';rar7c��yr/r0rns   r5r'r'CrXr7c�������i��jdg�D�chc]
}t|���c}�				d��fd�}d����fd��|��|fd|i���}d�|Scc}w)a]Clone the given expression structure, allowing element
    replacement by a given replacement function.

    This function is very similar to the :func:`.visitors.cloned_traverse`
    function, except instead of being passed a dictionary of visitors, all
    elements are unconditionally passed into the given replace function.
    The replace function then has the option to return an entirely new object
    which will replace the one given.  If it returns ``None``, then the object
    is kept in place.

    The difference in usage between :func:`.visitors.cloned_traverse` and
    :func:`.visitors.replacement_traverse` is that in the former case, an
    already-cloned object is passed to the visitor function, and the visitor
    function can then manipulate the internal state of the object.
    In the case of the latter, the visitor function should only return an
    entirely different object, or do nothing.

    The use case for :func:`.visitors.replacement_traverse` is that of
    replacing a FROM clause inside of a SQL structure with a different one,
    as is a common use case within the ORM.

    rcc���t|���Sr/)r'rns ��r5rez5replacement_traverse.<locals>.deferred_copy_internalsjs���$�C��w�7�7r7c�8��t|��vsd|jvr|S�|�}|��jt|��|St|�}|�vrCd|vr|d|�}|�|�|<|S|jdi|��x�|<}|jdd�i|���|S)N�no_replacement_traverser�rgr0)rhr��addrr)rFr4ri�id_elemrgrjr�rcs    ����r5rgz#replacement_traverse.<locals>.cloneos�����t�H���(�D�,=�,=�=��K��d�m�G��"����B�w�K�(���
�T�(���&�(� �B��"/�"�Y�-��"5��"�.�.5�F�7�O�#*�N�0;����0A�b�0A�A�F�7�O�g�+�G�+�+�>�%�>�2�>��g��&r7Nrer6rk)rZrh)r�rNr�r=rergrjrcs ``  @@@r5r'r'Ks����8�F�"�h�h�y�"�5�6�5��r�!�u�5�6�G�8�
"�8�	�8�
'�'�6����
�)@�
�DH�
��
�E��J��O7s�Ar[)r�r2rN�Mapping[str, Any]r8r3)rUr	r�r5r+�(Mapping[str, _TraverseCallableType[Any]]r8r\)rUr	r�r�r+rxr8r�)rUr	r�r2r+rxr8r2)r�r5rNrwr+rxr8r\)r�r�rNrwr+rxr8r�)r�r2rNrwr+rxr8r2)r�rrNrwr+rxr8r)r�r5rNrwr��#_TraverseTransformCallableType[Any]r8r\)r�r
rNrwr�ryr8r
)r�r�rNrwr�ryr8r�)r�r2rNrwr�ryr8r2)Nr]�
__future__r�collectionsr�enumrr�rTr`rrrr	r
rrr
rrrrrrrr�rrr�util._has_cyr�util.typingrrr�
annotationr�elementsr �_py_utilr!r"r+�sqlalchemy.cyextension.util�__all__r-r(r*r>r�r�r�r��ExtendedInternalTraversalr�r�r�rr
�_TraverseCallableTyperrr�
MemoizedSlotsr)r:rD�Traversible�
ClauseVisitor�CloningVisitor�ReplacingCloningVisitorr
r#r$r%r&r'r0r7r5�<module>r�s����
#�����
�������������� ������*�!�"���+�'�	����<�4���

��N�H�N�G�G�TP��P�f�e�C�):�$:�;�<��
�1
�1
�hM�X�M�L
�L
�^.��	7�(�8�8����$�0�)�$�B�e�0�1��
�e�/�0�� �#����-��<��<�F�X�c�]�F�	��2�3��G��*�*�G�T$
�0�$
�N.M�!9�.M�d��!�
�)��4��
#�o�o�&1�	(�&1�
�&1�%�&1�R
��-��	��7��
�	�
��
� �-� �	� �7� ��	 �
� �!�-�!�	(�!�7�!�%�	!�H
��	��
��7��
�	�
��
� �	� �
� �7� ��	 �
� �$=�	(�$=�
�$=�7�$=�%�	$=�N
��	��
��7��
�	�
��
��	��
��7��	�	�
��X�	(�X�
�X�7�X�%�	X�v
��	��
��1��
�	�
��
��	��
��1��	�	�
��
� �	� �
� �1� ��	 �
� �D�	(�D�
�D�1�D�%�	Dr7

ZeroDay Forums Mini