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

�

�܋f����dZddlmZddlmZddlmZddlmZddlm	Z	e	j
d	��Ze	j
d
��Zd�Z
d�Zd
�Zd�Zd�ZdS)z,Public API functions for the event system.

�)�absolute_import�)�_registrars)�	_EventKey�)�exc)�util�CANCEL�	NO_RETVALc��t|D]-}|�|��}|�t||||��cS�.tjd|�d|�d����)NzNo such event 'z' for target '�')r�_accept_withrr�InvalidRequestError)�target�
identifier�fn�evt_cls�tgts     �K/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/event/api.py�
_event_keyrsw���z�*�
�
���"�"�6�*�*���?��V�Z��S�9�9�9�9�9���%�%�4>�J�J����G�
�
�	
�c�>�t|||��j|i|��dS)ak	Register a listener function for the given target.

    The :func:`.listen` function is part of the primary interface for the
    SQLAlchemy event system, documented at :ref:`event_toplevel`.

    e.g.::

        from sqlalchemy import event
        from sqlalchemy.schema import UniqueConstraint

        def unique_constraint_name(const, table):
            const.name = "uq_%s_%s" % (
                table.name,
                list(const.columns)[0].name
            )
        event.listen(
                UniqueConstraint,
                "after_parent_attach",
                unique_constraint_name)


    A given function can also be invoked for only the first invocation
    of the event using the ``once`` argument::

        def on_config():
            do_config()

        event.listen(Mapper, "before_configure", on_config, once=True)

    .. versionadded:: 0.9.4 Added ``once=True`` to :func:`.event.listen`
       and :func:`.event.listens_for`.

    .. warning:: The ``once`` argument does not imply automatic de-registration
       of the listener function after it has been invoked a first time; a
       listener entry will remain associated with the target object.
       Associating an arbitrarily high number of listeners without explicitly
       removing them will cause memory to grow unbounded even if ``once=True``
       is specified.

    .. note::

        The :func:`.listen` function cannot be called at the same time
        that the target event is being run.   This has implications
        for thread safety, and also means an event cannot be added
        from inside the listener function for itself.  The list of
        events to be run are present inside of a mutable collection
        that can't be changed during iteration.

        Event registration and removal is not intended to be a "high
        velocity" operation; it is a configurational operation.  For
        systems that need to quickly associate and deassociate with
        events at high scale, use a mutable structure that is handled
        from inside of a single listener.

        .. versionchanged:: 1.0.0 - a ``collections.deque()`` object is now
           used as the container for the list of events, which explicitly
           disallows collection mutation while the collection is being
           iterated.

    .. seealso::

        :func:`.listens_for`

        :func:`.remove`

    N)r�listen)rrr�args�kws     rrr"s/��H.�J�v�z�2�&�&�-�t�:�r�:�:�:�:�:rc����������fd�}|S)a~Decorate a function as a listener for the given target + identifier.

    The :func:`.listens_for` decorator is part of the primary interface for the
    SQLAlchemy event system, documented at :ref:`event_toplevel`.

    e.g.::

        from sqlalchemy import event
        from sqlalchemy.schema import UniqueConstraint

        @event.listens_for(UniqueConstraint, "after_parent_attach")
        def unique_constraint_name(const, table):
            const.name = "uq_%s_%s" % (
                table.name,
                list(const.columns)[0].name
            )

    A given function can also be invoked for only the first invocation
    of the event using the ``once`` argument::

        @event.listens_for(Mapper, "before_configure", once=True)
        def on_config():
            do_config()


    .. versionadded:: 0.9.4 Added ``once=True`` to :func:`.event.listen`
       and :func:`.event.listens_for`.

    .. warning:: The ``once`` argument does not imply automatic de-registration
       of the listener function after it has been invoked a first time; a
       listener entry will remain associated with the target object.
       Associating an arbitrarily high number of listeners without explicitly
       removing them will cause memory to grow unbounded even if ``once=True``
       is specified.

    .. seealso::

        :func:`.listen` - general description of event listening

    c�,��t��|g��Ri���|S)N)r)rrrrrs ����r�decoratezlistens_for.<locals>.decorate�s*����v�z�2�3��3�3�3��3�3�3��	r�)rrrrrs```` r�listens_forr is6������T���������Orc�L�t|||�����dS)a Remove an event listener.

    The arguments here should match exactly those which were sent to
    :func:`.listen`; all the event registration which proceeded as a result
    of this call will be reverted by calling :func:`.remove` with the same
    arguments.

    e.g.::

        # if a function was registered like this...
        @event.listens_for(SomeMappedClass, "before_insert", propagate=True)
        def my_listener_function(*arg):
            pass

        # ... it's removed like this
        event.remove(SomeMappedClass, "before_insert", my_listener_function)

    Above, the listener function associated with ``SomeMappedClass`` was also
    propagated to subclasses of ``SomeMappedClass``; the :func:`.remove`
    function will revert all of these operations.

    .. versionadded:: 0.9.0

    .. note::

        The :func:`.remove` function cannot be called at the same time
        that the target event is being run.   This has implications
        for thread safety, and also means an event cannot be removed
        from inside the listener function for itself.  The list of
        events to be run are present inside of a mutable collection
        that can't be changed during iteration.

        Event registration and removal is not intended to be a "high
        velocity" operation; it is a configurational operation.  For
        systems that need to quickly associate and deassociate with
        events at high scale, use a mutable structure that is handled
        from inside of a single listener.

        .. versionchanged:: 1.0.0 - a ``collections.deque()`` object is now
           used as the container for the list of events, which explicitly
           disallows collection mutation while the collection is being
           iterated.

    .. seealso::

        :func:`.listen`

    N)r�remove�rrrs   rr"r"�s)��b�v�z�2�&�&�-�-�/�/�/�/�/rc�H�t|||�����S)z`Return True if the given target/ident/fn is set up to listen.

    .. versionadded:: 0.9.0

    )r�containsr#s   rr%r%�s"���f�j�"�-�-�6�6�8�8�8rN)�__doc__�
__future__r�baser�registryr�rr	�symbolr
rrrr r"r%rrr�<module>r,s�����'�&�&�&�&�&�������������������������
���X�	�	���D�K��$�$�	�
�
�
�D;�D;�D;�N.�.�.�b10�10�10�h9�9�9�9�9r

Hacked By AnonymousFox1.0, Coded By AnonymousFox