blinker
blinker copied to clipboard
Temporarily mute signal
Sometimes you need to switch off particular signals for testing purposes. I guess this context manager would be more convenient way to solve such task:
# I have some signal
signal = blinker.Signal()
sig.send(123) # it's been sent
with sig.muted():
sig.send(456) # it's muted and hasn't been sent