mO0;ܒFdZddlmZddlZddlmZddlmZddlmZdd lm Z e j e Z d Z Gd d eZGd deZGddeZdZdZGdde jeeZGddeZGddeZdS)aBase implementation classes. The public-facing ``Events`` serves as the base class for an event interface; its public attributes represent different kinds of events. These attributes are mirrored onto a ``_Dispatch`` class, which serves as a container for collections of listener functions. These collections are represented both at the class level of a particular ``_Dispatch`` class as well as within instances of ``_Dispatch``. )absolute_importN)_ClsLevelDispatch)_EmptyListener)_JoinedListener)utilcd|d o|dkp|dS)N_dispatch _sa_event) startswith)names /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/sqlalchemy/event/base.py_is_event_namers9 OOC  7TZ%7 &  % %&ceZdZdZdZdS)_UnpickleDispatchzSerializable callable that re-generates an instance of :class:`_Dispatch` given a particular :class:`.Events` subclass. c|jD]2}d|jvr'|jdj|cS3t d)Nr z*No class with a 'dispatch' member present.)__mro____dict__r _for_classAttributeError)self _instance_clsclss r__call__z_UnpickleDispatch.__call__/sh ( O OCS\))|J/8CC!* !!MNN NrN)__name__ __module__ __qualname____doc__rrrrr)s2 OOOOOrrceZdZdZdZejZddZdZ e dZ e dZ dZ d Zd Zd Zdd ZdZdS) _Dispatcha;Mirror the event listening definitions of an Events class with listener collections. Classes which define a "dispatch" member will return a non-instantiated :class:`._Dispatch` subclass when the member is accessed at the class level. When the "dispatch" member is accessed at the instance level of its owner, an instance of the :class:`._Dispatch` class is returned. A :class:`._Dispatch` class is generated for each :class:`.Events` class defined, by the :func:`._create_dispatcher_class` function. The original :class:`.Events` classes remain untouched. This decouples the construction of :class:`.Events` subclasses from the implementation used by the event internals, and allows inspecting tools like Sphinx to work in an unsurprising way against the public API. )_parentrr_empty_listenersNc||_|_rH |j|_dS#t$r&fd|jDx|_|j<YdSwxYwi|_dS)Nc<i|]}|jt|Sr")rr).0ls instance_clss r z&_Dispatch.__init__..]s7G^B ==r)r%r_empty_listener_regr&KeyError_event_descriptors)rparentr+s `r__init__z_Dispatch.__init__Ss )  ' (,(@(N%%%   $7%(@ )))) %'D ! ! !s',AAc |j|}t||j||S#t$rt |wxYwN)r&setattrrr.r)rrr*s r __getattr__z_Dispatch.__getattr__dsZ &t,B D"'2 & & &I  ' ' ' && & 's 'Ac#BK|jD]}t||VdSr3) _event_namesgetattr)rks rr/z_Dispatch._event_descriptorsos=" # #A$"" " " " " # #rc|jjSr3)_events_listenrs rr<z_Dispatch._listenvs |##rc.|||Sr3) __class__)rr+s rrz_Dispatch._for_classzs~~dL111rc:|j}||Sr3)r?r)rinstancer+s r _for_instancez_Dispatch._for_instance}s) |,,,rcd|jjvr7td|jjztfd|ji}||j_|||S)zCreate a 'join' of this :class:`._Dispatch` and another. This new dispatcher will dispatch events to both :class:`._Dispatch` objects. _joined_dispatch_clszJoined%s __slots__)r?rtyper_JoinedDispatcherr7rD)rotherrs r_joinz_Dispatch._joinsc ")@ @ @T^44"$d/0C 36DN /((u555rc.t|jffSr3)rrr=s r __reduce__z_Dispatch.__reduce__s ""T%7$999rTc|jD]U}t|trt||j|||VdS)zIPopulate from the listeners in another :class:`_Dispatch` object.)only_propagateN)r/ isinstancerr8r for_modify_update)rrHrMr*s rrPz_Dispatch._updatesv*  B"n--  D"' " " - -d 3 3 ; ;> <      rch|jD])}||*dSr3)r/rOclear)rr*s r_clearz_Dispatch._clears?) ( (B MM$   % % ' ' ' ' ( (rr3)T)rrr r!rEweakrefWeakKeyDictionaryr-r1r5propertyr/r<rrBrIrKrPrSr"rrr$r$9s*KI3'355''''"   ##X# $$X$222---666":::(((((rr$ceZdZdZdZdS) _EventMetazKIntercept new Event subclasses and create associated _Dispatch classes.cdt||||t||||dSr3)_create_dispatcher_classrFr1)r classnamebasesdict_s rr1z_EventMeta.__init__s4 i>>> c9eU33333rN)rrr r!r1r"rrrXrXs-%%44444rrXc t|dr |jj}nt}d|D}t d|z|fd|i}||_|||}|jD]G}t||t|||t| |H|j D]i} t| trR| turI| j jjD]7} t|| j| |j | j8jt!|ddrt#||j_dSdS)zRCreate a :class:`._Dispatch` class corresponding to an :class:`.Events` class.r c0g|]}t||Sr")r)r)r9s r z,_create_dispatcher_class..s%999~a'8'891999rz %sDispatchrE_dispatch_targetN)hasattrr r?r$rFr7 _set_dispatchr4r _registrarsappend __bases__ issubclassr;r/rr8 dispatcherra) rr[r\r] dispatch_base event_names dispatch_cls dispatch_instr9super_r*s rrZrZsvsJ" . ! 99e999Ky ="2[+4NL!,L%%c<88M  &## q"3Cq"B"BCCCAc""""(:: fi ( ( :V9-D-Dn-@ : : rw333)009999s&--8(23%%%88rc|jjD]7}t||t|st|=8dSr3)r r7rdremove)rr9s r_remove_dispatcherrpsL \ &Ac"""1~ ArceZdZdZedZedZed dZedZ edZ dS) Eventsz>Define event listening functions for a particular target type.c>|d|_||_|jSr3)r r;)rrks rrczEvents._set_dispatchs%$|D)) " |rcfd}fd}tdrW||jjs@|t|jjs%|tr||jjrSdSdSdS)Nc:tfd|DS)Nc3BK|]}tj|VdSr3)rNr )r)ttargets r z;Events._accept_with..dispatch_is..s/EE!z&/155EEEEEEr)all)typesrxs r dispatch_isz(Events._accept_with..dispatch_iss&EEEEuEEEEE Erc8tjj|Sr3)rNr r0)rwrxs rdispatch_parent_isz/Events._accept_with..dispatch_parent_issfo4a88 8rr )rbr r?rFrG)rrxr|r~s ` r _accept_withzEvents._accept_withs F F F F F 9 9 9 9 9 6: & &  CL233 ;tS\%;<<  K 122   +*3<+ABB         rFc6||||dS)N) propagateinsertnamed) base_listen)r event_keyrrrs rr<zEvents._listens# &NNNNNrc.|dSr3)ro)rrs r_removezEvents._removesrc8|jdSr3)r rS)rs rrSz Events._clears rN)FFF) rrr r! staticmethodrc classmethodrr<rrSr"rrrrrrsHH\[(OOO[O[[rrrcNeZdZdZdZdZdZedZedZ dS)rGz5Represent a connection between two _Dispatch objects.localr0rcD||_||_|jj|_dSr3r)rrr0s rr1z_JoinedDispatcher.__init__ s#  !Z5rct|j|}t|j|j|}t ||j||Sr3)r8rrr0rr4)rrr*jls rr5z_JoinedDispatcher.__getattr__sCTZ & & T["'2 6 6bgr""" rc|jjSr3)r0r<r=s rr<z_JoinedDispatcher._listen {""rc|jjSr3)r0r;r=s rr;z_JoinedDispatcher._eventsrrN) rrr r!rEr1r5rVr<r;r"rrrGrGss??2I666 ##X###X###rrGceZdZdZdZdZdS)rhzDescriptor used by target classes to deliver the _Dispatch class at the class level and produce new _Dispatch instances for target instances. c,|j|_||_dSr3)r events)rrs rr1zdispatcher.__init__)s  rc`||jS|j|x|jd<}|S)Nr )r rBr)robjrdisps r__get__zdispatcher.__get__-s5 ;= *.-*E*Ec*J*JJ Z 4 rN)rrr r!r1rr"rrrhrh!s<rrh)r! __future__rrTattrrrrr defaultdictlistrdrobjectrr$rFrXrZrpwith_metaclassrrrGrhr"rrrs  '&&&&&###### !!!!!!dt$$ &&& O O O O O O O O h(h(h(h(h(h(h(h(V44444444888D----- T V 4 4---`########6r