관리-도구
편집 파일: events.cpython-38.pyc
U -?�f[3 � @ s� d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ ddlmZ dd lm Z dd lm Z ddlmZ dd lm Z ddlmZ ejr�ddlmZ ddlmZ G dd� de je �ZdS )� )�annotationsN)�Any)�Optional)�Type)�Union� )�ConnectionPoolEntry)�Pool)�PoolProxiedConnection)�PoolResetState� )�event)�util)�Engine)�DBAPIConnectionc @ s e Zd ZdZdZeZe�d�e dddd�dd ���Z e d ddd �dd��Zdddd�dd�Zdddd�dd�Z ddddd�dd�Zdddd�dd�Ze�ddd gd!d"� �ddd#dd$�d%d&��Zddd'dd(�d)d*�Zddd'dd(�d+d,�Zdddd�d-d.�Zdddd�d/d0�Zddd1�d2d3�Zd4S )5� PoolEventsa� Available events for :class:`_pool.Pool`. The methods here define the name of an event as well as the names of members that are passed to listener functions. e.g.:: from sqlalchemy import event def my_on_checkout(dbapi_conn, connection_rec, connection_proxy): "handle an on checkout event" event.listen(Pool, 'checkout', my_on_checkout) In addition to accepting the :class:`_pool.Pool` class and :class:`_pool.Pool` instances, :class:`_events.PoolEvents` also accepts :class:`_engine.Engine` objects and the :class:`_engine.Engine` class as targets, which will be resolved to the ``.pool`` attribute of the given engine or the :class:`_pool.Pool` class:: engine = create_engine("postgresql+psycopg2://scott:tiger@localhost/test") # will associate with engine.pool event.listen(engine, 'checkout', my_on_checkout) ZSomeEngineOrPoolzsqlalchemy.enginez-Union[Pool, Type[Pool], Engine, Type[Engine]]�strz!Optional[Union[Pool, Type[Pool]]])�target� identifier�returnc C sv t jstjjj}t|t�r<t||�r(t S t|t �s6t �|S n6t||�rL|jS t|t �rZ|S t|d�rn|� � nd S d S )N�_no_async_engine_events)�typing� TYPE_CHECKINGr Z preloaded�enginer � isinstance�type� issubclassr �AssertionError�pool�hasattrr )�clsr r r � r! �F/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/pool/events.py�_accept_with; s zPoolEvents._accept_withzevent._EventKey[Pool]r �None)� event_key�kwr c K s$ |j }|�d|j� |jf |� d S )NZasyncio)Zdispatch_target� setdefaultZ_is_asyncioZbase_listen)r r% r&