How to use the blinker.base.NamedSignal function in blinker

To help you get started, we’ve selected a few blinker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CenterForOpenScience / osf.io / osf_tests / utils.py View on Github external
def __getitem__(self, signal):
        """All captured signals are available via `ctxt[signal]`.
        """
        if isinstance(signal, blinker.base.NamedSignal):
            return self._records[signal]
        else:
            super(CaptureSignals, self).__setitem__(signal)
github CenterForOpenScience / osf.io / tests / base.py View on Github external
def __getitem__(self, signal):
        """All captured signals are available via `ctxt[signal]`.
        """
        if isinstance(signal, blinker.base.NamedSignal):
            return self._records[signal]
        else:
            super(CaptureSignals, self).__setitem__(signal)
github blurg / sauron-engine / tests / engine_tests / signals / test_signals.py View on Github external
def test_engine_initialized(self):
        # given:
        expected_signal_names = self.signal_names

        # when:
        engine = self.setup()

        # then:
        assert list(engine.signals.keys()) == expected_signal_names
        for signal_name in expected_signal_names:
            signal_obj = engine.signals[signal_name]
            assert signal_obj is not None
            assert isinstance(signal_obj, NamedSignal)
github thumbor / thumbor / thumbor / lifecycle / events.py View on Github external
def trigger_sync(cls, event, sender, **kw):
        "Triggers a synchronous event"

        if not isinstance(event, NamedSignal):
            raise RuntimeError(
                "Async signals can't be triggered synchronously: %s." % event.name
            )

        return event.send(sender, **kw)
github jek / blinker / blinker / base.py View on Github external
def signal(self, name, doc=None):
        """Return the :class:`NamedSignal` *name*, creating it if required.

        Repeated calls to this function will return the same signal object.

        """
        try:
            return self[name]
        except KeyError:
            return self.setdefault(name, NamedSignal(name, doc))