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

�

�܋f�&��F�dZddlmZddlZddlmZddlmZddlmZdd	lm	Z	e	j
e��Zd
�Z
Gd�de��ZGd
�de��ZGd�de��Zd�Zd�ZGd�de	jee����ZGd�de��ZGd�de��ZdS)a�Base implementation classes.

The public-facing ``Events`` serves as the base class for an event interface;
its public attributes represent different kinds of events.   These attributes
are mirrored onto a ``_Dispatch`` class, which serves as a container for
collections of listener functions.   These collections are represented both
at the class level of a particular ``_Dispatch`` class as well as within
instances of ``_Dispatch``.

�)�absolute_importN�)�_ClsLevelDispatch)�_EmptyListener)�_JoinedListener�)�utilc�d�|�d��o|dkp|�d��S)N�_�dispatch�	_sa_event)�
startswith)�names �L/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/event/base.py�_is_event_namers9��
�O�O�C� � � �7�T�Z�%7�&�	
����	%�	%�&�c��eZdZdZd�ZdS)�_UnpickleDispatchz�Serializable callable that re-generates an instance of
    :class:`_Dispatch` given a particular :class:`.Events` subclass.

    c��|jD]2}d|jvr'|jdj�|��cS�3t	d���)Nrz*No class with a 'dispatch' member present.)�__mro__�__dict__r�
_for_class�AttributeError)�self�
_instance_cls�clss   r�__call__z_UnpickleDispatch.__call__/sh�� �(�	O�	O�C��S�\�)�)��|�J�/�8�C�C�!������*�
!�!M�N�N�NrN)�__name__�
__module__�__qualname__�__doc__r�rrrr)s2��������
O�O�O�O�Orrc��eZdZdZdZej��Zdd�Zd�Z	e
d���Ze
d���Zd�Z
d	�Zd
�Zd�Zdd
�Zd�ZdS)�	_Dispatcha;Mirror the event listening definitions of an Events class with
    listener collections.

    Classes which define a "dispatch" member will return a
    non-instantiated :class:`._Dispatch` subclass when the member
    is accessed at the class level.  When the "dispatch" member is
    accessed at the instance level of its owner, an instance
    of the :class:`._Dispatch` class is returned.

    A :class:`._Dispatch` class is generated for each :class:`.Events`
    class defined, by the :func:`._create_dispatcher_class` function.
    The original :class:`.Events` classes remain untouched.
    This decouples the construction of :class:`.Events` subclasses from
    the implementation used by the event internals, and allows
    inspecting tools like Sphinx to work in an unsurprising
    way against the public API.

    )�_parentrr�_empty_listenersNc����||_�|_�rH	|j�|_dS#t$r&�fd�|jD��x|_|j�<YdSwxYwi|_dS)Nc�<��i|]}|jt|�����Sr")rr)�.0�ls�instance_clss  �r�
<dictcomp>z&_Dispatch.__init__.<locals>.<dictcomp>]s7��������G�^�B��=�=���r)r%r�_empty_listener_regr&�KeyError�_event_descriptors)r�parentr+s  `r�__init__z_Dispatch.__init__Ss�������)����	'�
�(,�(@��(N��%�%�%���
�
�
�����$�7������%��(@� �)�)�)�)�
����%'�D�!�!�!s�'�,A�Ac��	|j|}t||j|��|S#t$rt	|���wxYw�N)r&�setattrrr.r)rrr*s   r�__getattr__z_Dispatch.__getattr__dsZ��	��&�t�,�B�
�D�"�'�2�&�&�&��I��	�	'�	'�	'� ��&�&�&�	'���s	�
'�Ac#�BK�|jD]}t||��V��dSr3)�_event_names�getattr)r�ks  rr/z_Dispatch._event_descriptorsos=�����"�	#�	#�A��$��"�"�"�"�"�"�	#�	#rc��|jjSr3)�_events�_listen�rs rr<z_Dispatch._listenvs
���|�#�#rc�.�|�||��Sr3)�	__class__)rr+s  rrz_Dispatch._for_classzs���~�~�d�L�1�1�1rc�:�|j}|�|��Sr3)r?r)r�instancer+s   r�
_for_instancez_Dispatch._for_instance}s���)�����|�,�,�,rc��d|jjvr7td|jjztfd|ji��}||j_|�||��S)z�Create a 'join' of this :class:`._Dispatch` and another.

        This new dispatcher will dispatch events to both
        :class:`._Dispatch` objects.

        �_joined_dispatch_clszJoined%s�	__slots__)r?r�typer�_JoinedDispatcherr7rD)r�otherrs   r�_joinz_Dispatch._join�sc��"���)@�@�@���T�^�4�4�"�$��d�/�0���C�36�D�N�/��(�(��u�5�5�5rc�.�t��|jffSr3)rrr=s r�
__reduce__z_Dispatch.__reduce__�s�� �"�"�T�%7�$9�9�9rTc��|jD]U}t|t��r�t||j���|���||����VdS)zIPopulate from the listeners in another :class:`_Dispatch`
        object.)�only_propagateN)r/�
isinstancerr8r�
for_modify�_update)rrHrMr*s    rrPz_Dispatch._update�sv���*�	�	�B��"�n�-�-�
���D�"�'�"�"�-�-�d�3�3�;�;��>�
<�
�
�
�
�	�	rc�h�|jD])}|�|������*dSr3)r/rO�clear)rr*s  r�_clearz_Dispatch._clear�s?���)�	(�	(�B��M�M�$���%�%�'�'�'�'�	(�	(rr3)T)rrr r!rE�weakref�WeakKeyDictionaryr-r1r5�propertyr/r<rrBrIrKrPrSr"rrr$r$9s���������*K�I�3�'�3�5�5��'�'�'�'�"	�	�	��#�#��X�#��$�$��X�$�2�2�2�-�-�-�6�6�6�":�:�:�����(�(�(�(�(rr$c��eZdZdZd�ZdS)�
_EventMetazKIntercept new Event subclasses and create
    associated _Dispatch classes.c�d�t||||��t�||||��dSr3)�_create_dispatcher_classrFr1)r�	classname�bases�dict_s    rr1z_EventMeta.__init__�s4�� ��i���>�>�>��
�
�c�9�e�U�3�3�3�3�3rN)rrr r!r1r"rrrXrX�s-������%�%�4�4�4�4�4rrXc
��t|d��r
|jj}nt}d�|D��}t	d|z|fd|i��}||_|�||��}|jD]G}t||t|||����t|�
|���H|jD]i}	t|	t��rR|	turI|	j
jjD]7}
t||
j|
��|j�
|
j���8�jt!|dd��rt#|��|j_dSdS)zRCreate a :class:`._Dispatch` class corresponding to an
    :class:`.Events` class.rc�0�g|]}t|���|��Sr")r)r)r9s  r�
<listcomp>z,_create_dispatcher_class.<locals>.<listcomp>�s%��9�9�9��~�a�'8�'8�9�1�9�9�9rz
%sDispatchrE�_dispatch_targetN)�hasattrrr?r$rFr7�
_set_dispatchr4r�_registrars�append�	__bases__�
issubclassr;r/rr8�
dispatcherra)rr[r\r]�
dispatch_base�event_names�dispatch_cls�
dispatch_instr9�super_r*s           rrZrZ�sv���s�J���"���.�
�
�!�
�9�9�e�9�9�9�K���y� �=�"2�[�+�4N���L�!,�L���%�%�c�<�8�8�M�
�
&�#�#���
�q�"3�C��q��"B�"B�C�C�C��A����c�"�"�"�"��(�:�:���f�i�(�(�	:�V�9�-D�-D��n�-�@�
:�
:���
�r�w��3�3�3��)�0�0���9�9�9�9���s�&��-�-�8�(2�3�����%�%�%�8�8rc��|jjD]7}t|�|��t|st|=�8dSr3)rr7rd�remove)rr9s  r�_remove_dispatcherrp�sL��
�\�
&�����A����c�"�"�"��1�~�	��A����rc��eZdZdZed���Zed���Zed	d���Zed���Z	ed���Z
dS)
�Eventsz>Define event listening functions for a particular target type.c�>�|d��|_||_|jSr3)rr;)rrks  rrczEvents._set_dispatch�s%��$�|�D�)�)���"����|�rc�����fd�}�fd�}t�d��rW||jj��s@|t|jj��s%|t��r||jj��r�SdSdSdS)Nc�:��t�fd�|D����S)Nc3�B�K�|]}t�j|��V��dSr3)rNr)r)�t�targets  �r�	<genexpr>z;Events._accept_with.<locals>.dispatch_is.<locals>.<genexpr>�s/�����E�E�!�z�&�/�1�5�5�E�E�E�E�E�Er)�all)�typesrxs �r�dispatch_isz(Events._accept_with.<locals>.dispatch_is�s&����E�E�E�E�u�E�E�E�E�E�Erc�8��t�jj|��Sr3)rNrr0)rwrxs �r�dispatch_parent_isz/Events._accept_with.<locals>.dispatch_parent_is�s����f�o�4�a�8�8�8rr)rbrr?rFrG)rrxr|r~s `  r�_accept_withzEvents._accept_with�s����	F�	F�	F�	F�	F�	9�	9�	9�	9�	9�
�6�:�&�&�		���C�L�2�3�3�
��;�t�S�\�%;�<�<�
� �K� 1�2�2�	
�
+�*�3�<�+A�B�B�
��
�		�		�
�
�
�
rFc�6�|�|||���dS)N)�	propagate�insert�named)�base_listen)r�	event_keyr�r�r�s     rr<zEvents._listen�s#�����	�&���N�N�N�N�Nrc�.�|���dSr3)ro)rr�s  r�_removezEvents._remove�s���������rc�8�|j���dSr3)rrS)rs rrSz
Events._clears����������rN)FFF)rrr r!�staticmethodrc�classmethodrr<r�rSr"rrrrrr�s�������H�H�����\������[��(�O�O�O��[�O�����[������[���rrrc�N�eZdZdZdZd�Zd�Zed���Zed���Z	dS)rGz5Represent a connection between two _Dispatch objects.��localr0rc�D�||_||_|jj|_dSr3r�)rr�r0s   rr1z_JoinedDispatcher.__init__s#����
����!�Z�5����rc��t|j|��}t|j|j|��}t||j|��|Sr3)r8r�rr0rr4)rrr*�jls    rr5z_JoinedDispatcher.__getattr__sC���T�Z��
&�
&��
�T�[�"�'�2�
6�
6����b�g�r�"�"�"��	rc��|jjSr3)r0r<r=s rr<z_JoinedDispatcher._listen�
���{�"�"rc��|jjSr3)r0r;r=s rr;z_JoinedDispatcher._eventsr�rN)
rrr r!rEr1r5rVr<r;r"rrrGrGss������?�?�2�I�6�6�6�
����#�#��X�#��#�#��X�#�#�#rrGc��eZdZdZd�Zd�ZdS)rhz�Descriptor used by target classes to
    deliver the _Dispatch class at the class level
    and produce new _Dispatch instances for target
    instances.

    c�,�|j|_||_dSr3)r�events)rr�s  rr1zdispatcher.__init__)s�����
�����rc�`�|�|jS|j�|��x|jd<}|S)Nr)rrBr)r�objr�disps    r�__get__zdispatcher.__get__-s5���;��=� �*.�-�*E�*E�c�*J�*J�J���Z� �4��rN)rrr r!r1r�r"rrrhrh!s<���������������rrh)r!�
__future__rrT�attrrrr�r	�defaultdict�listrdr�objectrr$rFrXrZrp�with_metaclassrrrGrhr"rr�<module>r�s���	�	�'�&�&�&�&�&�����#�#�#�#�#�#� � � � � � �!�!�!�!�!�!��������d��t�$�$��&�&�&�
O�
O�
O�
O�
O��
O�
O�
O� h(�h(�h(�h(�h(��h(�h(�h(�V4�4�4�4�4��4�4�4�8�8�8�D���-�-�-�-�-�
 �T�
 ��V�
4�
4�-�-�-�`#�#�#�#�#��#�#�#�6����������r

Hacked By AnonymousFox1.0, Coded By AnonymousFox