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__/annotation.cpython-311.pyc

�

�܋fE��d�dZddlmZddlmZGd�de��ZiZd
d�Zd
d	�Zd
�Z	d�Z
d�ZdS)z�The :class:`.Annotated` class and related routines; creates hash-equivalent
copies of SQL constructs which contain context-specific markers and
associations.

�)�	operators�)�utilc�f�eZdZdZd�Zd�Zd�Zd�Zdd�Zd	�Z	e
d
���Zd�Zd�Z
d
�Zd�ZdS)�	AnnotatedaEclones a ClauseElement and applies an 'annotations' dictionary.

    Unlike regular clones, this clone also mimics __hash__() and
    __cmp__() of the original element so that it takes its place
    in hashed collections.

    A reference to the original element is maintained, for the important
    reason of keeping its hash value current.  When GC'ed, the
    hash value may be reused, causing conflicts.

    .. note::  The rationale for Annotated producing a brand new class,
       rather than placing the functionality directly within ClauseElement,
       is **performance**.  The __hash__() method is absent on plain
       ClauseElement which leads to significantly reduced function call
       overhead, as the use of sets and dictionaries against ClauseElement
       objects is prevalent, but most are not "annotated".

    c���|st�|��S|\}}	t|j}n%#t$rt|j|��}YnwxYwt�|��S�N)�object�__new__�annotated_classes�	__class__�KeyError�_new_annotation_type)�cls�args�element�valuess    �P/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/sql/annotation.pyrzAnnotated.__new__&s����	'��>�>�#�&�&�&�"�O�G�V�
C�'��(9�:�����
C�
C�
C�*�7�+<�c�B�B����
C�����>�>�#�&�&�&s�6�A�Ac��|j���|_||_||_t	|��|_dSr	)�__dict__�copy�_Annotated__element�_annotations�hash�_hash)�selfrrs   r�__init__zAnnotated.__init__4s8���(�-�-�/�/��
� ���"����'�]�]��
�
�
�c��|j���}|�|��|�|��Sr	)rr�update�_with_annotations)rr�_valuess   r�	_annotatezAnnotated._annotate:s<���#�(�(�*�*�����v�����%�%�g�.�.�.rc��|j�|j��}|j���|_||_|Sr	)r
rrrr)rr�clones   rr!zAnnotated._with_annotations?s;����&�&�t�~�6�6����+�+�-�-���#����rNTc��|�|jS|j���}|D]}|�|d���|�|��Sr	)rrr�popr!)rrr%r"�vs     r�_deannotatezAnnotated._deannotateEs]���>��>�!��'�,�,�.�.�G��
%�
%�����A�t�$�$�$�$��)�)�'�2�2�2rc�4�|jjj||fi|��Sr	)rr
�_compiler_dispatch)r�visitor�kws   rr+zAnnotated._compiler_dispatchNs$��:�t�~�'�:�4��O�O�B�O�O�Orc��|jjSr	)r�_constructor�rs rr/zAnnotated._constructorQs
���~�*�*rc��|j���}||jur|S|j�|j��|�||j��Sr	)r�_clonerr r
r)rr%s  rr2zAnnotated._cloneUsX����%�%�'�'���D�N�"�"��K�
�N�!�!�$�-�0�0�0��>�>�%��):�;�;�;rc�,�|j|j|jffSr	)r
rrr0s r�
__reduce__zAnnotated.__reduce__`s���~����0A�B�B�Brc��|jSr	)rr0s r�__hash__zAnnotated.__hash__cs
���z�rc��t|jtj��r |jj�||��St
|��t
|��kSr	)�
isinstancerr�ColumnOperatorsr
�__eq__r)r�others  rr:zAnnotated.__eq__fsK���d�n�i�&?�@�@�	-��>�+�2�2�4��?�?�?���;�;�$�t�*�*�,�,r)NT)�__name__�
__module__�__qualname__�__doc__rrr#r!r)r+�propertyr/r2r4r6r:�rrrrs���������&'�'�'�#�#�#�/�/�/�
���3�3�3�3�P�P�P��+�+��X�+�	<�	<�	<�C�C�C����-�-�-�-�-rrNc�8�������fd��|��|��}d�|S)z�Deep copy the given ClauseElement, annotating each element
    with the given annotations dictionary.

    Elements within the exclude collection will be cloned but not annotated.

    c����r?t|d��r/|j����r|���}n#�|jkr|����}n|}|�����|S)N�	proxy_set�r%)�hasattrrD�intersectionr2rr#�_copy_internals)�elem�newelem�annotationsr%�excludes  ���rr%z_deep_annotate.<locals>.clone{s�����		���k�*�*�		���+�+�G�4�4�		�
�k�k�m�m�G�G�
�D�-�
-�
-��n�n�[�1�1�G�G��G����e��,�,�,��rNrA)rrKrLr%s ``@r�_deep_annotaterMssG���������������%��.�.���E��Nrc�^����tj������fd��|��|��}d�|S)z2Deep copy the given element, removing annotations.c����s|�vr6|��d���}|������s|�|<|S�|S)NT)rr%rE)r)rH)rIrJr%�clonedrs  ���rr%z_deep_deannotate.<locals>.clone�sf����	 �T��'�'��&�&�f�D�&�A�A�G��#�#�%�#�0�0�0��
'�&��t���N��$�<�rN)r�column_dict)rrr%rPs `@@r�_deep_deannotaterR�sW������
�
�
�F� � � � � � � � ���%��.�.���E��Nrc�X�|�|��}|���|S)aAnnotate the given ClauseElement and copy its internals so that
    internal objects refer to the new annotated object.

    Basically used to apply a "dont traverse" annotation to a
    selectable, without digging throughout the whole
    structure wasting time.
    )r#rH)rrKs  r�_shallow_annotaterT�s.������,�,�G��������Nrc� �t|t��r|S|tvr
t|S|jD]}|tvrt|}n�t	d|jz||fi��xt|<}|t
��d|jz<|S)NzAnnotated%s)�
issubclassrr�__mro__�typer<�globals)r�base_cls�super_�anno_clss    rrr�s����#�y�!�!�&��
�	�!�	!�	!� ��%�%��+�����&�&�&�(��0�H��E�'�)-����$�x��o�r�)�)���c��X�/7�G�I�I�m�c�l�*�+��Orc��|g}|rO|���}|�|�����t||��|�MdSdSr	)r'�extend�__subclasses__r)�target_hierarchyrZ�stackrs    r�_prepare_annotationsrb�sk��
��E�
�,��i�i�k�k��
���S�'�'�)�)�*�*�*��S�(�+�+�+�	�,�,�,�,�,rr	)r?�rrr
rrrMrRrTrrbrArr�<module>rds�����������������X-�X-�X-�X-�X-��X-�X-�X-�|������8����6
�
�
����*,�,�,�,�,r

Hacked By AnonymousFox1.0, Coded By AnonymousFox