403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.144.16.26
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/orm/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/orm/__pycache__/scoping.cpython-37.pyc
B

��4]��@s�ddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dgZGd	d�de�Z
e
Zd
d�ZxejD]Zee
eee��q~Wdd
�ZxdD]Zee
eee��q�Wdd�ZxdD]Zee
eee��q�WdS)�)�class_mapper)�exc)�Session�)�ScopedRegistry)�ThreadLocalRegistry)�warn�scoped_sessionc@s@eZdZdZdZd
dd�Zdd�Zdd�Zd	d
�Zddd�Z	dS)r	ztProvides scoped management of :class:`.Session` objects.

    See :ref:`unitofwork_contextual` for a tutorial.

    NcCs&||_|rt||�|_n
t|�|_dS)a�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)�session_factoryr�registryr)�selfr
Z	scopefunc�r
�I/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/orm/scoping.py�__init__!szscoped_session.__init__cKsD|r8|j��rt�d��q@|jf|�}|j�|�|Sn|��SdS)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.N)r�has�sa_excZInvalidRequestErrorr
�set)r�kwZsessr
r
r�__call__8s
zscoped_session.__call__cCs$|j��r|����|j��dS)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)rr�close�clear)rr
r
r�removePs
zscoped_session.removecKs$|j��rtd�|jjf|�dS)z�reconfigure 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.N)rrrr
�	configure)r�kwargsr
r
rras
zscoped_session.configurecsG��fdd�dt�}|�S)a"return a class property which produces a :class:`.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.

        cseZdZ��fdd�ZdS)z,scoped_session.query_property.<locals>.querycsNy2t|�}|r0�r"�|���d�S����|�SWntjk
rHdSXdS)N)�session)rr�query�orm_excZUnmappedClassError)�s�instance�ownerZmapper)�	query_clsrr
r�__get__�sz4scoped_session.query_property.<locals>.query.__get__N)�__name__�
__module__�__qualname__r!r
)r rr
rr�sr)�object)rr rr
)r rr�query_propertyrszscoped_session.query_property)N)N)
r"r#r$�__doc__r
rrrrr&r
r
r
rr	s
cs�fdd�}|S)Ncst|����||�S)N)�getattrr)r�argsr)�namer
r�do�szinstrument.<locals>.dor
)r*r+r
)r*r�
instrument�sr,cs"�fdd�}�fdd�}t||�S)Ncst|���|�dS)N)�setattrr)r�attr)r*r
r�set_�szmakeprop.<locals>.set_cst|����S)N)r(r)r)r*r
r�get�szmakeprop.<locals>.get)�property)r*r/r0r
)r*r�makeprop�sr2)
�bindZdirtyZdeleted�newZidentity_mapZ	is_activeZ	autoflushZno_autoflush�infoZ
autocommitcs�fdd�}t|�S)Ncstt��||�S)N)r(r)�clsr)r)r*r
rr+�szclslevel.<locals>.do)�classmethod)r*r+r
)r*r�clslevel�sr8)Z	close_allZobject_sessionZidentity_keyN)�rrrrrr�utilrrr�__all__r%r	Z
ScopedSessionr,Zpublic_methods�methr-r2Zpropr8r
r
r
r�<module>s(	



Youez - 2016 - github.com/yon3zu
LinuXploit