13 receivers = signals[sig]
15 receivers = signals[sig] = []
16 receivers.append(receiver)
22 if receiver
in signals[sig]:
23 signals[sig].remove(receiver)
25 if receiver
in signals[sig]:
26 signals[sig].remove(receiver)
31 receivers = signals[sig] + signals[signal.All]
33 receivers = signals[signal.All]
34 for receiver
in receivers:
35 receiver(event=sig, **named)
38 if __name__ ==
'__main__':
41 print(
'handler0: event=%s sender=%s' % (str(event), str(sender)))
46 print(
'handler1: event=%s sender=%s' % (str(event), str(sender)))
55 send(test_signal0, sender=
None)
56 assert len(recvs) == 2
and 0
in recvs
and 1
in recvs
59 send(test_signal1, sender=
None, data=
'test data')
60 assert len(recvs) == 1
and 0
in recvs
65 send(test_signal0, sender=
None, arg0=0, arg1=1, arg2=2)
66 assert len(recvs) == 1
and 0
in recvs
def handler0(event, sender, args)
def handler1(event, sender, args)
def connect(receiver, sig=signal.All)
def disconnect(receiver, sig=signal.All)