gets called by the bluepy backend when using wait_for_notification
439990
def handleNotification(self, handle, raw_data):  # pylint: disable=unused-argument,invalid-name
        
        if raw_data is None:
            return
        data = raw_data.decode("utf-8").strip(' \n\t')
        self._cache = data
        self._check_data()
        if self.cache_available():
            self._last_read = datetime.now()
        else:
            # If a sensor doesn't work, wait 5 minutes before retrying
            self._last_read = datetime.now() - self._cache_timeout + \
                timedelta(seconds=300)
1328226
def work_wait(self):
        

        if len(self.queues_with_notify) > 0:
            # https://github.com/antirez/redis/issues/874
            connections.redis.blpop(*(self.queues_with_notify + [max(1, int(self.config["max_latency"]))]))
        else:
            gevent.sleep(self.config["max_latency"])
162761
def wait_for_update(self, trigger_update=False):
        
        if trigger_update:
            self.update_now()

        from gi.repository import Gtk
        from gi.repository import GLib
        from threading import Event
        event = Event()

        # Handle all events from gaphas, but not from gtkmvc3
        # Make use of the priority, which is higher for gaphas then for gtkmvc3
        def priority_handled(event):
            event.set()
        priority = (GLib.PRIORITY_HIGH_IDLE + GLib.PRIORITY_DEFAULT_IDLE) / 2
        # idle_add is necessary here, as we do not want to block the user from interacting with the GUI
        # while gaphas is redrawing
        GLib.idle_add(priority_handled, event, priority=priority)
        while not event.is_set():
            Gtk.main_iteration()
661191
def _check_for_pending(self, *args, **kwargs):
        
        if self._notification_pending and not self._processing:
            self._processing = True
            args, kwargs = self._data
            self._notify(*args, **kwargs)
            self._notification_pending = False
            self._processing = False
619943
function notify () {
  debug('run checker')
  debug(`ELINT_DISABLE_UPDATE_NOTIFIER: ${process.env.ELINT_DISABLE_UPDATE_NOTIFIER}`)

  if (process.env.ELINT_DISABLE_UPDATE_NOTIFIER === 'true') {
    return Promise.resolve(null)
  }

  return checker().then(result => {
    if (!result || !result.name || !result.latest || !result.current) {
      return null
    }

    conf.update(result.name)

    return report(result)
  })
}
1155058
def notify_message(self, message, level="info", clear_if_dupl=True,
                       clear_in=CLEAR_NOTIF_BAR_MESSAGE_IN):
        
        with self.notifications_lock:
            if clear_if_dupl and message in self.message_widget_dict.keys():
                logger.debug("notification %r is already displayed", message)
                return
            logger.debug("display notification %r", message)
            widget = urwid.AttrMap(urwid.Text(message), "notif_{}".format(level))
        return self.notify_widget(widget, message=message, clear_in=clear_in)
568679
def _enable_notifications_failed(self, dbus_error):
        
        if ((dbus_error.get_dbus_name() == 'org.bluez.Error.Failed') and
            ((dbus_error.get_dbus_message() == "Already notifying") or
             (dbus_error.get_dbus_message() == "No notify session started"))):
            # Ignore cases where notifications where already enabled or already disabled
            return
        error = _error_from_dbus_error(dbus_error)
        self.service.device.characteristic_enable_notifications_failed(characteristic=self, error=error)
295502
def _notifications(self):
        
        if not self.username or not self.auth_token:
            if not self.notification_warning:
                self.py3.notify_user(
                    "Github module needs username and "
                    "auth_token to check notifications."
                )
                self.notification_warning = True
            return "?"
        if self.notifications == "all" or not self.repo:
            url = self.url_api + "/notifications"
        else:
            url = self.url_api + "/repos/" + self.repo + "/notifications"
        url += "?per_page=100"
        try:
            info = self.py3.request(url, auth=(self.username, self.auth_token))
        except (self.py3.RequestException):
            return
        if info.status_code == 200:
            links = info.headers.get("Link")

            if not links:
                return len(info.json())

            last_page = 1
            for link in links.split(","):
                if 'rel="last"' in link:
                    last_url = link[link.find("<") + 1 : link.find(">")]
                    parsed = urlparse.urlparse(last_url)
                    last_page = int(urlparse.parse_qs(parsed.query)["page"][0])

            if last_page == 1:
                return len(info.json())
            try:
                last_page_info = self.py3.request(
                    last_url, auth=(self.username, self.auth_token)
                )
            except self.py3.RequestException:
                return

            return len(info.json()) * (last_page - 1) + len(last_page_info.json())

        if info.status_code == 404:
            if not self.repo_warning:
                self.py3.notify_user("Github repo cannot be found.")
                self.repo_warning = True
677654
async def notifications(dev: Device, notification: str, listen_all: bool):
    
    notifications = await dev.get_notifications()

    async def handle_notification(x):
        click.echo("got notification: %s" % x)

    if listen_all:
        if notification is not None:
            await dev.services[notification].listen_all_notifications(
                handle_notification
            )
        else:
            click.echo("Listening to all possible notifications")
            await dev.listen_notifications(fallback_callback=handle_notification)

    elif notification:
        click.echo("Subscribing to notification %s" % notification)
        for notif in notifications:
            if notif.name == notification:
                await notif.activate(handle_notification)

        click.echo("Unable to find notification %s" % notification)

    else:
        click.echo(click.style("Available notifications", bold=True))
        for notification in notifications:
            click.echo("* %s" % notification)
732662
def on_message(self, started_waiting):
        
        watcher = self.settings.watcher
        if started_waiting:
            watcher.start_waiting()
        else:
            watcher.done_waiting()
318234
public synchronized void handleNotification(Notification notification, Object handback) {
        String type = notification.getType();
        if (REGISTRATION_NOTIFICATION.equals(type)) {
            jolokiaMBeanServer = lookupJolokiaMBeanServer();
            // We need to add the listener provided during construction time to add the Jolokia MBeanServer
            // so that it is kept updated, too.
            if (jolokiaMBeanServerListener != null) {
                JmxUtil.addMBeanRegistrationListener(jolokiaMBeanServer, jolokiaMBeanServerListener, null);
            }
        } else if (UNREGISTRATION_NOTIFICATION.equals(type)) {
            jolokiaMBeanServer = null;
        }

        allMBeanServers.clear();
        if (jolokiaMBeanServer != null) {
            allMBeanServers.add(jolokiaMBeanServer);
        }
        allMBeanServers.addAll(detectedMBeanServers);
    }
507448
function () {

	LOG.warn('appinfo sent to lobby:');
	LOG.warn(l_appinfo);
	
    // notify AppManager we're ready
    l_notifyLobby('SR_APP_READY', l_appinfo, 'SR_APP_READY_RES',
        function (event) {

            if (event.data.op === true)
                LOG.sys('SR_APP_READY returns ok', 'l_HandlerPool');
            else
                LOG.error('SR_APP_READY returns fail', 'l_HandlerPool');

			// call onDone if exists (but just once)
            if (l_onDone) {
				UTIL.safeCall(l_onDone);
				l_onDone = undefined;
			}			
        }
    );
}
516290
def wait_init(self):
        
        init_done = self.init_done.wait(timeout=self.init_wait_timeout)
        if not init_done:
            if hasattr(self, "peek"):
                app = self.config.get("application")
                if app:
                    bef_init_cmds = app.get("cli_ready_trigger")
                    if bef_init_cmds in self.peek():  # pylint: disable=no-member
                        init_done = True
        return init_done
962658
def make_request(self, handle, value, timeout=DEFAULT_TIMEOUT, with_response=True):
        """"""
        try:
            with self:
                _LOGGER.debug("Writing %s to %s with with_response=%s", codecs.encode(value, 'hex'), handle, with_response)
                self._conn.writeCharacteristic(handle, value, withResponse=with_response)
                if timeout:
                    _LOGGER.debug("Waiting for notifications for %s", timeout)
                    self._conn.waitForNotifications(timeout)
        except btle.BTLEException as ex:
            _LOGGER.debug("Got exception from bluepy while making a request: %s", ex)
            raise
556569
protected void waitingNotify()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "waitingNotify");

        this.lock();
        try
        {
            if (_waiting)
                _waiter.signal();
        } finally
        {
            this.unlock();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "waitingNotify");
    }
327330
def process_notifications(self, messages):
        """"""
        for object_id, object_size, metadata_size in messages:
            if object_size > 0 and object_id in self._waiting_dict:
                linked_list = self._waiting_dict[object_id]
                self._complete_future(linked_list)
341307
def notify(name, states, callback):
    '''
    
    '''
    if not exists(name):
        raise ContainerNotExists("The container (%s) does not exist!" % name)

    cmd = ['lxc-wait', '-n', name, '-s', states]
    def th():
        subprocess.check_call(cmd)
        callback()
    _logger.info("Waiting on states %s for container %s", states, name)
    threading.Thread(target=th).start()