U
    ÌZj�  ã                    @   s¦   d dl mZ ddlmZ ddlmZ ddlmZ eedddd	d
gdddddddddddddddddddddd d!d"d#d$d%gd&d'd(d)d*d+d,d-d.g	d/�G d0d1„ d1eƒƒZd2S )3é   )Ú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_sessionz¨Provides 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   úa/var/www/html/TRUCKING_PROJECT/venv/lib/python3.8/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 )zÎDispose 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`   å÷Þ.