
    -hY              	           S SK Jr  S SK Jr  S SKJr  SSK Jr  SSKJr  SSKJ	r	  SSKJ
r
  SSKJr  SS	KJr  S
S/r " S S\5      r\" \SS/ SQ/ SQ/ SQS9 " S S
\5      5       r\rg)   )class_mapper)exc)Session   )create_proxy_methods)ScopedRegistry)ThreadLocalRegistry)warn)warn_deprecatedscoped_sessionScopedSessionMixinc                   0    \ rS rSr\S 5       rS rS rSrg)r      c                 "    U R                  5       $ N)registryselfs    kC:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\site-packages\sqlalchemy/orm/scoping.py_proxiedScopedSessionMixin._proxied   s    }}    c                 V   U(       ac  U R                   R                  5       (       a  [        R                  " S5      eU R                  " S0 UD6nU R                   R                  U5        OU R                  5       nU R                  (       d  UR                  (       a  [        SS5        U$ )a  Return the current :class:`.Session`, creating it
using the :attr:`.scoped_session.session_factory` if not present.

:param \**kw: Keyword arguments will be passed to the
 :attr:`.scoped_session.session_factory` callable, if an existing
 :class:`.Session` is not present.  If the :class:`.Session` is present
 and keyword arguments have been passed,
 :exc:`~sqlalchemy.exc.InvalidRequestError` is raised.

zEScoped session is already present; no new arguments may be specified.zUsing `scoped_session` with asyncio is deprecated and will raise an error in a future version. Please use `async_scoped_session` instead.z1.4.23 )	r   hassa_excInvalidRequestErrorsession_factoryset_support_async_is_asyncior   )r   kwsesss      r   __call__ScopedSessionMixin.__call__   s     }}  ""009 
 ++1b1!!$'==?D""t'7'7= 	 r   c                     U R                   R                  5       (       a  [        S5        U R                  R                  " S0 UD6  g)zureconfigure the :class:`.sessionmaker` used by this
:class:`.scoped_session`.

See :meth:`.sessionmaker.configure`.

ztAt least one scoped session is already present.  configure() can not affect sessions that have already been created.Nr   )r   r   r
   r   	configure)r   kwargss     r   r'   ScopedSessionMixin.configure9   s=     ==( 	&&00r   r   N)	__name__
__module____qualname____firstlineno__propertyr   r$   r'   __static_attributes__r   r   r   r   r      s     >1r   z:class:`_orm.Session`z$:class:`_orm.scoping.scoped_session`)	close_allobject_sessionidentity_key)__contains____iter__addadd_allbeginbegin_nestedclosecommit
connectiondeleteexecuteexpire
expire_allexpungeexpunge_allflushgetget_bindis_modifiedbulk_save_objectsbulk_insert_mappingsbulk_update_mappingsmergequeryrefreshrollbackscalarscalars)
binddirtydeletednewidentity_map	is_active	autoflushno_autoflushinfo
autocommit)classmethodsmethods
attributesc                   <    \ rS rSrSrSrSr S	S jrS rS	S jr	Sr
g)
r   K   a  Provides scoped management of :class:`.Session` objects.

See :ref:`unitofwork_contextual` for a tutorial.

.. note::

   When using :ref:`asyncio_toplevel`, the async-compatible
   :class:`_asyncio.async_scoped_session` class should be
   used in place of :class:`.scoped_session`.

FNc                 `    Xl         U(       a  [        X5      U l        g[        U5      U l        g)aq  Construct a new :class:`.scoped_session`.

:param session_factory: a factory to create new :class:`.Session`
 instances. This is usually, but not necessarily, an instance
 of :class:`.sessionmaker`.
:param scopefunc: optional function which defines
 the current scope.   If not passed, the :class:`.scoped_session`
 object assumes "thread-local" scope, and will use
 a Python ``threading.local()`` in order to maintain the current
 :class:`.Session`.  If passed, the function should return
 a hashable token; this token will be used as the key in a
 dictionary in order to store and retrieve the current
 :class:`.Session`.

N)r   r   r   r	   )r   r   	scopefuncs      r   __init__scoped_session.__init__   s%       /*?FDM/@DMr   c                     U R                   R                  5       (       a  U R                  5       R                  5         U R                   R                  5         g)a  Dispose of the current :class:`.Session`, if present.

This will first call :meth:`.Session.close` method
on the current :class:`.Session`, which releases any existing
transactional/connection resources still being held; transactions
specifically are rolled back.  The :class:`.Session` is then
discarded.   Upon next usage within the same scope,
the :class:`.scoped_session` will produce a new
:class:`.Session` object.

N)r   r   r9   clearr   s    r   removescoped_session.remove   s9     ==MMO!!#r   c                 :   ^ ^  " UU 4S jS[         5      nU" 5       $ )a  return a class property which produces a :class:`_query.Query`
object
against the class and the current :class:`.Session` when called.

e.g.::

    Session = scoped_session(sessionmaker())

    class MyClass(object):
        query = Session.query_property()

    # after mappers are defined
    result = MyClass.query.filter(MyClass.name=='foo').all()

Produces instances of the session's configured query class by
default.  To override and use a custom implementation, provide
a ``query_cls`` callable.  The callable will be invoked with
the class's mapper as a positional argument and a session
keyword argument.

There is no limit to the number of query properties placed on
a class.

c                   $   > \ rS rSrU U4S jrSrg),scoped_session.query_property.<locals>.query   c                    >  [        U5      nU(       a;  T(       a  T" UTR                  5       S9$ TR                  5       R                  U5      $ g ! [        R                   a     g f = f)N)session)r   r   rJ   orm_excUnmappedClassError)sinstanceownermapper	query_clsr   s       r   __get__4scoped_session.query_property.<locals>.query.__get__   sc    
 )%0F$#,VT]]_#MM $(==?#8#8#@@  11   s   -A A A('A(r   N)r*   r+   r,   r-   rs   r/   )rr   r   s   r   rJ   rh      s       r   rJ   )object)r   rr   rJ   s   `` r   query_propertyscoped_session.query_property   s    4	  	 F 	  wr   )r   r   r   )r*   r+   r,   r-   __doc__r    r   r`   rd   rv   r/   r   r   r   r   r   K   s)    b
 NO
A."(r   N) r   r   rl   rk   r   r   utilr   r   r	   r
   r   __all__ru   r   r   ScopedSessionr   r   r   <module>r}      s        ' ! &  "1
231 31l *@<G/`e' ea/`eP  +r   