How to use the blinker.base.Namespace 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 heston / firebase-live-data / firebasedata / live.py View on Github external
def __init__(self, pyrebase_app, root_path, ttl=None, retry_interval=None):
        self._app = pyrebase_app
        self._root_path = root_path
        self._ttl = ttl
        self._retry_interval = (
            RETRY_INTERVAL if retry_interval is None else retry_interval
        )
        self._db = self._app.database()
        self._streams = {}
        self._gc_streams = queue.Queue()
        self._gc_thread = None
        self._cache = None
        self.events = Namespace()

        self._handlers = {
            'put': self._put_handler,
            'patch': self._patch_handler,
        }
github abilian / abilian-sbe / abilian / sbe / apps / communities / signals.py View on Github external
from blinker.base import Namespace

# pylint: disable=C0103
#         invalid constant name

ns = Namespace()

#: sent when membership is set. Sender is community, arguments are:
#: :class:`.models.Membership` instance, :bool:`is_new`
membership_set = ns.signal("membership_set")

#: sent just before membership is removed. Sender is community, arguments:
# :class:`.models.Membership` instance
membership_removed = ns.signal("membership_removed")
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))


signal = Namespace().signal
github abilian / abilian-core / abilian / core / signals.py View on Github external
"""All signals used by Abilian Core.

Signals are the main tools used for decoupling applications components by
sending notifications. In short, signals allow certain senders to notify
subscribers that something happened.

Cf. http://flask.pocoo.org/docs/signals/ for detailed documentation.

The main signal is currently :obj:`activity`.
"""

from blinker.base import Namespace

signals = Namespace()

#: Triggered at application initialization when all extensions and plugins have
#: been loaded
components_registered = signals.signal("app:components:registered")

#: Trigger when JS api must be registered. At this time :func:`flask.url_for` is
#: usable
register_js_api = signals.signal("app:register-js-api")

#: This signal is used by the activity streams service and its clients.
activity = signals.signal("activity")

#: This signal is sent when user object has been loaded. g.user and current_user
#: are available.
user_loaded = signals.signal("user_loaded")