How to use the blinker.signal 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 benediktschmitt / emsm / emsm / core / worlds.py View on Github external
world_about_to_start = blinker.signal("world_about_to_start")

    #: Signal, that is emitted when a world has been started.
    world_started = blinker.signal("world_started")

    #: Signal, that is emitted when a world could not be started.
    world_start_failed = blinker.signal("world_start_failed")

    #: Signal, that is emitted when a world is about to be stopped.
    world_about_to_stop = blinker.signal("world_about_to_stop")

    #: Signal, that is emitted when a world has been stopped.
    world_stopped = blinker.signal("world_stopped")

    #: Signal, that is emitted when a world could not be stopped.
    world_stop_failed = blinker.signal("world_stop_failed")


    def __init__(self, app, name):
        """
        """
        log.info("initialising world '{}' ...".format(name))

        self._app = app

        # The name of the world.
        self._name = name

        # The whole dedicated configuration file.
        self._world_conf = app.conf().world(name)

        # Get the configuration section.
github GetmeUK / MongoFrames / mongoframes / frames.py View on Github external
document[field] = cls._path_to_value(
                        field,
                        frame._document
                        )
                documents.append(to_refs(document))
        else:
            documents = [to_refs(f._document) for f in frames]

        # Update the documents
        for document in documents:
            _id = document.pop('_id')
            cls.get_collection().update_one(
                {'_id': _id}, {'$set': document})

        # Send updated signal
        signal('updated').send(cls, frames=frames)
github benediktschmitt / emsm / emsm / plugins / initd.py View on Github external
# ------------------------------------------------

class InitD(BasePlugin):

    VERSION = "6.0.0-beta"

    DESCRIPTION = __doc__

    # Emitted when initd is called with the *--start* argument.
    on_initd_start = blinker.signal("initd_start")

    # Emitted when initd is called with the *--stop* argument.
    on_initd_stop = blinker.signal("initd_stop")

    # Emitted when initd is called with the *--restart* argument.
    on_initd_restart = blinker.signal("initd_restart")

    def __init__(self, app, name):
        """
        """
        BasePlugin.__init__(self, app, name)

        self._setup_argparser()
        return None

    def _setup_argparser(self):
        """
        Sets the argument parser up.
        """
        parser = self.argparser()

        parser.description = "InitD interface"
github springload / Wrangler.py / wrangler / Core.py View on Github external
page_data.update(_defaults)
        
        if contents != None: 
            if "meta" in contents:
                page_data["meta"].update(contents["meta"])
            if "data" in contents:
                page_data["data"] = contents["data"]

        page_data["meta"].update({
            "filename": file_name,
            "filepath": filepath,
            "relative_path": relative_path,
            "mtime": mtime
        })

        sig = signal("wranglerLoadItem")
        sig.send('item', item=file_name, file_contents=file_contents, mtime=mtime)
        
        return page_data
github handroll / handroll / handroll / signals.py View on Github external
# Copyright (c) 2017, Matt Layman
"""Signals fired during execution"""

from blinker import signal

frontmatter_loaded = signal('frontmatter_loaded')
pre_composition = signal('pre_composition')
post_composition = signal('post_composition')
github Dan-in-CA / SIP / plugins / signaling_examples.py View on Github external
program_toggled = signal(u"program_toggled")
program_toggled.connect(notify_program_toggled)

### Rain Changed ##
def notify_rain_changed(name, **kw):
    print(u"Rain changed (from plugin)")
    #  Programs are in gv.pd and /data/programs.json

rain_changed = signal(u"rain_changed")
rain_changed.connect(notify_rain_changed)

### Reboot ###
def notify_rebooted(name, **kw):
    print(u"System rebooted")

rebooted = signal(u"rebooted")
rebooted.connect(notify_rebooted)

### Restart ###
def notify_restart(name, **kw):
    print(u"System is restarting")

restart = signal(u"restart")
restart.connect(notify_restart)

### Station Names ###
def notify_station_names(name, **kw):
    print(u"Station names changed")
    # Station names are in gv.snames and /data/snames.json

station_names = signal(u"station_names")
station_names.connect(notify_station_names)
github ghing / tablesplitter / tablesplitter / signal.py View on Github external
from blinker import signal

split_image = signal('split_image')
detect_rows = signal('detect_rows')
detect_columns = signal('detect_columns')
extract_image = signal('extract_image')
image_text = signal('image_text')
github thumbor / thumbor / thumbor / lifecycle / events.py View on Github external
# Configuration loading events
        before_log_configuration = sync_signal("server.before_log_configuration")
        after_log_configuration = sync_signal("server.after_log_configuration")

        # Importer loading events
        before_importer = sync_signal("server.before_importer")
        after_importer = sync_signal("server.after_importer")

        # Application Start events
        before_application_start = sync_signal("server.before_application_start")
        after_application_start = sync_signal("server.after_application_start")

        # Application Handler events
        before_app_handlers = sync_signal("server.before_app_handlers")
        after_app_handlers = sync_signal("server.after_app_handlers")

        # Server Run events
        before_server_run = sync_signal("server.before_server_run")
        after_server_run = sync_signal("server.after_server_run")
        before_server_block = sync_signal("server.before_server_block")

    class Imaging(object):  # pylint: disable=too-few-public-methods
        "Imaging events - happen when transforming the image"
        before_finish_request = signal("imaging.before_finish_request")
        after_finish_request = signal("imaging.after_finish_request")

        # Event executed before processing anything else
        request_received = signal("imaging.received")

        # Parsing Arguments Events
        before_parsing_arguments = signal("imaging.before_parsing_arguments")
github SamSchott / maestral-dropbox / maestral / sync / monitor.py View on Github external
:ivar connected: Event that is set when connected to Dropbox servers.
    :ivar running: Event that is set when the threads are running.
    :ivar syncing: Event that is set when syncing is not paused.

    :cvar queue_downloading: Queue with *local file paths* that are being downloaded.
    :cvar queue_uploading: Queue with *local file paths* that are being uploaded.
    :cvar local_file_event_queue: Queue with *file events* to be uploaded.
    """

    queue_downloading = queue.Queue()
    queue_uploading = queue.Queue()

    local_file_event_queue = TimedQueue()

    connected_signal = signal("connected_signal")
    disconnected_signal = signal("disconnected_signal")

    def __init__(self, client):

        self._auto_resume_on_connect = False

        self.connected = Event()
        self.syncing = Event()
        self.running = Event()

        self.client = client
        self.file_handler = FileEventHandler(
            self.syncing, self.local_file_event_queue, self.queue_downloading
        )

        self.sync = UpDownSync(self.client, self.local_file_event_queue,
github GetmeUK / MongoFrames / mongoframes / frames.py View on Github external
if len(fields) > 0:
            document = {}
            for field in fields:
                document[field] = self._path_to_value(field, self._document)
        else:
            document = self._document

        # Prepare the document to be updated
        document = to_refs(document)
        document.pop('_id', None)

        # Update the document
        self.get_collection().update_one({'_id': self._id}, {'$set': document})

        # Send updated signal
        signal('updated').send(self.__class__, frames=[self])