HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyc
�
���ec@�sedZddlmZddlmZddlZddlmZddlZddlm	Z	ddlm
Z
d	d
lmZd	dlmZd	dlm
Z
d	d
lmZdejfd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdS(s�Attribute implementation for _Dispatch classes.

The various listener targets for a particular event class are represented
as attributes, which refer to collections of listeners to be fired off.
These collections can exist at the class level as well as at the instance
level.  An event is fired off using code like this::

    some_object.dispatch.first_connect(arg1, arg2)

Above, ``some_object.dispatch`` would be an instance of ``_Dispatch`` and
``first_connect`` is typically an instance of ``_ListenerCollection``
if event listeners are present, or ``_EmptyListener`` if none are present.

The attribute mechanics here spend effort trying to ensure listener functions
are available with a minimum of function call overhead, that unnecessary
objects aren't created (i.e. many empty per-instance listener collections),
as well as that everything is garbage collectable when owning references are
lost.  Other features such as "propagation" of listener functions across
many ``_Dispatch`` instances, "joining" of multiple ``_Dispatch`` instances,
as well as support for subclass propagation (e.g. events assigned to
``Pool`` vs. ``QueuePool``) are all implemented here.

i(tabsolute_import(twith_statementN(tchaini(tlegacy(tregistryi(texc(tutil(t	threading(tAsyncAdaptedLockt
RefCollectioncB�seZdZd�ZRS(trefcC�stj|tj�S(N(tweakrefR
Rt_collection_gced(tself((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt_memoized_attr_ref2s(R
(t__name__t
__module__t	__slots__R(((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR	/st_empty_collectioncB�s5eZd�Zd�Zd�Zd�Zd�ZRS(cC�sdS(N((R
telement((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pytappend7scC�sdS(N((R
tother((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pytextend:scC�sdS(N((R
R((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pytremove=scC�s
tg�S(N(titer(R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt__iter__@scC�sdS(N((R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pytclearCs(RRRRRRR(((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR6s
				t_ClsLevelDispatchcB�sneZdZdZd�Zd	�Zd
�Zd�Zd�Zd
�Z	d�Z
d�Zd�Zd�Z
RS(s2Class-level events on :class:`._Dispatch` classes.tclsnametnamet	arg_namesthas_kwtlegacy_signaturest	_clslevelt__weakref__cC�s�|j|_|j|_tj|�}|jd|_t|j�|_	t
ttt
|dg�dd����|_tj|||�|_tj�|_dS(Nit_legacy_signaturestkeycS�s|dS(Ni((ts((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt<lambda>]t(RRRRtinspect_getfullargspectargsRtbooltvarkwRtlisttreversedtsortedtgetattrR Rt_augment_fn_docst__doc__RtWeakKeyDictionaryR!(R
tparent_dispatch_clstfntargspec((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt__init__Ts'cC�sj|r|j|�}n|jrfytj|dt�}Wntk
rMqfXtj|||�}n|S(Ntno_self(t_wrap_fn_for_kwR Rtget_callable_argspectTruet	TypeErrorRt_wrap_fn_for_legacy(R
R4tnamedR5((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt_adjust_fn_speces	
c�s��fd�}|S(Nc�s/tt�j|��}|j|��|�S(N(tdicttzipRtupdate(R)tkwtargdict(R4R
(sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pytwrap_kwrs
((R
R4RD((R4R
sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR8qscC�s�|j}t|t�s$td��t|dt�sOtjd|f��nx�tj	|�D]�}||k	r�||j
kr�|j|�q_||j
kr�|j|�n|r�|j
|j|j
�q_|j
|j|j
�q_Wtj||�dS(Ns*Class-level Event targets must be classes.t_sa_propagate_class_eventss.Can't assign an event directly to the %s class(tdispatch_targett
isinstancettypetAssertionErrorR/R:RtInvalidRequestErrorRtwalk_subclassesR!tupdate_subclassRt
_listen_fnt
appendleftRt_stored_in_collection(R
t	event_keyt	is_appendttargettcls((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt_do_insert_or_appendys 		cC�s|j|dt�dS(NRQ(RTtFalse(R
RPt	propagate((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pytinsert�scC�s|j|dt�dS(NRQ(RTR:(R
RPRV((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR�scC�s�||jkrJt|dt�r7tj�|j|<qJt�|j|<n|j|}xZ|jdD]K}||jkre|jg|j|D]}||kr�|^q��qeqeWdS(NREi(R!R/R:tcollectionstdequeRt__mro__R(R
RRtclslevelRSR4((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRL�s
cC�s`|j}x@tj|�D]/}||jkr|j|j|j�qqWtj||�dS(N(RFRRKR!RRMRt_removed_from_collection(R
RPRRRS((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR�s
	cC�sNt�}x.|jj�D]}|j|�|j�qWtj||�dS(sClear all class level listenersN(tsetR!tvaluesRARRt_clear(R
tto_cleart
dispatcher((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR�s
	
cC�s|S(s�Return an event collection which can be modified.

        For _ClsLevelDispatch at the class level of
        a dispatcher, this returns self.

        ((R
tobj((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt
for_modify�s(RRRRR R!R"(RRR1RR6R>R8RTRWRRLRRRc(((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRGs$										t_InstanceLevelDispatchcB�seZdZd�ZRS(cC�s|jj||�S(N(tparentR>(R
R4R=((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR>�s((RRRR>(((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRd�st_EmptyListenercB�s�eZdZe�ZdZdZd�Zd�Zd�Z	e	Z
ZZZ
ZZd�Zd�Zd	�Zd
�ZeZRS(
s�Serves as a proxy interface to the events
    served by a _ClsLevelDispatch, when there are no
    instance-level events present.

    Is replaced by _ListenerCollection when instance-level
    events are added.

    Retparent_listenersRcC�sH||jkr|j|�n||_|j||_|j|_dS(N(R!RLReRgR(R
Ret
target_cls((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR6�s
	cC�sht|j|j�}t||j�|krCt||j|�n!tt||j�t�sdt�|S(s�Return an event collection which can be modified.

        For _EmptyListener at the instance level of
        a dispatcher, this generates a new
        _ListenerCollection, applies it to the instance,
        and returns it.

        (	t_ListenerCollectionRet
_instance_clsR/RtsetattrRGt_JoinedListenerRI(R
Rbtresult((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRc�s
	!cO�std��dS(Nsneed to call for_modify()(tNotImplementedError(R
R)RB((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt
_needs_modify�scO�s%x|jD]}|||�q
WdS(sExecute this event.N(Rg(R
R)RBR4((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt__call__�scC�s
t|j�S(N(tlenRg(R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt__len__�scC�s
t|j�S(N(RRg(R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR�scC�s
t|j�S(N(R*Rg(R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt__bool__�s((ReRgR(RRR1t	frozensetRVt	listenersRR6RcRot	exec_oncetexec_once_unless_exceptionRWRRRRpRrRRst__nonzero__(((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRf�s								t_CompoundListenercB�sweZdZd�Zd�Zd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
e
ZRS(t_exec_once_mutext
_exec_oncet_exec_w_sync_oncet_is_asynciocO�s&tt|�j||�t|_dS(N(tsuperRyR6RUR}(R
targRB((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR6
scC�s
t|_dS(N(R:R}(R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt_set_asyncioscC�s|jrt�Stj�SdS(N(R}RRtLock(R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt_memoized_attr__exec_once_mutexs	c	O�sl|j�]|jsbz.y|||�t}Wnt}�nXWd|sR|r^t|_nXnWdQXdS(N(RzR{RUR:(R
tretry_on_exceptionR)RBt	exception((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt_exec_once_impls
	

cO�s#|js|jt||�ndS(s]Execute this event, but only if it has not been
        executed already for this collection.N(R{R�RU(R
R)RB((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRv's	cO�s#|js|jt||�ndS(stExecute this event, but only if it has not been
        executed already for this collection, or was called
        by a previous exec_once_unless_exception call and
        raised an exception.

        If exec_once was already called, then this method will never run
        the callable regardless of whether it raised or not.

        .. versionadded:: 1.3.8

        N(R{R�R:(R
R)RB((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRw.s	cO�sT|jsC|j�,y|||�Wn
�n
Xt|_WdQXn
|||�dS(snExecute this event, and use a mutex if it has not been
        executed already for this collection, or was called
        by a previous _exec_w_sync_on_first_run call and
        raised an exception.

        If _exec_w_sync_on_first_run was already called and didn't raise an
        exception, then a mutex is not used.

        .. versionadded:: 1.4.11

        N(R|RzR:(R
R)RB((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt_exec_w_sync_on_first_run=s	
cO�sFx|jD]}|||�q
Wx|jD]}|||�q+WdS(sExecute this event.N(RgRu(R
R)RBR4((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRpTscC�st|j�t|j�S(N(RqRgRu(R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRr\scC�st|j|j�S(N(RRgRu(R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR_scC�st|jp|j�S(N(R*RuRg(R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRsbs(RzR{R|R}(RRRR6R�R�R�RvRwR�RpRrRRsRx(((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRys 				
							RicB�sVeZdZdZd�Zd�Zed	�Zd
�Zd�Z	d�Z
d
�ZRS(s�Instance-level attributes on instances of :class:`._Dispatch`.

    Represents a collection of listeners.

    As of 0.7.9, _ListenerCollection is only first
    created via the _EmptyListener.for_modify() method.

    RgReRRuRVR"cC�s�tt|�j�||jkr2|j|�nt|_t|_|j||_||_	|j
|_
tj�|_
t�|_dS(N(R~RiR6R!RLRUR{R|RgReRRXRYRuR]RV(R
ReRh((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR6{s			cC�s|S(s�Return an event collection which can be modified.

        For _ListenerCollection at the instance level of
        a dispatcher, this returns self.

        ((R
Rb((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRc�scC�s�|j}t|�}|jj|j�g|jD].}||krK|sZ||jkr2|^q2}|j|�|jr�|j�n|jj|�}tj	|||�dS(sIPopulate from the listeners in another :class:`_Dispatch`
        object.N(
RuR]RVRARR}R�tunionRt_stored_in_collection_multi(R
Rtonly_propagatetexisting_listenerstexisting_listener_settltother_listenerstto_associate((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt_update�s	

	
cC�s8|j||j�r4|r4|jj|j�q4ndS(N(tprepend_to_listRuRVtaddRM(R
RPRV((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRW�scC�s8|j||j�r4|r4|jj|j�q4ndS(N(tappend_to_listRuRVR�RM(R
RPRV((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR�scC�s:|jj|j�|jj|j�tj||�dS(N(RuRRMRVtdiscardRR\(R
RP((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR�scC�s1tj||j�|jj�|jj�dS(N(RR_RuRVR(R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR�s
(RgReRRuRVR"(RRR1RR6RcR:R�RWRRR(((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRihs						RlcB�s\eZdZd�Zed��Zd�Zd�Zd�Zd	�Z	d
�Z
d�ZRS(
ReRtlocalRgcC�s4t|_||_||_||_|j|_dS(N(RUR{ReRR�Rg(R
ReRR�((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR6�s
				cC�st|j|j�S(N(R/ReR(R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRu�scC�s|jj||�S(N(R�R>(R
R4R=((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR>�scC�s |jj|�|_|_|S(N(R�RcRg(R
Rb((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRc�scC�s|jj||�dS(N(R�RW(R
RPRV((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRW�scC�s|jj||�dS(N(R�R(R
RPRV((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR�scC�s|jj|�dS(N(R�R(R
RP((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR�scC�s
t��dS(N(Rn(R
((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyR�s(ReRR�Rg(RRRR6tpropertyRuR>RcRWRRR(((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyRl�s						(R1t
__future__RRRXt	itertoolsRRR'RRRRRtutil.concurrencyRt
MemoizedSlotsR	tobjectRRRdRfRyRiRl(((sF/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/event/attr.pyt<module>s&x?cT