%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.pyo

�
��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|dt�s1tjd|��n|g}x�|r�|jd�}|j|j��||k	r�||jkr�|j	|�q=||jkr�|j
|�n|j|j|j�q=Wt
j||�dS(Nt_sa_propagate_class_eventss.Can't assign an event directly to the %s classi(tdispatch_targetR-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|dt�s1tjd|��n|g}x�|r�|jd�}|j|j��||k	r�||jkr�|j	|�q=||jkr�|j
|�n|j|j|j�q=Wt
j||�dS(NRCs.Can't assign an event directly to the %s classi(RDR-R8RRERFRRGRRHRIRRKRRL(RRMRNRORPRQ((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RO((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRI�scC�s�||jkr|j|�n|j|}xZ|jdD]K}||jkr:|jg|j|D]}||krc|^qc�q:q:WdS(Ni(RRIt__mro__R(RROtclslevelRQR2((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRH�s
cC�s~|j}|g}xU|ri|jd�}|j|j��||jkr|j|j|j�qqWtj||�dS(Ni(	RDRFRRGRRRKRt_removed_from_collection(RRMRORPRQ((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<R6RRRRIRHRRR^(((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.pyR_�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.

    R`tparent_listenersRcC�sH||jkr|j|�n||_|j||_|j|_dS(N(RRHR`RbR(RR`t
target_cls((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR4�s
	cC�sGt|j|j�}t||j�|krCt||j|�n|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_ListenerCollectionR`t
_instance_clsR-Rtsetattr(RR]tresult((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR^�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(Rb(RR'R@R2((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt__call__�scC�s
t|j�S(N(tlenRb(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt__len__scC�s
t|j�S(N(RRb(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRscC�s
t|j�S(N(R(Rb(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt__bool__s((R`RbR(RRR/t	frozensetRNt	listenersRR4R^Rit	exec_onceRRRRRRjRlRRmt__nonzero__(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRa�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(RtRsR8(RR'R@((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRps	
	cO�sFx|jD]}|||�q
Wx|jD]}|||�q+WdS(sExecute this event.N(RbRo(RR'R@R2((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRj#scC�st|j�t|j�S(N(RkRbRo(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRl+scC�st|j|j�S(N(RRbRo(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR.scC�st|jp|j�S(N(R(RoRb(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRm1s(RsRt(
RRRRvRpRjRlRRmRq(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRrs						RdcB�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.

    RbR`RRoRNR cC�sl||jkr|j|�nt|_|j||_||_|j|_tj�|_	t
�|_dS(N(RRHtFalseRtRbR`RRSRTRoRXRN(RR`Rc((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.pyR^TscC�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(RoRXRNR?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_listRoRNtaddRK(RRMRN((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRRqscC�s8|j||j�r4|r4|jj|j�q4ndS(N(tappend_to_listRoRNR�RK(RRMRN((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRvscC�s:|jj|j�|jj|j�tj||�dS(N(RoRRKRNtdiscardRRW(RRM((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR{scC�s1tj||j�|jj�|jj�dS(N(RRZRoRNR(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR�s
(RbR`RRoRNR (RRR/RR4R^R8R�RRRRR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRd7s	
					t_JoinedListenercB�s\eZdZd�Zed��Zd�Zd�Zd�Zd	�Z	d
�Z
d�ZRS(
R`RtlocalRbcC�s4t|_||_||_||_|j|_dS(N(RwRtR`RR�Rb(RR`RR�((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR4�s
				cC�st|j|j�S(N(R-R`R(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRo�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�R^Rb(RR]((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR^�scC�s|jj||�dS(N(R�RR(RRMRN((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyRR�scC�s|jj||�dS(N(R�R(RRMRN((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR�scC�s|jj|�dS(N(R�R(RRM((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR�scC�s
t��dS(N(Rh(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR�s(R`RR�Rb(RRRR4tpropertyRoR<R^RRRRR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyR��s						(R/t
__future__RRRSt	itertoolsRR
R%RRRRRt
MemoizedSlotsRtobjectRRR_RaRrRdR�(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/event/attr.pyt<module>s$�=&O

Zerion Mini Shell 1.0