How to use the blinker._utilities.contextmanager 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 biosustain / potion / tests / contrib / alchemy / test_signals.py View on Github external
    @contextmanager
    def assertSignals(self, expected_events, sender=ANY):
        events = []

        def receiver_(signal, sender, **kwargs):
            events.append((signal, sender, kwargs))

        receivers = {
            signal: partial(receiver_, signal) for signal in [
            signals.before_create,
            signals.after_create,
            signals.before_update,
            signals.after_update,
            signals.before_delete,
            signals.after_delete,
            signals.before_add_to_relation,
            signals.after_add_to_relation,
github biosustain / potion / tests / contrib / mongoengine / test_signals.py View on Github external
    @contextmanager
    def assertSignals(self, expected_events, sender=ANY):
        events = []

        def receiver_(signal, sender, **kwargs):
            events.append((signal, sender, kwargs))

        receivers = {
            signal: partial(receiver_, signal) for signal in [
            signals.before_create,
            signals.after_create,
            signals.before_update,
            signals.after_update,
            signals.before_delete,
            signals.after_delete,
            signals.before_add_to_relation,
            signals.after_add_to_relation,
github biosustain / potion / tests / backends / peewee / test_peewee_signals.py View on Github external
    @contextmanager
    def assertSignals(self, expected_events, sender=ANY):
        events = []

        def receiver_(signal, sender, **kwargs):
            events.append((signal, sender, kwargs))

        receivers = {
            signal: partial(receiver_, signal) for signal in [
            signals.before_create,
            signals.after_create,
            signals.before_update,
            signals.after_update,
            signals.before_delete,
            signals.after_delete,
            signals.before_add_to_relation,
            signals.after_add_to_relation,
github cesium-ml / cesium / mltsp / Flask / src / blinker / base.py View on Github external
    @contextmanager
    def connected_to(self, receiver, sender=ANY):
        """Execute a block with the signal temporarily connected to *receiver*.

        :param receiver: a receiver callable
        :param sender: optional, a sender to filter on

        This is a context manager for use in the ``with`` statement.  It can
        be useful in unit tests.  *receiver* is connected to the signal for
        the duration of the ``with`` block, and will be disconnected
        automatically when exiting the block:

        .. testsetup::

          from __future__ import with_statement
          from blinker import Signal
          on_ready = Signal()
github mozilla-releng / balrog / vendor / lib / python / blinker / base.py View on Github external
    @contextmanager
    def connected_to(self, receiver, sender=ANY):
        """Execute a block with the signal temporarily connected to *receiver*.

        :param receiver: a receiver callable
        :param sender: optional, a sender to filter on

        This is a context manager for use in the ``with`` statement.  It can
        be useful in unit tests.  *receiver* is connected to the signal for
        the duration of the ``with`` block, and will be disconnected
        automatically when exiting the block:

        .. testsetup::

          from __future__ import with_statement
          from blinker import Signal
          on_ready = Signal()
github kamalgill / flask-appengine-template / src / lib / blinker / base.py View on Github external
    @contextmanager
    def connected_to(self, receiver, sender=ANY):
        """Execute a block with the signal temporarily connected to *receiver*.

        :param receiver: a receiver callable
        :param sender: optional, a sender to filter on

        This is a context manager for use in the ``with`` statement.  It can
        be useful in unit tests.  *receiver* is connected to the signal for
        the duration of the ``with`` block, and will be disconnected
        automatically when exiting the block:

        .. testsetup::

          from __future__ import with_statement
          from blinker import Signal
          on_ready = Signal()
github jek / blinker / blinker / base.py View on Github external
    @contextmanager
    def connected_to(self, receiver, sender=ANY):
        """Execute a block with the signal temporarily connected to *receiver*.

        :param receiver: a receiver callable
        :param sender: optional, a sender to filter on

        This is a context manager for use in the ``with`` statement.  It can
        be useful in unit tests.  *receiver* is connected to the signal for
        the duration of the ``with`` block, and will be disconnected
        automatically when exiting the block:

        .. testsetup::

          from __future__ import with_statement
          from blinker import Signal
          on_ready = Signal()
github janeczku / calibre-web / vendor / blinker / base.py View on Github external
    @contextmanager
    def connected_to(self, receiver, sender=ANY):
        """Execute a block with the signal temporarily connected to *receiver*.

        :param receiver: a receiver callable
        :param sender: optional, a sender to filter on

        This is a context manager for use in the ``with`` statement.  It can
        be useful in unit tests.  *receiver* is connected to the signal for
        the duration of the ``with`` block, and will be disconnected
        automatically when exiting the block:

        .. testsetup::

          from __future__ import with_statement
          from blinker import Signal
          on_ready = Signal()