How to use the blinker.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 fiaas / fiaas-deploy-daemon / tests / fiaas_deploy_daemon / crd / test_crd_status.py View on Github external
def signal(self, monkeypatch):
        s = Namespace().signal
        monkeypatch.setattr("fiaas_deploy_daemon.crd.status.signal", s)
        yield s
github sci-bots / microdrop / microdrop / core_plugins / protocol_controller / execute.py View on Github external
Execute a single protocol step.

    Parameters
    ----------
    plugin_kwargs : dict
        Plugin keyword arguments, indexed by plugin name.

    Returns
    -------
    list
        Return values from plugin ``on_step_run()`` coroutines.
    '''
    # Take snapshot of arguments for current step.
    plugin_kwargs = copy.deepcopy(plugin_kwargs)

    signals = blinker.Namespace()

    @asyncio.coroutine
    def notify_signals_connected():
        yield asyncio.From(asyncio.sleep(0))
        signals.signal('signals-connected').send(None)

    loop = asyncio.get_event_loop()
    # Get list of coroutine futures by emitting `on_step_run()`.
    plugin_step_tasks = emit_signal("on_step_run", args=[plugin_kwargs,
                                                         signals])
    future = asyncio.wait(plugin_step_tasks.values())

    loop.create_task(notify_signals_connected())
    result = yield asyncio.From(future)
    raise asyncio.Return(result)
github fossasia / open-event-server / app / vintage / helpers / signals.py View on Github external
if len(sender) == 0:
        sender = None
    elif len(sender) > 1:
        raise TypeError('send() accepts only one positional argument, '
                        '%s given' % len(sender))
    else:
        sender = sender[0]
    if not self.receivers or app.config['TESTING']:
        return []
    else:
        return [(receiver, receiver(sender, **kwargs))
                for receiver in self.receivers_for(sender)]

Signal.send = new_send

event_signals = Namespace()

event_json_modified = event_signals.signal('event_json_modified')
speakers_modified = event_signals.signal('speakers_modified')
sessions_modified = event_signals.signal('sessions_modified')
microlocations_modified = event_signals.signal('microlocations_modified')
github crempp / mdweb / mdweb / MDSite.py View on Github external
send_file,
    send_from_directory,
)

from mdweb.Index import Index
from mdweb.SiteMapView import SiteMapView
from mdweb.Navigation import Navigation
from mdweb.Page import Page, load_page
from mdweb.metafields import META_FIELDS

# Shim Python 3.x Exceptions
if 'FileExistsError' not in __builtins__.keys():
    from mdweb.Exceptions import FileExistsError  # pylint: disable=W0622

# Setup signals
SIG_NAMESPACE = blinker.Namespace()
MDW_SIGNALER = {
    'pre-boot': SIG_NAMESPACE.signal('pre-boot'),
    'pre-navigation-scan': SIG_NAMESPACE.signal('pre-navigation-scan'),
    'post-navigation-scan': SIG_NAMESPACE.signal('post-navigation-scan'),
    'pre-app-start': SIG_NAMESPACE.signal('pre-app-start'),
    'post-app-start': SIG_NAMESPACE.signal('post-app-start'),
    'pre-config': SIG_NAMESPACE.signal('pre-config'),
    'post-config': SIG_NAMESPACE.signal('post-config'),
    'post-boot': SIG_NAMESPACE.signal('post-boot'),
}

BASE_SETTINGS = {
    #: enable/disable Flask debug mode
    'DEBUG': False,

    #: enable/disable Flask testing mode
github EUDAT-B2SHARE / b2share / invenio / modules / uploader / signals.py View on Github external
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

"""
invenio.modules.uploader.signals
--------------------------------

Defines signals used in uploader API
"""

from blinker import Namespace
_signals = Namespace()

uploader_started = _signals.signal('uploader_started')
"""Signal sent right before the uploading process starts with the input data
and all the arguments from the run function"""

uploader_finished = _signals.signal('uploader_finished')
"""Signal sent right after the uploader process finishes with the name of the
workflow that has run, the return values from it and the ``**kwargs``"""
github cloudlinux / kuberdock-platform / kubedock / signals.py View on Github external
from blinker import Namespace

pods_signals = Namespace()
allocate_ip_address = pods_signals.signal('allocate_ip_address')
github zenodo / zenodo / zenodo / modules / accessrequests / signals.py View on Github external
# Zenodo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Zenodo. If not, see .
#
# In applying this licence, CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

"""Access request signals."""

from blinker import Namespace
_signals = Namespace()

request_accepted = _signals.signal('request-accepted')

request_rejected = _signals.signal('request-rejected')

request_created = _signals.signal('request-created')

request_confirmed = _signals.signal('request-confirmed')

link_created = _signals.signal('link-created')

link_revoked = _signals.signal('link-revoked')
github zenodo / zenodo / zenodo / modules / communities / signals.py View on Github external
## Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

"""
User collection signals - useful for hooking into the collection
creation process.
"""

from blinker import Namespace
_signals = Namespace()

before_save_collection = _signals.signal('before-save-collection')
"""
This signal is sent right before collection is saved.
Sender is the user collection. Extra data pass is:

 * is_new
 * provisional
"""

after_save_collection = _signals.signal('after-save-collection')
"""
This signal is sent right after a collection is saved.
Sender is the user collection. Extra data pass is:

 * collection
github AamAadmiParty / cleansweep / cleansweep / plugins / committees / signals.py View on Github external
from blinker import Namespace

namespace = Namespace()

committee_add_member = namespace.signal("committee.add-member")
committee_remove_member = namespace.signal("committee.remove-member")
new_committee_structure = namespace.signal("committee-structure.new")
committee_structure_modified = namespace.signal("committee-structure.edit")
github gouthambs / Flask-Blogging / flask_blogging / signals.py View on Github external
"""
    The flask_blogging signals module

"""


import blinker

signals = blinker.Namespace()

engine_initialised = signals.signal("engine_initialised", doc="""\
Signal send by the ``BloggingEngine`` after the object is initialized.
The arguments passed by the signal are:

:param app: The Flask app which is the sender
:type app: object
:keyword engine: The blogging engine that was initialized
:type engine: object
""")

post_processed = signals.signal("post_processed", doc="""\
Signal sent when a post is processed (i.e., the markdown is converted
to html text). The arguments passed along with this signal are:

:param app: The Flask app which is the sender