eaiovnaovbqoebvqoeavibavo 3 Ö¸VX ã@sDdZGdd„deƒZGdd„deƒZGdd„deƒZeeƒjƒZdS)z{Generic programming utilities. Utilities implemented in this file are not dependent on dbus, they can be used everywhere. c@s8eZdZdZdd„Zdd„Zdd„Zd d „Zd d „Zd S)Ú subscriptionÚ callback_listÚcallbackcCs||_||_|jj|ƒdS)N)rrÚappend)Úselfrr©rú/usr/lib/python3.6/generic.pyÚ__init__ szsubscription.__init__cCs|jj|jƒd|_d|_dS)N)rÚremover)rrrrÚ unsubscribeszsubscription.unsubscribecCs |jƒdS)zAn alias for unsubscribe()N)r )rrrrÚ disconnectszsubscription.disconnectcCs|S)Nr)rrrrÚ __enter__szsubscription.__enter__cCs|jdk r|jƒdS)N)rr )rÚexc_typeÚ exc_valueÚ tracebackrrrÚ__exit__s zsubscription.__exit__N)rr) Ú__name__Ú __module__Ú __qualname__Ú __slots__rr r r rrrrrrs rc@sDeZdZdZdd„Zedd„ƒZdd„Zd d „Zd d „Z d d„Z dS)Ú bound_signalÚ __signal__Ú__self__cCs||_||_dS)N)rr)rÚsignalÚinstancerrrr"szbound_signal.__init__cCs|jj|jS)N)rÚmapr)rrrrÚ callbacks&szbound_signal.callbackscCs|jj|j|ƒS)zSubscribe to the signal.)rÚconnectr)rrrrrr*szbound_signal.connectcGs|jj|jf|žŽdS)zEmit the signal.N)rÚemitr)rÚargsrrrr.szbound_signal.emitcGs|j|ŽdS)zEmit the signal.N)r)rrrrrÚ__call__2szbound_signal.__call__cCsd|jjdt|jƒdS)Nz)rrÚreprr)rrrrÚ__repr__6szbound_signal.__repr__N)rr) rrrrrÚpropertyrrrrr"rrrrrs rc@s@eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dS)ra—Static signal object You're expected to set it as a class property:: class A: SomethingHappened = signal() Declared this way, it can be used on class instances to connect signal observers:: a = A() a.SomethingHappened.connect(func) and emit the signal:: a.SomethingHappened() You may pass any parameters to the emiting function - they will be forwarded to all subscribed callbacks. cCsi|_d|_d|_dS)NzzSignal.)rrÚ__doc__)rrrrrOszsignal.__init__cCst|jj|gƒ|ƒS)zSubscribe to the signal.)rrÚ setdefault)rÚobjectrrrrrTszsignal.connectcGs$x|jj|gƒD] }||ŽqWdS)zEmit the signal.N)rÚget)rr&rÚcbrrrrXsz signal.emitcCs|dkr |St||ƒS)N)r)rrÚownerrrrÚ__get__]szsignal.__get__cCs tdƒ‚dS)Nzcan't set attribute)ÚAttributeError)rrÚvaluerrrÚ__set__cszsignal.__set__cCs d|jdtt|ƒdƒdS)Nzs0