o
    g                     @  s   d dl mZ d dlZd dlZd dlmZ d dlmZ ejr/ddlmZ ddl	m
Z
 ddl	mZ G d	d
 d
ejZG dd deZG dd deZdS )    )annotationsN)Any)ClassVar   )
Connection)DBAPIConnection)Dialectc                   @  sf   e Zd ZU dZdZdZded< ejdddZ	ejdddZ
dddZejdddZdddZdS ) ConnectionCharacteristica  An abstract base for an object that can set, get and reset a
    per-connection characteristic, typically one that gets reset when the
    connection is returned to the connection pool.

    transaction isolation is the canonical example, and the
    ``IsolationLevelCharacteristic`` implementation provides this for the
    ``DefaultDialect``.

    The ``ConnectionCharacteristic`` class should call upon the ``Dialect`` for
    the implementation of each method.   The object exists strictly to serve as
    a dialect visitor that can be placed into the
    ``DefaultDialect.connection_characteristics`` dictionary where it will take
    effect for calls to :meth:`_engine.Connection.execution_options` and
    related APIs.

    .. versionadded:: 1.4

     FClassVar[bool]transactionaldialectr   
dbapi_connr   returnNonec                 C     dS )zNReset the characteristic on the DBAPI connection to its default
        value.Nr
   selfr   r   r
   r
   c/var/www/html/ecg_monitoring/venv/lib/python3.10/site-packages/sqlalchemy/engine/characteristics.pyreset_characteristic,       z-ConnectionCharacteristic.reset_characteristicvaluer   c                 C  r   )z<set characteristic on the DBAPI connection to a given value.Nr
   r   r   r   r   r
   r
   r   set_characteristic3   r   z+ConnectionCharacteristic.set_characteristicconnr   c                 C  s   |  ||| dS )zset characteristic on the :class:`_engine.Connection` to a given
        value.

        .. versionadded:: 2.0.30 - added to support elements that are local
           to the :class:`_engine.Connection` itself.

        N)r   r   r   r   r   r   r
   r
   r   set_connection_characteristic9   s   z6ConnectionCharacteristic.set_connection_characteristicc                 C  r   )zXGiven a DBAPI connection, get the current value of the
        characteristic.

        Nr
   r   r
   r
   r   get_characteristicI   r   z+ConnectionCharacteristic.get_characteristicc                 C  s   |  ||S )zGiven a :class:`_engine.Connection`, get the current value of the
        characteristic.

        .. versionadded:: 2.0.30 - added to support elements that are local
           to the :class:`_engine.Connection` itself.

        )r   r   r   r   r   r
   r
   r   get_connection_characteristicR   s   
z6ConnectionCharacteristic.get_connection_characteristicNr   r   r   r   r   r   r   r   r   r   r   r   r   r   
r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )__name__
__module____qualname____doc__	__slots__r   __annotations__abcabstractmethodr   r   r   r   r   r
   r
   r
   r   r	      s   
 
r	   c                   @  s<   e Zd ZU dZdZded< dddZdddZdddZdS )IsolationLevelCharacteristicz0Manage the isolation level on a DBAPI connectionTr   r   r   r   r   r   r   r   c                 C  s   | | d S N)reset_isolation_levelr   r
   r
   r   r   d      z1IsolationLevelCharacteristic.reset_characteristicr   r   c                 C  s   | || d S r.   )_assert_and_set_isolation_levelr   r
   r
   r   r   i   s   z/IsolationLevelCharacteristic.set_characteristicc                 C  s
   | |S r.   )get_isolation_levelr   r
   r
   r   r   n   s   
z/IsolationLevelCharacteristic.get_characteristicNr    r!   r#   )	r%   r&   r'   r(   r   r*   r   r   r   r
   r
   r
   r   r-   _   s   
 

r-   c                   @  sP   e Zd ZU dZdZded< dddZdddZdddZdddZ	dddZ
dS )LoggingTokenCharacteristiczgManage the 'logging_token' option of a :class:`_engine.Connection`.

    .. versionadded:: 2.0.30

    Fr   r   r   r   r   r   r   r   c                 C  s   d S r.   r
   r   r
   r
   r   r   }   s   z/LoggingTokenCharacteristic.reset_characteristicr   r   c                 C     t  r.   NotImplementedErrorr   r
   r
   r   r         z-LoggingTokenCharacteristic.set_characteristicr   r   c                   s    r fdd|_ d S |` d S )Nc                   s   d | f S )Nz[%s] %sr
   )msgr   r
   r   <lambda>   s    zJLoggingTokenCharacteristic.set_connection_characteristic.<locals>.<lambda>)_message_formatterr   r
   r9   r   r      s   z8LoggingTokenCharacteristic.set_connection_characteristicc                 C  r4   r.   r5   r   r
   r
   r   r      r7   z-LoggingTokenCharacteristic.get_characteristicc                 C  s   |j dd S )Nlogging_token)_execution_optionsgetr   r
   r
   r   r      r0   z8LoggingTokenCharacteristic.get_connection_characteristicNr    r!   r"   r#   r$   )r%   r&   r'   r(   r   r*   r   r   r   r   r   r
   r
   r
   r   r3   t   s   
 



r3   )
__future__r   r+   typingr   r   TYPE_CHECKINGbaser   
interfacesr   r   ABCr	   r-   r3   r
   r
   r
   r   <module>   s   K