OwlCyberSecurity - MANAGER
Edit File: annotation.cpython-312.pyc
� ����_��gEG��������������������������U�d�Z�ddlmZ�ddlZddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�dd lm Z �dd lm Z �ddlmZ�ddlmZ�dd lm Z �ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�erddlmZ�ddlmZ�e e ef���Z!ejD������������������Z#de$d<����G�d��d e�������Z%�G�d!��d"e%�������Z&�G�d#��d$e&�������Z'�G�d%��d&e%�������Z(i�Z)d'e$d(<����ed)d �*�������Z*d5d+�Z+ �d6d,d,dd-� � � � � � � � � � � � � �d7d.�Z,e �d6 � � � � �d8d/���������Z-e �d6 � � � � �d9d0���������Z- �d6 � � � � �d:d1�Z-d;d2�Z. � � � � � �d<d3�Z/ � � � � � �d=d4�Z0y)>a*��The :class:`.Annotated` class and related routines; creates hash-equivalent copies of SQL constructs which contain context-specific markers and associations. Note that the :class:`.Annotated` concept as implemented in this module is not related in any way to the pep-593 concept of "Annotated". �����)�annotationsN)�Any)�Callable)�cast)�Dict)� FrozenSet)�Mapping)�Optional)�overload)�Sequence)�Tuple)�Type)� TYPE_CHECKING)�TypeVar����)� operators)�HasCacheKey)�anon_map)�ExternallyTraversible)�InternalTraversal����)�util)�Literal)�Self)�_EntityNamespace)�_TraverseInternalsType�util.immutabledict[str, Any]�EMPTY_ANNOTATIONSc�������������������������e�Zd�ZU�dZeZded<���ded<���ded<���dd�Ze � �d � � � � �dd ���������Z e � �d � � � � �dd ���������Z � �d � � � � �dd�Z e j������������������dd ���������Z � � � �dd�Z y)�SupportsAnnotations��r����_annotationsz*util.generic_fn_descriptor[FrozenSet[Any]]� proxy_set�bool� _is_immutablec����������������������t������������������N��NotImplementedError��self�valuess��� �J/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/annotation.py� _annotatezSupportsAnnotations._annotate>���s������!�#�#�����c�����������������������y�r'���r!����r+���r,����clones��� r-����_deannotatezSupportsAnnotations._deannotateA���������� �r/���c�����������������������y�r'���r!���r1���s��� r-���r3���zSupportsAnnotations._deannotateH���������� �"r/���Nc����������������������t�����������������r'���r(���r1���s��� r-���r3���zSupportsAnnotations._deannotateO���s ������ �"�#�#r/���c�����������������8�����t����������������}|�j������������������|�������S�r'���)r����_gen_annotations_cache_key)r+���� anon_map_s��� r-����_annotations_cache_keyz*SupportsAnnotations._annotations_cache_keyV���s�������J� ��.�.�y�9�9r/���c����������� ������������dt���������fd�t��������|�j�������������������������D��cg�c]��}||�j������������������|���f���c}D����������������fS�c�c}w�)Nr"���c��������������3���p����K����|�]-��\��}}|t��������|t���������������r|j�������������������g��������n|f����/�y��wr'���)� isinstancer����_gen_cache_key)�.0�key�valuer���s��� �r-���� <genexpr>zASupportsAnnotations._gen_annotations_cache_key.<locals>.<genexpr>a���sG����������� �#�J�C�����&�e�[�9���,�,�X�r�:�"��#�s����36)�tuple�sortedr"���)r+���r���rA���s��� ` r-���r9���z.SupportsAnnotations._gen_annotations_cache_key\���sa�������� ��� �� &�d�&7�&7�8�#�8����$�+�+�C�0�1�8�#� �� � �� ��#s����A�r,����_AnnotationDict�returnr����..�r,���� Literal[None]r2���r$���rH���r����r,���� Sequence[str]r2���r$���rH���r ����NF�r,����Optional[Sequence[str]]r2���r$���rH���r ���)rH����Tuple[Any, ...])r���r���rH���rQ���)�__name__� __module__�__qualname__� __slots__r���r"����__annotations__r.���r���r3���r����memoized_propertyr;���r9���r!���r/���r-���r ���r ���5���s��������I�1B�L�.�B�9�9���$����!$��������� � �������!$��"��"���"�� � "���"��+/��$�'�$���$�� � $�� ���:���:� � � � � r/���r ���c������������������������e�Zd�ZU�dZded<���erej������������������dd���������Zdd�Z dd�Z e � �d � � � � �dd���������Ze � �d � � � � �dd���������Z � �d � � � � �dd �Zy )�SupportsWrappingAnnotationsr!���z*Callable[..., SupportsWrappingAnnotations]�_constructorc�����������������������y�r'���r!����r+���s��� r-����entity_namespacez,SupportsWrappingAnnotations.entity_namespacey���s������8;r/���c�����������������.�����t���������j������������������|�|�������S�)�greturn a copy of this ClauseElement with annotations updated by the given dictionary. �� Annotated�_as_annotated_instancer*���s��� r-���r.���z%SupportsWrappingAnnotations._annotate|���������� ��/�/��f�=�=r/���c�����������������.�����t���������j������������������|�|�������S�)�hreturn a copy of this ClauseElement with annotations replaced by the given dictionary. r`���r*���s��� r-����_with_annotationsz-SupportsWrappingAnnotations._with_annotations����rc���r/���c�����������������������y�r'���r!���r1���s��� r-���r3���z'SupportsWrappingAnnotations._deannotate����r4���r/���c�����������������������y�r'���r!���r1���s��� r-���r3���z'SupportsWrappingAnnotations._deannotate����r6���r/���Nc�����������������.�����|r|�j��������������������������}|S�|�S�)��return a copy of this :class:`_expression.ClauseElement` with annotations removed. :param values: optional tuple of individual values to remove. )�_clone)r+���r,���r2����ss��� r-���r3���z'SupportsWrappingAnnotations._deannotate����s����������� �A��H��Kr/����rH���r���rF���rI���rJ���rL���rN���rO���) rR���rS���rT���rU���rV���r���r����ro_non_memoized_propertyr]���r.���rf���r���r3���r!���r/���r-���rY���rY���r���s��������I�<�<�� � &� &�;�� '�;�>�>����!$��������� � �������!$��"��"���"�� � "���"��+/���'������ � r/���rY���c������������������������e�Zd�ZU�ej������������������sdZdej������������������fgZde d<���dd�Z dd�Ze � �d � � � � �d d���������Z e � �d � � � � �dd���������Z � �d � � � � �dd �Z y )�SupportsCloneAnnotationsr!���r"���r����%_clone_annotations_traverse_internalsc�����������������������|�j��������������������������}|j������������������j������������������|�������|_��������|j������������������j ������������������dd��������|j������������������j ������������������dd��������|S�)r_���r;���N�_generate_cache_key)rk���r"����union�__dict__�pop�r+���r,����news��� r-���r.���z"SupportsCloneAnnotations._annotate����sW������ ��k�k�m���+�+�1�1�&�9��������1�4�8������.��5�� r/���c�����������������������|�j��������������������������}t��������j������������������|�������|_��������|j������������������j������������������dd��������|j������������������j������������������dd��������|S�)re���r;���Nrs���)rk���r���� immutabledictr"���ru���rv���rw���s��� r-���rf���z*SupportsCloneAnnotations._with_annotations����sQ������ ��k�k�m���-�-�f�5��������1�4�8������.��5�� r/���c�����������������������y�r'���r!���r1���s��� r-���r3���z$SupportsCloneAnnotations._deannotate����r4���r/���c�����������������������y�r'���r!���r1���s��� r-���r3���z$SupportsCloneAnnotations._deannotate����r6���r/���Nc����������������������|s|�j�������������������rG|�j��������������������������}t��������j��������������������������|_���������|j������������������j������������������dd��������|S�|�S�)rj���r;���N)r"���rk���r���rz���ru���rv���)r+���r,���r2���rx���s��� r-���r3���z$SupportsCloneAnnotations._deannotate����sL��������D�%�%���+�+�-�C�#�1�1�3�C���L�L���5�t�<��J��Kr/���rF���rI���rJ���rL���rN���rO���)rR���rS���rT����typingr���rU���r����dp_annotations_keyrq���rV���r.���rf���r���r3���r!���r/���r-���rp���rp�������s������������ �� �*�=�=�>�E�)�+A��� � ����!$��������� � �������!$��"��"���"�� � "���"��+/���'������ � r/���rp���c�������������������L����e�Zd�ZU�dZdZe � � � � � �dd���������Zded<���ded<���ded <���dd �Z � � � �dd�Z dd�Z dd �Ze � �d � � � � �dd���������Z e � �d � � � � �dd���������Z � �d � � � � �d!d�Z ej������������������sd"d�Zed����������Zd#d�Zd$d�Zd%d�Zd&d�Zej0������������������d'd���������Zy)(ra���aJ��clones a SupportsAnnotations and applies an 'annotations' dictionary. Unlike regular clones, this clone also mimics __hash__() and __eq__() 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". FrY���c���������������������� �t���������|j���������������������}��|�||�������S�#�t��������$�r�t��������|j������������������|��������}�Y��*w�xY�wr'���)�annotated_classes� __class__�KeyError�_new_annotation_type)�cls�elementr,���s��� r-���rb���z Annotated._as_annotated_instance ��sI������ ?�#�G�$5�$5�6�C���7�F�#�#����� ?�&�w�'8�'8�#�>�C� ?�s������A��A�r���r"����_Annotated__element�int�_hashc�����������������,�����t���������j������������������|��������S�r'���)�object�__new__)r�����argss��� r-���r����zAnnotated.__new__��s�������~�~�c�"�"r/���c���������������������|j�������������������j��������������������������|�_���������|�j�������������������j������������������dd���������|�j�������������������j������������������dd���������||�_��������t ��������j ������������������|�������|�_��������t��������|�������|�_��������y��Nr;���rs���) ru����copyrv���r����r���rz���r"����hashr����)r+���r����r,���s��� r-����__init__zAnnotated.__init__��si������� �(�(�-�-�/�� �� � ���2�D�9�� � ���/��6� ��� �.�.�v�6����'�]�� r/���c�����������������^�����|�j�������������������j������������������|�������}|�j������������������|�������}|S�r'���)r"���rt���rf���)r+���r,����_valuesrx���s��� r-���r.���zAnnotated._annotate(��s-�������#�#�)�)�&�1���$�$�W�-��� r/���c�����������������2����|�j�������������������j������������������|�j��������������������������}|�j������������������j��������������������������|_��������|j������������������j ������������������dd���������|j������������������j ������������������dd���������t��������j������������������|�������|_��������|S�r����)r����r����ru���r����rv���r���rz���r"���r1���s��� r-���rf���zAnnotated._with_annotations-��sp���������&�&�t�~�~�6�����+�+�-��� �����3�T�:� �����0�$�7�!�/�/��7����r/���c�����������������������y�r'���r!���r1���s��� r-���r3���zAnnotated._deannotate5��r4���r/���c�����������������������y�r'���r!���r1���s��� r-���r3���zAnnotated._deannotate<��s������ �r/���Nc����������� ������������|�|�j�������������������S�|�j������������������t��������j������������������|�j������������������j��������������������������D���ci�c]��\��}}||vr||���c}}��������������S�c�c}}w�r'���)r����rf���r���rz���r"����items)r+���r,���r2���rA���rB���s��� r-���r3���zAnnotated._deannotateC��su������ ��>��>�>�!��)�)��"�"��+/�*;�*;�*A�*A�*C��*C�J�C���f�,���U� �*C����� ��s����A#c�����������������R������|�j�������������������j������������������j������������������|�|fi�|��S�r'���)r����r�����_compiler_dispatch)r+����visitor�kws��� r-���r����zAnnotated._compiler_dispatchW��s.������>�4�>�>�+�+�>�>��g��!#��� r/���c�����������������.�����|�j�������������������j������������������S�r'���)r����rZ���r\���s��� r-���rZ���zAnnotated._constructor\��s�������>�>�.�.�.r/���c������������������������|�j�������������������j������������������di�|��}||�j�������������������u�r|�S�|j������������������j������������������|�j��������������������������|�j ������������������||�j �������������������������S�)Nr!���)r����rk���ru����updater����r"���)r+���r����r2���s��� r-���rk���zAnnotated._clone`��s[������%����%�%�+��+���D�N�N�"��K�� �N�N�!�!�$�-�-�0��>�>�%��):�):�;�;r/���c�����������������J�����|�j�������������������|�j������������������|�j������������������ffS�r'���)r����r����r"���r\���s��� r-���� __reduce__zAnnotated.__reduce__k��s �������~�~�����0A�0A�B�B�Br/���c����������������������|�j�������������������S�r'���)r����r\���s��� r-����__hash__zAnnotated.__hash__n��s�������z�z�r/���c����������������������|�j�������������������r&|�j������������������j������������������j������������������|�|�������S�t ��������|�������t ��������|��������k(��S�r'���)�_is_column_operatorsr����r�����__eq__r����)r+����others��� r-���r����zAnnotated.__eq__q��s;�������$�$��>�>�+�+�2�2�4��?�?���;�$�t�*�,�,r/���c����������������������d|�j�������������������v�r't��������t��������|�j�������������������d����������j������������������S�|�j������������������j������������������S�)Nr]���)r"���r���rY���r]���r����r\���s��� r-���r]���zAnnotated.entity_namespacew��sI��������!2�!2�2��+��!�!�"4�5����� � ��>�>�2�2�2r/���)r����rY���r,���rG���rH���ra���)r����z Type[Self]r����r���rH���r���)r����rY���r,���rG���rF���rI���rJ���)r,���rM���r2���r$���rH���ra���)NTrO���)r����r���r����r���rH���r���)r����r���rH���r���)rH���z'Tuple[Type[Annotated], Tuple[Any, ...]])rH���r����)r����r���rH���r$���rm���)rR���rS���rT����__doc__r�����classmethodrb���rV���r����r����r.���rf���r���r3���r~���r���r�����propertyrZ���rk���r����r����r����r���rn���r]���r!���r/���r-���ra���ra�������s\������&�!���$�1�$�;J�$� �$���$��/�.�*�*��J�#�#�2�#�<K�#�� ����!$��������� � �������!$��������� � �����+/���'������ � �$���� � � � /�� � /� <�C��-�� �"�"�3��#�3r/���ra���z8Dict[Type[SupportsWrappingAnnotations], Type[Annotated]]r�����_SA)�boundc�����������������N����� �|�j�������������������}�||�������S�#�t��������$�r�|�cY�S�w�xY�wr'���)r.����AttributeError)�to_annotater���r.���s��� r-����_safe_annotater�������s8������&��)�)� ����%�%�� ������� �s������$�$F)�detect_subquery_cols�ind_cols_on_fromclause�annotate_callablec����������������d������������i��d�������fd��|��t��������t����������|���������������}�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����������������������� |d<���t��������|��������}|�v�r�|���S�� r<t��������|�d�������r0|�j������������������j������������������� �������r�|�j������������������dd�i|��}nO�|�j ������������������k7��r>� r!|�j������������������r�|�j������������������dd�i|��}n|�}�r ��|��������}nt��������|��������}n|�}|j�����������������������������|�|<���|S�)Nr����r#���r2���)r2���r����r!���) �id�hasattrr#����intersectionrk���r"���r%���r�����_copy_internals)�elemr�����id_�newelemr����r����r���r2���� cloned_idsr�����excluder����s��� �������r-���r2���z_deep_annotate.<locals>.clone���s���������&:��!�"���h���*���c�?�"�� ���k�*����+�+�G�4�!�d�k�k�4��4��4�G� �D�-�-� -�#��(:�(:�)�d�k�k�<��<��<��"�� �+�K��E��(��k�B���G�����0F�� �� ��"� �3���r/���N�r����r ���r����r���rH���r ����r���r����)r����r���r����r����r����r����r2���r����s��� `````@@r-����_deep_annotater�������s7�������*�24�J�'��'�R����s�E�'�N�+���E��Nr/���c�����������������������y�r'���r!����r����r,���s��� r-����_deep_deannotater�������s�������r/���c�����������������������y�r'���r!���r����s��� r-���r����r�������s�������r/���c�����������������T��������i��d���fd��|��t��������t����������|���������������}�d�|�S�)z2Deep copy the given element, removing annotations.c������������������������rt��������|��������}n|�}|�vr,|�j�������������������d��������}|j����������������������������|�|<���|S��|���S�)NT)r,���r2���)r2���)r����r3���r����)r����r����rA���r����r2����clonedr,���s��� ���r-���r2���z_deep_deannotate.<locals>.clone���sZ���������T�(�C��C��f���&�&�f�D�&�A�G��#�#�%�#�0�!�F�3�K��N��#�;�r/���Nr����r����)r����r,���r2���r����s��� `@@r-���r����r�������s1������� �.0�F� �����s�E�'�N�+���E��Nr/���c�����������������H�����|�j������������������|�������}�|�j���������������������������|�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 "don't traverse" annotation to a selectable, without digging throughout the whole structure wasting time. )r.���r����)r����r���s��� r-����_shallow_annotater������s%�����������,�G������Nr/���c���������������������t��������|�t���������������r|�S�|�t��������v�r t��������|����S�|�j������������������D�]��}|t��������v�s�t��������|���}�n�t ��������t ��������t�����������t ��������d|�j������������������z��||�fi���������������xt��������|�<���}|t����������������d|�j������������������z��<���d|�j������������������v�r/t��������|�j�������������������������dt��������j������������������fgz���|_��������nJ|�j������������������j������������������dd�������r.t��������|�j�������������������������dt��������j������������������fgz���|_��������|�j������������������j������������������dd�������rd|_��������n"d|�j������������������v�r|�j������������������d���|_��������t��������|�t ��������j"�������������������������|_��������|S�)z[Generates a new class that subclasses Annotated and proxies a given element type. zAnnotated%s�_traverse_internalsr"���� inherit_cacheFT)� issubclassra���r�����__mro__r���r����typerR����globalsru����listr����r���r����getr����r����ColumnOperatorsr����)r�����base_cls�super_�anno_clss��� r-���r����r������sn�������#�y�!�� � �!� !� ��%�%��+�+����&�&�(��0�H�� ���)-��Y���]�S�\�\� )�H�c�?�B�?�)����c��X��/7�G�I�m�c�l�l�*�+�����,�'+�C�,C�,C�'D� �.�A�A�B�H ��( ��$�� ��� � �/�5� 1�'+�C�,C�,C�'D� �.�A�A�B�H ��( ��$���|�|�����/�!%��� �C�L�L� (�!$���o�!>���$.�s�I�4M�4M�$N�H�!��Or/���c�����������������P�����t��������j������������������|��������D�]��}t��������||����������y�r'���)r����walk_subclassesr����)�target_hierarchyr����r����s��� r-����_prepare_annotationsr����D��s$��������#�#�$4�5���S�(�+��6r/���)r����r����r���rG���rH���r����r'���)r����r����r���rG���r����z'Optional[Sequence[SupportsAnnotations]]r����r$���r����r$���r����zOOptional[Callable[[SupportsAnnotations, _AnnotationDict], SupportsAnnotations]]rH���r����)r����rK���r,���rP���rH���rK���)r����r����r,���rP���rH���r����)r����� Optional[_SA]r,���rP���rH���r����)r����r����r���rG���rH���r����)r�����!Type[SupportsWrappingAnnotations]r�����Type[Annotated]rH���r����)r����r����r����r����rH����None)1r����� __future__r���r~���r���r���r���r���r���r ���r ���r���r���r ���r���r���r�����r���� cache_keyr����visitorsr���r���r���r����util.typingr���r����baser���r����strrG���� EMPTY_DICTr���rV���r ���rY���rp���ra���r����r����r����r����r����r����r����r����r!���r/���r-����<module>r�������s������#�� ������������������������ ������"����+��'����!����&�0��#�s�(�#��26�/�/���/��A�: �/��: �z7�"5��7�tH�:��H�VH3�#��H3�b����K�����e�0�1�� &��8<�C� �"'�#(�� �C� �C� �C��5�C� ��C��!� C��C�� �C�L� �>B�� ��$;����� �� � �48�� ��1����� ���?C�� ��$;����8 �,� *�,�6E�,��,�^,�7�,��,�� �,r/���