Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/event/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/event/__pycache__/registry.cpython-311.pyc

�

�܋f% ����dZddlmZddlZddlZddlZddlmZddlmZej	e
��Z	ej	e
��Z	d�Z
d�Zd	�Zd
�Zd�ZGd�d
e��ZdS)aJProvides managed registration services on behalf of :func:`.listen`
arguments.

By "managed registration", we mean that event listening functions and
other objects can be added to various collections in such a way that their
membership in all those collections can be revoked at once, based on
an equivalent :class:`._EventKey`.

�)�absolute_importN�)�exc)�utilc��tr	|tvrdSt�|��}|���D]I}|tvr>t|}|�|��|st�|���JdS�N)�_collection_to_key�pop�values�_key_to_collection)�ref�listener_to_key�key�dispatch_regs    �P/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/event/registry.py�_collection_gcedr5s������,>�!>�!>���(�,�,�S�1�1�O��%�%�'�'�,�,���$�$�$�-�c�2�L����S�!�!�!��
,�"�&�&�s�+�+�+��
,�,�c��|j}t|}|j}tj|j��}||vrdS|||<t
|}|||<dS)NFT)�_keyrr
�weakref�
_listen_fnr	)�	event_key�ownerrr�	owner_ref�
listen_refrs       r�_stored_in_collectionrCs_��
�.�C�%�c�*�L��	�I���Y�1�2�2�J��L� � ��u�(�L���(��3�O�"%�O�J���4rc��|j}t|}tj|j��}|j}|�|d��|st|=|tvr$t|}|�|��dSdSr)rrrr
rr
r	)rrrrrrrs       r�_removed_from_collectionrVs���
�.�C�%�c�*�L���Y�1�2�2�J��	�I����Y��%�%�%��$��s�#��&�&�&�,�Y�7�����J�'�'�'�'�'�'�&rc���|sdS|j}|j}t|}t|}|D]H}tj|��}||}t|}||vr|||ksJ�n|||<|||<�IdSr)r
r	rr)	�newowner�oldowner�elements�old_listener_to_key�new_listener_to_key�	listen_fnrrrs	         r�_stored_in_collection_multir&gs��������|�H��|�H�,�X�6��,�X�6���	.�	.�	��[��+�+�
�!�*�-��)�#�.���|�#�#���)�Z�7�7�7�7�7�%/�L��"�*-��J�'�'�	.�	.rc���|sdS|j}t|}|D]K}tj|��}||}t|}|�|d��|st|=�LdSr)r
r	rrr
)rr"rr%rrrs       r�_clearr(}s��������I�E�(��/�O��(�(�	��[��+�+�
��j�)��)�#�.�������%�%�%��	(�"�3�'��(�(rc��eZdZdZdZdd�Zed���Zd�Zd�Z	d�Z
d	�Zd
�Z	dd�Z
ed
���Zd�Zd�Zd�ZdS)�	_EventKeyz$Represent :func:`.listen` arguments.)�target�
identifier�fn�fn_key�fn_wrap�dispatch_targetNc��||_||_||_t|tj��r.t
|j��t
|j��f|_	nt
|��|_	||_
||_dSr)r+r,r-�
isinstance�types�
MethodType�id�__func__�__self__r.r/r0)�selfr+r,r-r0�_fn_wraps      r�__init__z_EventKey.__init__�sl�����$�������b�%�*�+�+�	!��R�[�/�/�2�b�k�?�?�:�D�K�K��R�&�&�D�K����.����rc�D�t|j��|j|jfSr)r5r+r,r.�r8s rrz_EventKey._key�s���4�;�����$�+�>�>rc�h�||jur|St|j|j|j|j|���S�N)r9)rr*r+r,r-r0)r8r/s  r�with_wrapperz_EventKey.with_wrapper�sC���d�o�%�%��K���������$� ����
rc�h�||jur|St|j|j|j||j���Sr>)r0r*r+r,r-r/)r8r0s  r�with_dispatch_targetz_EventKey.with_dispatch_target�sC���d�2�2�2��K��������������
rc�x�|�dd��}|�dd��}|�dd��}|j|j|j}}}t	|j|��}	|	�||��}
|�|
��}t	|jjj|j��}t|d��r|�
��|s|r;|�tj|j|�����j
|i|��dS|jjj|g|�Ri|��dS)N�onceF�_once_unless_exception�named�_sa_warn)�retry_on_exception)r
r0r,r�getattr�dispatch�_adjust_fn_specr?�_events�hasattrrFr�	only_once�listen�_listen)r8�args�kwrC�once_unless_exceptionrEr+r,r-�dispatch_collection�adjusted_fn�
stub_functions            rrNz_EventKey.listen�sy���v�v�f�e�$�$�� "���'?�� G� G�����w��&�&��
� ��O��O��
��&�f�o�z�B�B��)�9�9�"�e�D�D��� � ��-�-���� �)�1�4�?�
�
�
��=�*�-�-�	%��"�"�$�$�$��	E�(�	E�
�D������O�8M����
�
��d�	
"�!�	
"�
"�
"�
"�
"�
2�D� �)�1�$�D��D�D�D��D�D�D�D�Drc	�h�|j}|tvr-tjd|j�d|j�d|j�d����t�|��}|���D]E\}}|��}|��}|�*|�(|�	|�
|�����FdS)NzNo listeners found for event z / � )rrr�InvalidRequestErrorr+r,r-r
�items�remover?)r8rr�collection_ref�listener_ref�
collection�listener_fns       rrZz_EventKey.remove�s����i���(�(�(��)�)��;�;�;���������:���
�*�-�-�c�2�2��,8�,>�,>�,@�,@�	B�	B�(�N�L�'��)�)�J�&�,�.�.�K��%�+�*A��!�!�$�"3�"3�K�"@�"@�A�A�A��		B�	Brc��|jtvS)z6Return True if this event key is registered to listen.)rrr<s r�containsz_EventKey.contains�s���y�.�.�.rFc��|j|j}}t|j|��}|r0|�|j���||��dS|�|j���||��dSr)r0r,rHrI�
for_modify�insert�append)r8�	propagatercrE�retvalr+r,rSs        r�base_listenz_EventKey.base_listen�s���"�1�4�?�
��%�f�o�z�B�B���	��*�*�6�?�;�;�B�B��i�
�
�
�
�
�
 �*�*�6�?�;�;�B�B��i�
�
�
�
�
rc��|jp|jSr)r/r-r<s rrz_EventKey._listen_fns���|�&�t�w�&rc�^�t||��r|�|j��dSdS�NTF)rrdr�r8r�list_s   r�append_to_listz_EventKey.append_to_list	s2�� ��u�-�-�	��L�L���)�)�)��4��5rc�Z�t||��|�|j��dSr)rrZrrks   r�remove_from_listz_EventKey.remove_from_lists,�� ��u�-�-�-�
���T�_�%�%�%�%�%rc�^�t||��r|�|j��dSdSrj)r�
appendleftrrks   r�prepend_to_listz_EventKey.prepend_to_lists4�� ��u�-�-�	����T�_�-�-�-��4��5rr)FFFN)�__name__�
__module__�__qualname__�__doc__�	__slots__r:�propertyrr?rArNrZr`rgrrmrorr�rrr*r*�s������.�.��I�	/�	/�	/�	/��?�?��X�?�
�
�
�
�
�
�E�E�E�@B�B�B� /�/�/�
BF�����"�'�'��X�'����&�&�&�����rr*)rv�
__future__r�collectionsr3r�rr�defaultdict�dictrr	rrrr&r(�objectr*ryrr�<module>r�s"����'�&�&�&�&�&�������������������������-�[�,�T�2�2��	�-�[�,�T�2�2��	�,�,�,����&(�(�(�".�.�.�,
(�
(�
(� L�L�L�L�L��L�L�L�L�Lr

Hacked By AnonymousFox1.0, Coded By AnonymousFox