Hacked By AnonymousFox

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

�

�܋f����f�dZddlmZddlZddlZddlmZddlmZddlmZddlm	Z	dd	lm
Z
dd
l
mZe
jd��Z
e
jd��Ze
jd
��ZGd�de��ZGd�de	j��ZGd�de��Z	dd�Ze��ZGd�de��ZdS)z'Base constructs for connection pools.

�)�dequeN�)�event)�exc)�
interfaces)�log)�util)�	threading�reset_rollback�reset_commit�
reset_nonec�*�eZdZdZd�Zd�Zd�Zd�ZdS)�_ConnDialectz�partial implementation of :class:`.Dialect`
    which provides DBAPI connection methods.

    When a :class:`_pool.Pool` is combined with an :class:`_engine.Engine`,
    the :class:`_engine.Engine` replaces this with its own
    :class:`.Dialect`.

    c�.�|���dS�N)�rollback��self�dbapi_connections  �K/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/pool/base.py�do_rollbackz_ConnDialect.do_rollback)s���!�!�#�#�#�#�#�c�.�|���dSr)�commitrs  r�	do_commitz_ConnDialect.do_commit,s�����!�!�!�!�!rc�.�|���dSr)�closers  r�do_closez_ConnDialect.do_close/s����� � � � � rc� �td���)NzJThe ping feature requires that a dialect is passed to the connection pool.��NotImplementedErrorrs  r�do_pingz_ConnDialect.do_ping2s��!�
-�
�
�	
rN)�__name__�
__module__�__qualname__�__doc__rrrr"�rrrrsZ��������$�$�$�"�"�"�!�!�!�
�
�
�
�
rrc�&�eZdZdZe��Zejdd���										dd	���Ze	d
���Z
e
jd���Z
d�Zd
�Z
ejdd��d���Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�Poolz)Abstract base class for connection pools.)z1.3zkThe :paramref:`_pool.Pool.use_threadlocal` parameter is deprecated and will be removed in a future release.)�0.7z�:class:`.PoolListener` is deprecated in favor of the :class:`_events.PoolEvents` listener interface.  The :paramref:`_pool.Pool.listeners` parameter will be removed in a future release.)�use_threadlocal�	listeners���NFTc	�4�|r|x|_|_nd|_tj||���t	j��|_||_||_d|_	||_
|
|_tj
�|tddgt gd�t"dgidd	�
��|_||_|r|j�|d	���|	r|	|_|r|D]\}}
t/j||
|���|r|D]}|�|���dSdS)a-
        Construct a Pool.

        :param creator: a callable function that returns a DB-API
          connection object.  The function will be called with
          parameters.

        :param recycle: If set to a value other than -1, number of
          seconds between connection recycling, which means upon
          checkout, if this timeout is surpassed the connection will be
          closed and replaced with a newly opened connection. Defaults to -1.

        :param logging_name:  String identifier which will be used within
          the "name" field of logging records generated within the
          "sqlalchemy.pool" logger. Defaults to a hexstring of the object's
          id.

        :param echo: if True, the connection pool will log
         informational output such as when connections are invalidated
         as well as when connections are recycled to the default log handler,
         which defaults to ``sys.stdout`` for output..   If set to the string
         ``"debug"``, the logging will include pool checkouts and checkins.

         The :paramref:`_pool.Pool.echo` parameter can also be set from the
         :func:`_sa.create_engine` call by using the
         :paramref:`_sa.create_engine.echo_pool` parameter.

         .. seealso::

             :ref:`dbengine_logging` - further detail on how to configure
             logging.

        :param use_threadlocal: If set to True, repeated calls to
          :meth:`connect` within the same application thread will be
          guaranteed to return the same connection object that is already
          checked out.   This is a legacy use case and the flag has no
          effect when using the pool with a :class:`_engine.Engine` object.

        :param reset_on_return: Determine steps to take on
          connections as they are returned to the pool.
          reset_on_return can have any of these values:

          * ``"rollback"`` - call rollback() on the connection,
            to release locks and transaction resources.
            This is the default value.  The vast majority
            of use cases should leave this value set.
          * ``True`` - same as 'rollback', this is here for
            backwards compatibility.
          * ``"commit"`` - call commit() on the connection,
            to release locks and transaction resources.
            A commit here may be desirable for databases that
            cache query plans if a commit is emitted,
            such as Microsoft SQL Server.  However, this
            value is more dangerous than 'rollback' because
            any data changes present on the transaction
            are committed unconditionally.
          * ``None`` - don't do anything on the connection.
            This setting should generally only be made on a database
            that has no transaction support at all,
            namely MySQL MyISAM; when used on this backend, performance
            can be improved as the "rollback" call is still expensive on
            MySQL.   It is **strongly recommended** that this setting not be
            used for transaction-supporting databases in conjunction with
            a persistent pool such as :class:`.QueuePool`, as it opens
            the possibility for connections still in a transaction to be
            idle in the pool.   The setting may be appropriate in the
            case of :class:`.NullPool` or special circumstances where
            the connection pool in use is not being used to maintain connection
            lifecycle.

          * ``False`` - same as None, this is here for
            backwards compatibility.

        :param events: a list of 2-tuples, each of the form
         ``(callable, target)`` which will be passed to :func:`.event.listen`
         upon construction.   Provided here so that event listeners
         can be assigned via :func:`_sa.create_engine` before dialect-level
         listeners are applied.

        :param listeners: A list of :class:`.PoolListener`-like objects or
          dictionaries of callables that receive events when DB-API
          connections are created, checked out and checked in to the
          pool.

        :param dialect: a :class:`.Dialect` that will handle the job
         of calling rollback(), close(), or commit() on DBAPI connections.
         If omitted, a built-in "stub" dialect is used.   Applications that
         make use of :func:`_sa.create_engine` should not use this parameter
         as it is handled by the engine creation strategy.

         .. versionadded:: 1.1 - ``dialect`` is now a public parameter
            to the :class:`_pool.Pool`.

        :param pre_ping: if True, the pool will emit a "ping" (typically
         "SELECT 1", but is dialect-specific) on the connection
         upon checkout, to test if the connection is alive or not.   If not,
         the connection is transparently re-connected and upon success, all
         other pooled connections established prior to that timestamp are
         invalidated.     Requires that a dialect is passed as well to
         interpret the disconnection error.

         .. versionadded:: 1.2

        N)�echoflagrrT)�noneNFr�reset_on_returnF)�resolve_symbol_names)�only_propagate)�logging_name�_orig_logging_namer�instance_loggerr
�local�_threadconns�_creator�_recycle�_invalidate_time�_use_threadlocal�	_pre_pingr	�symbol�parse_user_argumentrr
r�_reset_on_return�echo�dispatch�_update�_dialectr�listen�add_listener)r�creator�recyclerAr+r4r1r,�events�dialect�pre_ping�	_dispatch�fn�target�ls               r�__init__z
Pool.__init__?sp��H�	+�:F�F�D��� 7� 7�&*�D�#���D�4�0�0�0�0�%�O�-�-�����
���
� !��� /���!��� $�� ?� ?����T� 2��1�1�1��x�j�
�

�!&�!@�	!
�	!
�����	��	C��M�!�!�)�E�!�B�B�B��	$�#�D�M��	/�$�
/�
/�
��F���T�6�2�.�.�.�.��	%��
%�
%���!�!�!�$�$�$�$�	%�	%�
%�
%rc��|jdS�Nr9)�__dict__�rs rr9z
Pool._creator�s���}�Z�(�(rc�N�||jd<|�|��|_dSrR)rS�_should_wrap_creator�_invoke_creator)rrGs  rr9z
Pool._creator�s*��$+��
�j�!�#�8�8��A�A����rc�&��	tj|jd���}n#t$r�fd�cYSwxYw|ddurt	|d��pd}t	|d��|z
}|d|dfdgdfkr�S|d	kr�S�fd
�S)zlDetect if creator accepts a single argument, or is sent
        as a legacy style no-arg function.

        T)�no_selfc������Srr'��crecrGs �r�<lambda>z+Pool._should_wrap_creator.<locals>.<lambda>��
�����	�	�r�Nr�connection_recordr�c������Srr'r[s �rr]z+Pool._should_wrap_creator.<locals>.<lambda>r^r)r	�get_callable_argspecr9�	TypeError�len)rrG�argspec�	defaulted�positionalss `   rrVzPool._should_wrap_creator�s����	*��/��
�t�L�L�L�G�G���	*�	*�	*�)�)�)�)�)�)�)�	*�����A�J�d�*�>�s�7�1�:���C�!�	��'�!�*�o�o�	�1��
�A�J���
�#�)<�(=�w�'G�G�G��N�
�A�
�
��N�*�)�)�)�)s��1�1c���|j�d|��	|j�|��dS#t$r!|j�d|d���YdSwxYw)NzClosing connection %rzException closing connection %rT��exc_info)�logger�debugrDr�	Exception�error)r�
connections  r�_close_connectionzPool._close_connection
s�������1�:�>�>�>�	��M�"�"�:�.�.�.�.�.���	�	�	��K���1�:��
�
�
�
�
�
�
�	���s�9�'A$�#A$r*z�The :meth:`_pool.Pool.add_listener` method is deprecated and will be removed in a future release.  Please use the :class:`_events.PoolEvents` listener interface.c�F�tj�||��dS)aAdd a :class:`.PoolListener`-like object to this pool.

        ``listener`` may be an object that implements some or all of
        PoolListener, or a dictionary of callables containing implementations
        of some or all of the named methods in PoolListener.

        N)r�PoolListener�_adapt_listener)r�listeners  rrFzPool.add_listeners#��	��/�/��h�?�?�?�?�?rc�6�t�|��S)a�Produce a DBAPI connection that is not referenced by any
        thread-local context.

        This method is equivalent to :meth:`_pool.Pool.connect` when the
        :paramref:`_pool.Pool.use_threadlocal` flag is not set to True.
        When :paramref:`_pool.Pool.use_threadlocal` is True, the
        :meth:`_pool.Pool.unique_connection`
        method provides a means of bypassing
        the threadlocal context.

        )�_ConnectionFairy�	_checkoutrTs r�unique_connectionzPool.unique_connection$s�� �)�)�$�/�/�/rc� �t|��S)z6Called by subclasses to create a new ConnectionRecord.)�_ConnectionRecordrTs r�_create_connectionzPool._create_connection2s��!��&�&�&rc���t|dd��}|r|j|jkrtj��|_|r(t|dd��r|�|��dSdSdS)a�Mark all connections established within the generation
        of the given connection as invalidated.

        If this pool's last invalidate time is before when the given
        connection was created, update the timestamp til now.  Otherwise,
        no action is performed.

        Connections with a start time prior to this pool's invalidation
        time will be recycled upon next checkout.
        �_connection_recordN�is_validF)�getattrr;�	starttime�time�
invalidate)rrp�	exception�_checkin�recs     r�_invalidatezPool._invalidate7s����j�"6��=�=���	0�d�+�c�m�;�;�$(�I�K�K�D�!��	-��
�J��>�>�	-��!�!�)�,�,�,�,�,�	-�	-�	-�	-rc��t���)a"Return a new :class:`_pool.Pool`, of the same class as this one
        and configured with identical creation arguments.

        This method is used in conjunction with :meth:`dispose`
        to close out an entire :class:`_pool.Pool` and create a new one in
        its place.

        r rTs r�recreatez
Pool.recreateHs��"�#�#�#rc��t���)z�Dispose of this pool.

        This method leaves the possibility of checked-out connections
        remaining open, as it only affects connections that are
        idle in the pool.

        .. seealso::

            :meth:`Pool.recreate`

        r rTs r�disposezPool.disposeTs��"�#�#�#rc��|jst�|��S	|j���}|�|���Sn#t$rYnwxYwt�||j��S)z�Return a DBAPI connection from the pool.

        The connection is instrumented such that when its
        ``close()`` method is called, the connection will be returned to
        the pool.

        )r<rwrxr8�current�_checkout_existing�AttributeError�rr�s  r�connectzPool.connectcs����$�	4�#�-�-�d�3�3�3�	0��#�+�+�-�-�C����-�-�/�/�/����	�	�	��D�	���� �)�)�$��0A�B�B�Bs�A�
A �A c�p�|jr	|j`n#t$rYnwxYw|�|��dS)z�Given a _ConnectionRecord, return it to the :class:`_pool.Pool`.

        This method is called when an instrumented DBAPI connection
        has its ``close()`` method called.

        N)r<r8r�r��_do_return_conn)r�records  r�_return_connzPool._return_connxsZ��� �	�
��%�-�-��!�
�
�
���
�������V�$�$�$�$�$s��
�c��t���)z7Implementation for :meth:`get`, supplied by subclasses.r rTs r�_do_getzPool._do_get����"�#�#�#rc��t���)z?Implementation for :meth:`return_conn`, supplied by subclasses.r )r�conns  rr�zPool._do_return_conn�r�rc��t���rr rTs r�statuszPool.status�s��!�#�#�#r)
r-NFNTNNNFN)NT)r#r$r%r&rrDr	�deprecated_paramsrP�propertyr9�setterrVrq�
deprecatedrFryr|r�r�r�r�r�r�r�r�r'rrr)r)9s�������3�3��|�~�~�H��T��
�

�

�
�
�"�
���������X%�X%�X%�
�
�X%�t�)�)��X�)��_�B�B��_�B�*�*�*�4����T�_�
�	:���@�@�
��@�0�0�0�'�'�'�
-�-�-�-�"
$�
$�
$�
$�
$�
$�C�C�C�*%�%�%�$�$�$�
$�$�$�
$�$�$�$�$rr)c���eZdZdZdd�ZdZdZdZ	dZe	j
d���Ze	j
d���Ze
d���Zd	�Zdd�Zed���Zed
���Zd�Zdd�Zd�Zd�Zdd�ZdS)r{a�Internal object which maintains an individual DBAPI connection
    referenced by a :class:`_pool.Pool`.

    The :class:`._ConnectionRecord` object always exists for any particular
    DBAPI connection whether or not that DBAPI connection has been
    "checked out".  This is in contrast to the :class:`._ConnectionFairy`
    which is only a public facade to the DBAPI connection while it is checked
    out.

    A :class:`._ConnectionRecord` may exist for a span longer than that
    of a single DBAPI connection.  For example, if the
    :meth:`._ConnectionRecord.invalidate`
    method is called, the DBAPI connection associated with this
    :class:`._ConnectionRecord`
    will be discarded, but the :class:`._ConnectionRecord` may be used again,
    in which case a new DBAPI connection is produced when the
    :class:`_pool.Pool`
    next uses this record.

    The :class:`._ConnectionRecord` is delivered along with connection
    pool events, including :meth:`_events.PoolEvents.connect` and
    :meth:`_events.PoolEvents.checkout`, however :class:`._ConnectionRecord`
    still
    remains an internal object whose API and internals may change.

    .. seealso::

        :class:`._ConnectionFairy`

    Tc�j�||_|r|�d���t��|_dS)NT)�first_connect_check)�_ConnectionRecord__pool�_ConnectionRecord__connectr�finalize_callback)r�poolr�s   rrPz_ConnectionRecord.__init__�s7������	5��N�N�t�N�4�4�4�!&������rNrc��iS)a`The ``.info`` dictionary associated with the DBAPI connection.

        This dictionary is shared among the :attr:`._ConnectionFairy.info`
        and :attr:`_engine.Connection.info` accessors.

        .. note::

            The lifespan of this dictionary is linked to the
            DBAPI connection itself, meaning that it is **discarded** each time
            the DBAPI connection is closed and/or invalidated.   The
            :attr:`._ConnectionRecord.record_info` dictionary remains
            persistent throughout the lifespan of the
            :class:`._ConnectionRecord` container.

        r'rTs r�infoz_ConnectionRecord.info�s	��"�	rc��iS)a�An "info' dictionary associated with the connection record
        itself.

        Unlike the :attr:`._ConnectionRecord.info` dictionary, which is linked
        to the lifespan of the DBAPI connection, this dictionary is linked
        to the lifespan of the :class:`._ConnectionRecord` container itself
        and will remain persistent throughout the life of the
        :class:`._ConnectionRecord`.

        .. versionadded:: 1.1

        r'rTs r�record_infoz_ConnectionRecord.record_info�s	���	rc����������	����}nW#t$rJ}tj��5��|��ddd��n#1swxYwYYd}~nd}~wwxYw�����t|����}tj	|���fd����_
t�����r�j
�d|��|S)Nc�8��totd��|���Sr)�_finalize_fairy)�refrAr�r�s ���rr]z,_ConnectionRecord.checkout.<locals>.<lambda>�s"����<���c�4��d�;�;�rz#Connection %r checked out from pool)r��get_connectionrnr	�safe_reraise�_checkin_failed�_should_log_debugrw�weakrefr��	fairy_ref�_refs�addrlrm)�clsr�r�err�fairyrAr�s `   @@r�checkoutz_ConnectionRecord.checkout�sa������l�l�n�n��	)�"�1�1�3�3�����	)�	)�	)��"�$�$�
)�
)��#�#�C�(�(�(�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)����
)�
)�
)�
)����������	)�����%�%�'�'�� �!1�3��=�=�����
<�
<�
<�
<�
<�
<�
�
��
�
	�	�	�#�����	��K���5�7G�
�
�
��s8�.�
B�A=�A-�!A=�-A1	�1A=�4A1	�5A=�=Bc�^�|�|���|�d���dS)N��eT)�
_no_fairy_ref)r��checkin)rr�s  rr�z!_ConnectionRecord._checkin_faileds0�����#��������4��(�(�(�(�(rFc�P�|j�|stjd|z��dSd|_|j}|j}|jr+|j���}||��|j�+|jjr|j�||��|�	|��dS)NzDouble checkin attempted on %s)
r�r	�warnrpr�r��poprBr�r�)rr�rpr��	finalizers     rr�z_ConnectionRecord.checkins����>�!�-�!��I�6��=�>�>�>��F�����_�
��{���$�	"��.�2�2�4�4�I��I�j�!�!�!��$�	"��=� �	4��M�!�!�*�d�3�3�3����$�����rc��|jduSr)r�rTs r�in_usez_ConnectionRecord.in_uses���~�T�)�)rc��|jSr)r�rTs r�last_connect_timez#_ConnectionRecord.last_connect_times
���~�rc�@�|j�|���dSdSr)rp�_ConnectionRecord__closerTs rrz_ConnectionRecord.closes#���?�&��L�L�N�N�N�N�N�'�&rc���|j�dS|r'|jj�|j||��n&|jj�|j||��|�7|jj�d|rdnd|j|jj|��n*|jj�d|rdnd|j��|rtj	��|_
dS|���d|_dS)a�Invalidate the DBAPI connection held by this :class:`._ConnectionRecord`.

        This method is called for all connection invalidations, including
        when the :meth:`._ConnectionFairy.invalidate` or
        :meth:`_engine.Connection.invalidate` methods are called,
        as well as when any
        so-called "automatic invalidation" condition occurs.

        :param e: an exception object indicating a reason for the invalidation.

        :param soft: if True, the connection isn't closed; instead, this
         connection will be recycled on next checkout.

         .. versionadded:: 1.0.3

        .. seealso::

            :ref:`pool_connection_invalidation`

        Nz*%sInvalidate connection %r (reason: %s:%s)zSoft �z%sInvalidate connection %r)rpr�rB�soft_invalidater�rlr��	__class__r#r��_soft_invalidate_timer��rr��softs   rr�z_ConnectionRecord.invalidate!s
��,�?�"��F��	F��K� �0�0���$��J�J�J�J��K� �+�+�D�O�T�1�E�E�E��=��K��#�#�<��'���R�����$��
�
�
�
�
�K��#�#�,��'���R���
�
�
�
�	#�)-����D�&�&�&��L�L�N�N�N�"�D�O�O�Orc��d}|j�.|j���|���n�|jjdkrQt
j��|jz
|jjkr(|jj�d|j��d}nt|jj	|jkr(|jj�d|j��d}n7|j
|jkr'|jj�d|j��d}|rA|���|j���|���|jS)NFr-z)Connection %r exceeded timeout; recyclingTz=Connection %r invalidated due to pool invalidation; recyclingzCConnection %r invalidated due to local soft invalidation; recycling)rpr��clearr�r�r:r�r�rlr;r�r�)rrHs  rr�z _ConnectionRecord.get_connectionQsO�����?�"��I�O�O�����N�N������K� �2�%�%��	���d�n�,�t�{�/C�C�C��K��#�#�;�T�_�
�
�
��G�G�
�[�
)�D�N�
:�
:��K��#�#����
�
�
�
�G�G�
�
'�$�.�
8�
8��K��#�#����
�
�
�
�G��	��L�L�N�N�N��I�O�O�����N�N������rc���|j���|jjjr%|jj�|j|��|j�|j��d|_dSr)r�r�r�rBrrprqrTs r�__closez_ConnectionRecord.__close�sg����$�$�&�&�&��;��%�	>��K� �&�&�t���=�=�=���%�%�d�o�6�6�6�����rc�d�|j}d|_	tj��|_|�|��}|j�d|��||_|r=|jj�	|j���
|j|��|jjr"|j�|j|��dSdS#t$rW}tj��5|j�d|��ddd��n#1swxYwYYd}~dSYd}~dSd}~wwxYw)NzCreated new connection %rzError on connect(): %s)r�rpr�r�rWrlrmrB�
first_connect�
for_modify�exec_once_unless_exceptionr�rnr	r�)rr�r�rpr�s     r�	__connectz_ConnectionRecord.__connect�s����{�����	=�!�Y�[�[�D�N��-�-�d�3�3�J��K���9�:�F�F�F�(�D�O�
#�
D��
�+�6�6��M���,�,�T�_�d�C�C�C��}�$�
=��
�%�%�d�o�t�<�<�<�<�<�
=�
=���	?�	?�	?��"�$�$�
?�
?���!�!�":�A�>�>�>�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?����
?�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?�����	?���s<�AC�
D/�D*�+D�D*�D	�D*�D	�D*�*D/)T)F�NF)r#r$r%r&rPr�r�rpr�r	�memoized_propertyr�r��classmethodr�r�r�r�r�r�rr�r�r�r�r'rrr{r{�sW��������>)�)�)�)��I��I��J����	�������$
��
�
���
�����[��*)�)�)� � � � ��*�*��X�*�����X�����.#�.#�.#�.#�`.�.�.�`���=�=�=�=�=�=rr{c��t�|��|�|j|urdS|�J�|j}|��|r|r|j�d|��	|pt
|||��}|j|usJ�|�|��|s;|jj	r|j�	|��|�
|��na#t$rT}|j�dd���|r|�
|���t|t��s�Yd}~nd}~wwxYw|r|j�|���dSdSdS)zfCleanup for a :class:`._ConnectionFairy` whether or not it's already
    been garbage collected.

    Nz$Connection %r being returned to poolz!Exception during reset or similarTrjr�)r��discardr�rprlrmrw�_resetrB�close_detachedrq�
BaseExceptionror��
isinstancernr�)rpr`r�r�rAr�r�s       rr�r��s���
�M�M�#�$�$�$�
���&�c�1�1��F��!�!�!�&�1�
����	��	��K���6�
�
�
�
�	���-��-�t���E��#�z�1�1�1�1��L�L�����%�
3��=�/�=��M�0�0��<�<�<��&�&�z�2�2�2����	�	�	��K���3�d�
�
�
�
�!�
2�!�,�,�q�,�1�1�1��a��+�+�
��
�
�
�
�
�����
	�����$�.�8�D��!�!�#�#�#�#�#�$�$�D�Ds�A0C�
D$�A
D�D$c���eZdZdZd�ZdZ	dZ	dZ	edd���Z	d�Z
d�ZeZd�Z
ed���Zed	���Zejd
���Zed���Zdd
�Zd�Zd�Zd�Zd�ZdS)rwabProxies a DBAPI connection and provides return-on-dereference
    support.

    This is an internal object used by the :class:`_pool.Pool` implementation
    to provide context management to a DBAPI connection delivered by
    that :class:`_pool.Pool`.

    The name "fairy" is inspired by the fact that the
    :class:`._ConnectionFairy` object's lifespan is transitory, as it lasts
    only for the length of a specific DBAPI connection being checked out from
    the pool, and additionally that as a transparent proxy, it is mostly
    invisible.

    .. seealso::

        :class:`._ConnectionRecord`

    c�0�||_||_||_dSr)rpr~�_echo)rrr`rAs    rrPz_ConnectionFairy.__init__�s��*���"3�����
�
�
rNc��|sCt�|��}||_d|_|�t	j|��|_|j�tj	d���|xjdz
c_|j
js|jr|jdkr|Sd}|dk�r�	|jr�|jr |j
�d|j��|j�|j��}|s:|jr |j
�d|j��tj���|j
�|j|j|��|S#tj$�r}|jrN|j
�d|��|j�|��|�||d�	��n;|j
�d
|j|��|j�|��	|j���|_n\#t2$rO}t5j��5|j�|��ddd��n#1swxYwYYd}~nd}~wwxYw|dz}Yd}~nd}~wwxYw|dk���|j
�d��|���tj	d���)NrzThis connection is closedrarzPool pre-ping on connection %sz;Pool pre-ping on connection %s failed, will invalidate poolzoDisconnection detected on checkout, invalidating all pooled connections prior to current timestamp (reason: %r)F)r�zVDisconnection detected on checkout, invalidating individual connection %s (reason: %r)z+Reconnection attempts exhausted on checkout)r{r��_pool�_counterr�r�r�rpr�InvalidRequestErrorrBr=r�rlrmrDr"�InvalidatePoolErrorr~�DisconnectionError�invalidate_poolr�r�r�r�rnr	r�r�)r�r��threadconnsr��attempts�resultr�r�s        rrxz_ConnectionFairy._checkoutsu���	9�%�.�.�t�4�4�E��E�K��E�N��&�&-�k�%�&8�&8��#���#��)�*E�F�F�F�
���!�����
�&�	�/3�~�	�
�^�q�
 �
 ��L�����l�l�/
��>�8��{����)�)�<�e�>N����"�]�2�2�5�3C�D�D�F�!�8� �;�� �K�-�-�!7� %� 0����
"�5�7�7�7��
�&�&��$�e�&>���������)�
�
�
��$�;��K�$�$�9��	����,�7�7��:�:�:��$�$�U�A��$�>�>�>�>��K�$�$�M��(��	����,�7�7��:�:�:�F��0�?�?�A�A��$�$��!�F�F�F��*�,�,�F�F��0�@�@��E�E�E�F�F�F�F�F�F�F�F�F�F�F����F�F�F�F����������F�����A�
�����������5
����-��l�l�d	
����F�G�G�G�
�������%�&A�B�B�Bsh�B0E�I7�BI2�-H�I2�
I%�I �)I�I �I�I �I�I �I2� I%�%I2�2I7c�D�t�|j|���S�N)r�)rwrxr�rTs rr�z#_ConnectionFairy._checkout_existingWs���)�)�$�*�D�)�A�A�Arc�t�t|j|j|jd|j|���d|_d|_dSr�)r�rpr~r�r�rTs rr�z_ConnectionFairy._checkinZsK����O��#��J���J��
	
�	
�	
�	
����"&����rc�B�|jjr |j�||j��|jtur�|jr*|j�d|j|j	rdnd��|j	rW|j	j
s0tjd��|j
�|��dS|j	���dS|j
�|��dS|jt ur�|jr*|j�d|j|j	rdnd��|j	rW|j	j
s0tjd��|j
�|��dS|j	���dS|j
�|��dSdS)Nz"Connection %s rollback-on-return%sz, via agentr�zlReset agent is not active.  This should not occur unless there was already a connectivity error in progress.z Connection %s commit-on-return%s)rB�resetr~r@rr�rlrmrp�_reset_agent�	is_activer	r�rDrrrrr)rr�s  rr�z_ConnectionFairy._reseths����=��	?��M����d�&=�>�>�>�� �N�2�2��z�
���!�!�8��O�%)�%6�>�M�M�B����
� �
0��(�2�1��I�<����
�M�-�-�d�3�3�3�3�3��%�.�.�0�0�0�0�0��
�)�)�$�/�/�/�/�/�
�
"�l�
2�
2��z�
���!�!�6��O�%)�%6�>�M�M�B����
� �
.��(�2�/��I�<����
�M�+�+�D�1�1�1�1�1��%�,�,�.�.�.�.�.��
�'�'��-�-�-�-�-�%3�
2rc��|jjSr)r�rlrTs r�_loggerz_ConnectionFairy._logger�s
���z� � rc��|jduS)zbReturn True if this :class:`._ConnectionFairy` still refers
        to an active DBAPI connection.N)rprTs rrz_ConnectionFairy.is_valid�s��
��d�*�*rc��|jjS)a�Info dictionary associated with the underlying DBAPI connection
        referred to by this :class:`.ConnectionFairy`, allowing user-defined
        data to be associated with the connection.

        The data here will follow along with the DBAPI connection including
        after it is returned to the connection pool and used again
        in subsequent instances of :class:`._ConnectionFairy`.  It is shared
        with the :attr:`._ConnectionRecord.info` and
        :attr:`_engine.Connection.info`
        accessors.

        The dictionary associated with a particular DBAPI connection is
        discarded when the connection itself is discarded.

        )r~r�rTs rr�z_ConnectionFairy.info�s��"�&�+�+rc�,�|jr|jjSdS)a�Info dictionary associated with the :class:`._ConnectionRecord
        container referred to by this :class:`.ConnectionFairy`.

        Unlike the :attr:`._ConnectionFairy.info` dictionary, the lifespan
        of this dictionary is persistent across connections that are
        disconnected and/or invalidated within the lifespan of a
        :class:`._ConnectionRecord`.

        .. versionadded:: 1.1

        N)r~r�rTs rr�z_ConnectionFairy.record_info�s ���"�	��*�6�6��4rFc���|j�tjd��dS|jr|j�||���|sd|_|���dSdS)a�Mark this connection as invalidated.

        This method can be called directly, and is also called as a result
        of the :meth:`_engine.Connection.invalidate` method.   When invoked,
        the DBAPI connection is immediately closed and discarded from
        further use by the pool.  The invalidation mechanism proceeds
        via the :meth:`._ConnectionRecord.invalidate` internal method.

        :param e: an exception object indicating a reason for the invalidation.

        :param soft: if True, the connection isn't closed; instead, this
         connection will be recycled on next checkout.

         .. versionadded:: 1.0.3

        .. seealso::

            :ref:`pool_connection_invalidation`

        Nz.Can't invalidate an already-closed connection.)r�r�)rpr	r�r~r�r�r�s   rr�z_ConnectionFairy.invalidate�ss��,�?�"��I�F�G�G�G��F��"�	?��#�.�.���.�>�>�>��	�"�D�O��M�M�O�O�O�O�O�	�	rc�&�|jj|i|��S)z�Return a new DBAPI cursor for the underlying connection.

        This method is a proxy for the ``connection.cursor()`` DBAPI
        method.

        )rp�cursor)r�args�kwargss   rr�z_ConnectionFairy.cursor�s��&�t��%�t�6�v�6�6�6rc�,�t|j|��Sr)r�rp)r�keys  r�__getattr__z_ConnectionFairy.__getattr__�s���t���,�,�,rc�n�|j��|j}t�|��d|_d|_|j�|j��|j���|_d|_|jj	j
r)|jj	�
|j|��dSdSdS)a"Separate this connection from its Pool.

        This means that the connection will no longer be returned to the
        pool when closed, and will instead be literally closed.  The
        containing ConnectionRecord is separated from the DB-API connection,
        and will create a new connection when next used.

        Note that any overall connection limiting constraints imposed by a
        Pool implementation may be violated after a detach, as the detached
        connection is removed from the pool's knowledge and control.
        N)r~r��remover�rpr�r�r��copyrB�detachr�s  rrz_ConnectionFairy.detach�s����"�.��)�C��L�L����� �C�M�!�C�N��J�&�&�t�'>�?�?�?��	���(�(�D�I�&*�D�#��z�"�)�
A��
�#�*�*�4�?�C�@�@�@�@�@�/�.�
A�
Arc�h�|xjdzc_|jdkr|���dSdS)Nrar)r�r�rTs rrz_ConnectionFairy.closes8���
�
���
�
��=�A����M�M�O�O�O�O�O��r)NNr�)r#r$r%r&rPrpr~r�r�rxr�r��_closer�r�r�rr	r�r�r�r�r�rrrr'rrrwrw�sr��������&���
�J�C�����L��"�MC�MC�MC��[�MC�^B�B�B�
'�
'�
'��F�(.�(.�(.�T�!�!��X�!��+�+��X�+�
��,�,���,�$����X��"����>7�7�7�-�-�-�A�A�A�4����rrwr)r&�collectionsrr�r�r�rrrrr	r
r>rrr
�objectr�
Identifiedr)r{r��setr�rwr'rr�<module>rs����������������������������������������������������������-�.�.���t�{�>�*�*��
�T�[��
&�
&�
�
�
�
�
�
�6�
�
�
�6X$�X$�X$�X$�X$�3�>�X$�X$�X$�v
H=�H=�H=�H=�H=��H=�H=�H=�X;?�+$�+$�+$�+$�\	�����z�z�z�z�z�v�z�z�z�z�zr

Hacked By AnonymousFox1.0, Coded By AnonymousFox