%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyc

�
��4]c@�sUdZddlmZddlmZddlZddlmZddlZddlm	Z	ddlm
Z
d	d
lmZd	dlmZd	dlm
Z
d
e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	threadingt
RefCollectioncB�seZdZd�ZRS(trefcC�stj|tj�S(N(tweakrefR	Rt_collection_gced(tself((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt_memoized_attr_ref1s(R	(t__name__t
__module__t	__slots__R
(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR.st_empty_collectioncB�s5eZd�Zd�Zd�Zd�Zd�ZRS(cC�sdS(N((Rtelement((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pytappend6scC�sdS(N((Rtother((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pytextend9scC�sdS(N((RR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pytremove<scC�s
tg�S(N(titer(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt__iter__?scC�sdS(N((R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pytclearBs(RRRRRRR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR5s
				t_ClsLevelDispatchcB�sneZdZdZd�Zd�Zd	�Zd
�Zd�Zd�Z	d
�Z
d�Zd�Zd�Z
RS(s2Class-level events on :class:`._Dispatch` classes.tnamet	arg_namesthas_kwtlegacy_signaturest	_clslevelt__weakref__cC�s�|j|_tj|�}|jd|_t|j�|_t	t
tt|dg�dd����|_
tj|||�|_tj�|_dS(Nit_legacy_signaturestkeycS�s|dS(Ni((ts((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt<lambda>Zt(RRRtinspect_getfullargspectargsRtbooltvarkwRtlisttreversedtsortedtgetattrRRt_augment_fn_docst__doc__R
tWeakKeyDictionaryR(Rtparent_dispatch_clstfntargspec((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt__init__Rs'cC�sj|r|j|�}n|jrfytj|dt�}Wntk
rMqfXtj|||�}n|S(Ntno_self(t_wrap_fn_for_kwRRtget_callable_argspectTruet	TypeErrorRt_wrap_fn_for_legacy(RR2tnamedR3((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt_adjust_fn_specbs	
c�s��fd�}|S(Nc�s/tt�j|��}|j|��|�S(N(tdicttzipRtupdate(R'tkwtargdict(R2R(sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pytwrap_kwos
((RR2RB((R2RsH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR6nscC�s�|j}t|t�s$td��t|dt�sLtjd|��n|g}x�|r�|jd�}|j	|j
��||k	r�||jkr�|j|�qX||jkr�|j
|�n|j|j|j�qXWtj||�dS(Ns*Class-level Event targets must be classes.t_sa_propagate_class_eventss.Can't assign an event directly to the %s classi(tdispatch_targett
isinstancettypetAssertionErrorR-R8RtInvalidRequestErrortpopRt__subclasses__Rtupdate_subclasst_assign_cls_collectiont
appendleftt
_listen_fnRt_stored_in_collection(Rt	event_keyt	propagatettargettstacktcls((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pytinsertvs"				cC�s�|j}t|t�s$td��t|dt�sLtjd|��n|g}x�|r�|jd�}|j	|j
��||k	r�||jkr�|j|�qX||jkr�|j
|�n|j|j|j�qXWtj||�dS(Ns*Class-level Event targets must be classes.RCs.Can't assign an event directly to the %s classi(RDRERFRGR-R8RRHRIRRJRRKRLRRNRRO(RRPRQRRRSRT((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR�s"				cC�s<t|dt�r(tj�|j|<nt�|j|<dS(NRC(R-R8tcollectionstdequeRR(RRR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRL�scC�s�||jkr|j|�n|j|}xZ|jdD]K}||jkr:|jg|j|D]}||krc|^qc�q:q:WdS(Ni(RRLt__mro__R(RRRtclslevelRTR2((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRK�s
cC�s~|j}|g}xU|ri|jd�}|j|j��||jkr|j|j|j�qqWtj||�dS(Ni(	RDRIRRJRRRNRt_removed_from_collection(RRPRRRSRT((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR�s			cC�sNt�}x.|jj�D]}|j|�|j�qWtj||�dS(sClear all class level listenersN(tsetRtvaluesR?RRt_clear(Rtto_cleart
dispatcher((sH/opt/alt/python27/lib64/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((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt
for_modify�s(RRRRRR (RRR/RR4R<R6RURRLRKRRRa(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRFs"							
	
		t_InstanceLevelDispatchcB�seZdZd�ZRS(cC�s|jj||�S(N(tparentR<(RR2R;((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR<�s((RRRR<(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRb�st_EmptyListenercB�s~eZdZe�ZdZdZd�Zd�Zd�Z	e	Z
ZZZ
Zd�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.

    Rctparent_listenersRcC�sH||jkr|j|�n||_|j||_|j|_dS(N(RRKRcReR(RRct
target_cls((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR4�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_ListenerCollectionRct
_instance_clsR-RtsetattrREt_JoinedListenerRG(RR`tresult((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRa�s
	!cO�std��dS(Nsneed to call for_modify()(tNotImplementedError(RR'R@((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt
_needs_modify�scO�s%x|jD]}|||�q
WdS(sExecute this event.N(Re(RR'R@R2((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt__call__�scC�s
t|j�S(N(tlenRe(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt__len__scC�s
t|j�S(N(RRe(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRscC�s
t|j�S(N(R(Re(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt__bool__s((RcReR(RRR/t	frozensetRQt	listenersRR4RaRmt	exec_onceRURRRRnRpRRqt__nonzero__(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRd�s								t_CompoundListenercB�sJeZdZd�Zd�Zd�Zd�Zd�Zd�ZeZ	RS(	t_exec_once_mutext
_exec_oncecC�s
tj�S(N(RtLock(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt_memoized_attr__exec_once_mutexsc	O�sJ|jsF|j�/|js=z|||�Wdt|_XnWdQXndS(s]Execute this event, but only if it has not been
        executed already for this collection.N(RxRwR8(RR'R@((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRts	
	cO�sFx|jD]}|||�q
Wx|jD]}|||�q+WdS(sExecute this event.N(ReRs(RR'R@R2((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRn#scC�st|j�t|j�S(N(RoReRs(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRp+scC�st|j|j�S(N(RReRs(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR.scC�st|jp|j�S(N(R(RsRe(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRq1s(RwRx(
RRRRzRtRnRpRRqRu(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRvs						RgcB�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.

    ReRcRRsRQR cC�sl||jkr|j|�nt|_|j||_||_|j|_tj�|_	t
�|_dS(N(RRKtFalseRxReRcRRVRWRsR[RQ(RRcRf((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR4Js		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R`((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRaTscC�s�|j}t|�}|jj|j�g|jD].}||krK|sZ||jkr2|^q2}|j|�|jj|�}tj|||�dS(sMPopulate from the listeners in another :class:`_Dispatch`
            object.N(RsR[RQR?RtunionRt_stored_in_collection_multi(RRtonly_propagatetexisting_listenerstexisting_listener_settltother_listenerstto_associate((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt_update]s	

cC�s8|j||j�r4|r4|jj|j�q4ndS(N(tprepend_to_listRsRQtaddRN(RRPRQ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRUqscC�s8|j||j�r4|r4|jj|j�q4ndS(N(tappend_to_listRsRQR�RN(RRPRQ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRvscC�s:|jj|j�|jj|j�tj||�dS(N(RsRRNRQtdiscardRRZ(RRP((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR{scC�s1tj||j�|jj�|jj�dS(N(RR]RsRQR(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR�s
(ReRcRRsRQR (RRR/RR4RaR8R�RURRR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRg7s	
					RjcB�s\eZdZd�Zed��Zd�Zd�Zd�Zd	�Z	d
�Z
d�ZRS(
RcRtlocalRecC�s4t|_||_||_||_|j|_dS(N(R{RxRcRR�Re(RRcRR�((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR4�s
				cC�st|j|j�S(N(R-RcR(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRs�scC�s|jj||�S(N(R�R<(RR2R;((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR<�scC�s |jj|�|_|_|S(N(R�RaRe(RR`((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRa�scC�s|jj||�dS(N(R�RU(RRPRQ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRU�scC�s|jj||�dS(N(R�R(RRPRQ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR�scC�s|jj|�dS(N(R�R(RRP((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR�scC�s
t��dS(N(Rl(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR�s(RcRR�Re(RRRR4tpropertyRsR<RaRURRR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRj�s						(R/t
__future__RRRVt	itertoolsRR
R%RRRRRt
MemoizedSlotsRtobjectRRRbRdRvRgRj(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt<module>s$�=&O

Zerion Mini Shell 1.0