Hacked By AnonymousFox

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

�

�܋f�1��Z�dZddlmZddlmZGd�de��ZGd�de��ZdS)	aDeprecated core event interfaces.


.. deprecated:: 0.7
    As of SQLAlchemy 0.7, the new event system described in
    :ref:`event_toplevel` replaces the extension/proxy/listener system,
    providing a consistent interface to all events without the need for
    subclassing.

�)�event)�utilc�@�eZdZdZed���Zd�Zd�Zd�Zd�Z	dS)�PoolListenera�	Hooks into the lifecycle of connections in a :class:`_pool.Pool`.

    .. deprecated:: 0.7

       :class:`.PoolListener` is deprecated and will be removed in a future
       release.  Please refer to :func:`.event.listen` in conjunction with
       the :class:`_events.PoolEvents` listener interface.

    Usage::

        class MyListener(PoolListener):
            def connect(self, dbapi_con, con_record):
                '''perform connect operations'''
            # etc.

        # create a new pool with a listener
        p = QueuePool(..., listeners=[MyListener()])

        # add a listener after the fact
        p.add_listener(MyListener())

        # usage with create_engine()
        e = create_engine("url://", listeners=[MyListener()])

    All of the standard connection :class:`~sqlalchemy.pool.Pool` types can
    accept event listeners for key connection lifecycle events:
    creation, pool check-out and check-in.  There are no events fired
    when a connection closes.

    For any given DB-API connection, there will be one ``connect``
    event, `n` number of ``checkout`` events, and either `n` or `n - 1`
    ``checkin`` events.  (If a ``Connection`` is detached from its
    pool via the ``detach()`` method, it won't be checked back in.)

    These are low-level events for low-level objects: raw Python
    DB-API connections, without the conveniences of the SQLAlchemy
    ``Connection`` wrapper, ``Dialect`` services or ``ClauseElement``
    execution.  If you execute SQL through the connection, explicitly
    closing all cursors and other resources is recommended.

    Events also receive a ``_ConnectionRecord``, a long-lived internal
    ``Pool`` object that basically represents a "slot" in the
    connection pool.  ``_ConnectionRecord`` objects have one public
    attribute of note: ``info``, a dictionary whose contents are
    scoped to the lifetime of the DB-API connection managed by the
    record.  You can use this shared storage area however you like.

    There is no need to subclass ``PoolListener`` to handle events.
    Any class that implements one or more of these methods can be used
    as a pool listener.  The ``Pool`` will inspect the methods
    provided by a listener object and add the listener to one or more
    internal event queues based on its capabilities.  In terms of
    efficiency and function call overhead, you're much better off only
    providing implementations for the hooks you'll be using.

    c�P�gd�}tj||���}|D]Z}tt|��}t||d��}|�0tj||��stjd|�d|�d����[t
|d��rtj|d|j	��t
|d��rtj|d|j
��t
|d	��rtj|d	|j��t
|d
��rtj|d
|j��dSdS)z^Adapt a :class:`.PoolListener` to individual
        :class:`event.Dispatch` events.

        )�connect�
first_connect�checkout�checkin)�methodsNz
PoolListener.z� is deprecated.  The PoolListener class will be removed in a future release.  Please transition to the @event interface, using @event.listens_for(Engine, '�').rr	r
r)
r�as_interface�getattrr�methods_equivalent�warn_deprecated�hasattrr�listenrr	r
r)�cls�self�listenerr�meth�me_meth�ls_meths       �L/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/interfaces.py�_adapt_listenerzPoolListener._adapt_listenerRsZ��F�E�E���$�X�w�?�?�?���	�	�D��l�D�1�1�G��h��d�3�3�G��"�4�+B���,�,�"��$�$�BF���t�t�t�M������8�Y�'�'�	<��L��y�(�*:�;�;�;��8�_�-�-�	H��L����0F�G�G�G��8�Z�(�(�	>��L��z�8�+<�=�=�=��8�Y�'�'�	<��L��y�(�*:�;�;�;�;�;�	<�	<�c��dS)a(Called once for each new DB-API connection or Pool's ``creator()``.

        dbapi_con
          A newly connected raw DB-API connection (not a SQLAlchemy
          ``Connection`` wrapper).

        con_record
          The ``_ConnectionRecord`` that persistently manages the connection

        N��r�	dbapi_con�
con_records   rrzPoolListener.connects����rc��dS)aCalled exactly once for the first DB-API connection.

        dbapi_con
          A newly connected raw DB-API connection (not a SQLAlchemy
          ``Connection`` wrapper).

        con_record
          The ``_ConnectionRecord`` that persistently manages the connection

        Nrrs   rr	zPoolListener.first_connectr"rc��dS)aCCalled when a connection is retrieved from the Pool.

        dbapi_con
          A raw DB-API connection

        con_record
          The ``_ConnectionRecord`` that persistently manages the connection

        con_proxy
          The ``_ConnectionFairy`` which manages the connection for the span of
          the current checkout.

        If you raise an ``exc.DisconnectionError``, the current
        connection will be disposed and a fresh connection retrieved.
        Processing of all checkout listeners will abort and restart
        using the new connection.
        Nr)rr r!�	con_proxys    rr
zPoolListener.checkout�r"rc��dS)a�Called when a connection returns to the pool.

        Note that the connection may be closed, and may be None if the
        connection has been invalidated.  ``checkin`` will not be called
        for detached connections.  (They do not return to the pool.)

        dbapi_con
          A raw DB-API connection

        con_record
          The ``_ConnectionRecord`` that persistently manages the connection

        Nrrs   rrzPoolListener.checkin�r"rN)
�__name__�
__module__�__qualname__�__doc__�classmethodrrr	r
rrrrrrsw������7�7�r�<�<��[�<�@
�
�
�
�
�
����&
�
�
�
�
rrc�r�eZdZdZed���Zd�Zd�Zd�Zd�Z	d�Z
dd	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZdS)�ConnectionProxya>Allows interception of statement execution by Connections.

    .. deprecated:: 0.7

       :class:`.ConnectionProxy` is deprecated and will be removed in a future
       release.  Please refer to :func:`.event.listen` in conjunction with
       the :class:`_events.ConnectionEvents` listener interface.

    Either or both of the ``execute()`` and ``cursor_execute()``
    may be implemented to intercept compiled statement and
    cursor level executions, e.g.::

        class MyProxy(ConnectionProxy):
            def execute(self, conn, execute, clauseelement,
                        *multiparams, **params):
                print "compiled statement:", clauseelement
                return execute(clauseelement, *multiparams, **params)

            def cursor_execute(self, execute, cursor, statement,
                               parameters, context, executemany):
                print "raw statement:", statement
                return execute(cursor, statement, parameters, context)

    The ``execute`` argument is a function that will fulfill the default
    execution behavior for the operation.  The signature illustrated
    in the example should be used.

    The proxy is installed into an :class:`~sqlalchemy.engine.Engine` via
    the ``proxy`` argument::

        e = create_engine('someurl://', proxy=MyProxy())

    c���
�gd�}|D]W}tt|��}t�|��}tj||��stjd|�d|�d����X�fd�}tj|d|���fd�}tj|d|��d	��
�
fd
�}	tj|d|	�j����tj|d|	�j����tj|d
|	�j	����tj|d|	�j
����tj|d|	�j����tj|d|	�j����tj|d|	�j
����tj|d|	�j����tj|d|	�j����tj|d|	�j����dS)N)�execute�cursor_execute�begin�rollback�commit�	savepoint�rollback_savepoint�release_savepoint�begin_twophase�prepare_twophase�rollback_twophase�commit_twophasezConnectionProxy.z� is deprecated.  The ConnectionProxy class will be removed in a future release.  Please transition to the @event interface, using @event.listens_for(Engine, 'r
c�0��d�}�j|||g|�Ri|��S)Nc��|||fS�Nr)�
clauseelement�multiparams�paramss   r�execute_wrapperzOConnectionProxy._adapt_listener.<locals>.adapt_execute.<locals>.execute_wrapper�s��$�k�6�9�9r)r/)�connr>r?r@rArs     �r�
adapt_executez6ConnectionProxy._adapt_listener.<locals>.adapt_execute�sL���
:�
:�
:�$�8�#��o�}��7B����FL���
r�before_executec�>��d�}��||||||��S)Nc�
�||fSr=r)�cursor�	statement�
parameters�contexts    rrAzVConnectionProxy._adapt_listener.<locals>.adapt_cursor_execute.<locals>.execute_wrapper�s
�� �*�,�,r)r0)rBrGrHrIrJ�executemanyrArs       �r�adapt_cursor_executez=ConnectionProxy._adapt_listener.<locals>.adapt_cursor_execute�s>���
-�
-�
-��*�*�������
��
r�before_cursor_executec��dSr=r)�arg�kws  r�do_nothing_callbackz<ConnectionProxy._adapt_listener.<locals>.do_nothing_callback	s���Drc�<�����fd�}tj|���S)Nc�"���|�g|�Ri|��dSr=r)rBrOrPrQ�fns   ��r�gozCConnectionProxy._adapt_listener.<locals>.adapt_listener.<locals>.go
s,�����4�,�9�s�9�9�9�b�9�9�9�9�9r)r�update_wrapper)rTrUrQs` �r�adapt_listenerz7ConnectionProxy._adapt_listener.<locals>.adapt_listeners7����
:�
:�
:�
:�
:�
:��&�r�2�.�.�.rr1r2r3r4r5r6r7r8r9r:)rr-rrrrrr1r2r3r4r5r6r7r8r9r:)rrrrrrrrCrLrWrQs  `       @rrzConnectionProxy._adapt_listener�s�����

�

�

���
	�
	�D��o�t�4�4�G��h��-�-�G��*�7�G�<�<�
��$�$�BF���t�t�t�M�����	�	�	�	�	�	��T�+�]�;�;�;�
	�
	�
	�
	�
	�	��T�2�4H�I�I�I�	�	�	�	/�	/�	/�	/�	/�	��T�7�N�N�8�>�$B�$B�C�C�C�
��T�:�~�~�h�6G�'H�'H�I�I�I�
��T�8�^�^�H�O�%D�%D�E�E�E�
��T�;���x�7I�(J�(J�K�K�K�
��� ��N�8�6�7�7�	
�	
�	
�
	�����N�8�5�6�6�	
�	
�	
�
	���"�N�N�8�3J�$K�$K�	
�	
�	
�	���$�n�n�X�5N�&O�&O�	
�	
�	
�	�����N�8�5�6�6�	
�	
�	
�
	���#�^�^�H�4L�%M�%M�	
�	
�	
�	
�	
rc��||g|�Ri|��S)z&Intercept high level execute() events.r)rrBr/r>r?r@s      rr/zConnectionProxy.execute/s$���w�}�=�{�=�=�=�f�=�=�=rc��|||||��S)z,Intercept low-level cursor execute() events.r)rr/rGrHrIrJrKs       rr0zConnectionProxy.cursor_execute4s��
�w�v�y�*�g�>�>�>rc��|��S)zIntercept begin() events.r)rrBr1s   rr1zConnectionProxy.begin;s���u�w�w�rc��|��S)zIntercept rollback() events.r)rrBr2s   rr2zConnectionProxy.rollback@s���x�z�z�rc��|��S)zIntercept commit() events.r)rrBr3s   rr3zConnectionProxy.commitEs���v�x�x�rNc��||���S)zIntercept savepoint() events.)�namer)rrBr4r^s    rr4zConnectionProxy.savepointJs���y�d�#�#�#�#rc��|||��S)z&Intercept rollback_savepoint() events.r)rrBr5r^rJs     rr5z"ConnectionProxy.rollback_savepointOs��"�!�$��0�0�0rc��|||��S)z%Intercept release_savepoint() events.r)rrBr6r^rJs     rr6z!ConnectionProxy.release_savepointTs��!� ��w�/�/�/rc��||��S)z"Intercept begin_twophase() events.r)rrBr7�xids    rr7zConnectionProxy.begin_twophaseYs���~�c�"�"�"rc��||��S)z$Intercept prepare_twophase() events.r)rrBr8rbs    rr8z ConnectionProxy.prepare_twophase^s�� ���$�$�$rc��|||��S)z%Intercept rollback_twophase() events.r)rrBr9rb�is_prepareds     rr9z!ConnectionProxy.rollback_twophasecs��!� ��k�2�2�2rc��|||��S)z#Intercept commit_twophase() events.r)rrBr:rbres     rr:zConnectionProxy.commit_twophasehs����s�K�0�0�0rr=)r'r(r)r*r+rr/r0r1r2r3r4r5r6r7r8r9r:rrrr-r-�s������� � �D�[
�[
��[�[
�z>�>�>�
?�?�?����
���
���
$�$�$�$�
1�1�1�
0�0�0�
#�#�#�
%�%�%�
3�3�3�
1�1�1�1�1rr-N)r*�rr�objectrr-rrr�<module>ris���	�	�������������S�S�S�S�S�6�S�S�S�l}1�}1�}1�}1�}1�f�}1�}1�}1�}1�}1r

Hacked By AnonymousFox1.0, Coded By AnonymousFox