o
    Rc                     @   sd   d dl mZ ddlmZ ddlmZ ddlmZ eeddg dg d	g d
dG dd deZdS )   )AsyncSession   )ScopedSessionMixin)create_proxy_methods)ScopedRegistryz:class:`_asyncio.AsyncSession`z.:class:`_asyncio.scoping.async_scoped_session`)Z	close_allZobject_sessionZidentity_key)__contains____iter__addZadd_allbeginZbegin_nestedclosecommit
connectiondeleteexecuteZexpireZ
expire_allZexpungeZexpunge_allflushgetZget_bindZis_modifiedZ
invalidatemergerefreshrollbackZscalarZscalarsstreamZstream_scalars)	bindZdirtyZdeletednewZidentity_mapZ	is_activeZ	autoflushZno_autoflushinfo)Zclassmethodsmethods
attributesc                   @   s0   e Zd ZdZdZdd Zedd Zdd Zd	S )
async_scoped_sessionzProvides scoped management of :class:`.AsyncSession` objects.

    See the section :ref:`asyncio_scoped_session` for usage details.

    .. versionadded:: 1.4.19


    Tc                 C   s   || _ t||| _dS )a  Construct a new :class:`_asyncio.async_scoped_session`.

        :param session_factory: a factory to create new :class:`_asyncio.AsyncSession`
         instances. This is usually, but not necessarily, an instance
         of :class:`_orm.sessionmaker` which itself was passed the
         :class:`_asyncio.AsyncSession` to its :paramref:`_orm.sessionmaker.class_`
         parameter::

            async_session_factory = sessionmaker(some_async_engine, class_= AsyncSession)
            AsyncSession = async_scoped_session(async_session_factory, scopefunc=current_task)

        :param scopefunc: function which defines
         the current scope.   A function such as ``asyncio.current_task``
         may be useful here.

        N)session_factoryr   registry)selfr   Z	scopefunc r   @D:\Flask\env\Lib\site-packages\sqlalchemy/ext/asyncio/scoping.py__init__H   s   zasync_scoped_session.__init__c                 C   s   |   S )N)r   r   r   r   r    _proxied]   s   zasync_scoped_session._proxiedc                    s,   | j  r|    I dH  | j   dS )zDispose of the current :class:`.AsyncSession`, if present.

        Different from scoped_session's remove method, this method would use
        await to wait for the close method of AsyncSession.

        N)r   hasr   clearr"   r   r   r    removea   s   
zasync_scoped_session.removeN)	__name__
__module____qualname____doc__Z_support_asyncr!   propertyr#   r&   r   r   r   r    r      s    /	
r   N)sessionr   Zorm.scopingr   utilr   r   r   r   r   r   r    <module>   s   .