Connect signals for the model.
438053
def _connect_signals(self, model):
        
        for signal in self._signals:
            receiver = self._signals[signal]
            signal.connect(receiver, sender=model, dispatch_uid=self._dispatch_uid(signal, model))
568335
def register_signals(self):
        """"""
        from .models import Collection
        from .receivers import CollectionUpdater

        if self.app.config['COLLECTIONS_USE_PERCOLATOR']:
            from .percolator import collection_inserted_percolator, \
                collection_removed_percolator, \
                collection_updated_percolator
            # Register collection signals to update percolators
            listen(Collection, 'after_insert',
                   collection_inserted_percolator)
            listen(Collection, 'after_update',
                   collection_updated_percolator)
            listen(Collection, 'after_delete',
                   collection_removed_percolator)
        # Register Record signals to update record['_collections']
        self.update_function = CollectionUpdater(app=self.app)
        signals.before_record_insert.connect(self.update_function,
                                             weak=False)
        signals.before_record_update.connect(self.update_function,
                                             weak=False)
377169
def connect(self, interface, event, object_path, handler):
        
        if object_path:
            def callback(connection, sender_name, object_path,
                         interface_name, signal_name, parameters):
                return handler(*unpack_variant(parameters))
        else:
            def callback(connection, sender_name, object_path,
                         interface_name, signal_name, parameters):
                return handler(object_path, *unpack_variant(parameters))
        return self.connection.signal_subscribe(
            self.bus_name,
            interface,
            event,
            object_path,
            None,
            Gio.DBusSignalFlags.NONE,
            callback,
        )
884353
def connect(self):
        """"""
        self._client = self._create_client()
        self._db = getattr(self._client, self._db_name)
        self._generic_dao = GenericDAO(self._client, self._db_name)
939394
protected void triggerEpochListeners(boolean epochStart, Model model, int epochNum){
        Collection<TrainingListener> listeners;
        if(model instanceof MultiLayerNetwork){
            MultiLayerNetwork n = ((MultiLayerNetwork) model);
            listeners = n.getListeners();
            n.setEpochCount(epochNum);
        } else if(model instanceof ComputationGraph){
            ComputationGraph cg = ((ComputationGraph) model);
            listeners = cg.getListeners();
            cg.getConfiguration().setEpochCount(epochNum);
        } else {
            return;
        }

        if(listeners != null && !listeners.isEmpty()){
            for (TrainingListener l : listeners) {
                if (epochStart) {
                    l.onEpochStart(model);
                } else {
                    l.onEpochEnd(model);
                }
            }
        }
    }
1288782
def send_signal(self, request, response, forum):
        
        self.view_signal.send(
            sender=self, forum=forum, user=request.user, request=request, response=response,
        )
167424
def setup_asset_signals(self, ):
        
        log.debug("Setting up asset signals.")
        self.asset_asset_view_pb.clicked.connect(self.asset_view_asset)
        self.asset_asset_create_pb.clicked.connect(self.asset_create_asset)
        self.asset_asset_add_pb.clicked.connect(self.asset_add_asset)
        self.asset_asset_remove_pb.clicked.connect(self.asset_remove_asset)
        self.asset_task_view_pb.clicked.connect(self.asset_view_task)
        self.asset_task_create_pb.clicked.connect(self.asset_create_task)
        self.asset_desc_pte.textChanged.connect(self.asset_save)
828679
def setup_prjs_signals(self, ):
        
        log.debug("Setting up projects page signals.")
        self.prjs_prj_view_pb.clicked.connect(self.prjs_view_prj)
        self.prjs_prj_create_pb.clicked.connect(self.prjs_create_prj)
737151
def setup_signal_handlers(self):
        
        LOGGER.debug('Registering signal handlers')
        signal.signal(signal.SIGABRT, self.on_sigabrt)
180581
def setup_signals(self, ):
        
        self.showfilter_tb.toggled.connect(self.switch_showfilter_icon)
        self.addnew_tb.clicked.connect(self.open_addnew_win)
        self.search_le.editingFinished.connect(self.update_filter)
        for cb in (self.loaded_checkb, self.unloaded_checkb, self.imported_checkb, self.empty_checkb,
                   self.newest_checkb, self.old_checkb, self.alien_checkb):
            cb.toggled.connect(self.update_filter)
776770
def connect(self, signal, slot):
        
        super(XViewDispatch, self).connect(self, SIGNAL(signal), slot)
1342019
def setup_prj_signals(self, ):
        
        log.debug("Setting up project page signals.")
        self.prj_seq_view_pb.clicked.connect(self.prj_view_seq)
        self.prj_seq_create_pb.clicked.connect(self.prj_create_seq)
        self.prj_atype_view_pb.clicked.connect(self.prj_view_atype)
        self.prj_atype_add_pb.clicked.connect(self.prj_add_atype)
        self.prj_atype_create_pb.clicked.connect(self.prj_create_atype)
        self.prj_dep_view_pb.clicked.connect(self.prj_view_dep)
        self.prj_dep_add_pb.clicked.connect(self.prj_add_dep)
        self.prj_dep_create_pb.clicked.connect(self.prj_create_dep)
        self.prj_user_view_pb.clicked.connect(self.prj_view_user)
        self.prj_user_add_pb.clicked.connect(self.prj_add_user)
        self.prj_user_remove_pb.clicked.connect(self.prj_remove_user)
        self.prj_user_create_pb.clicked.connect(self.prj_create_user)
        self.prj_path_view_pb.clicked.connect(self.prj_show_path)
        self.prj_desc_pte.textChanged.connect(self.prj_save)
        self.prj_semester_le.editingFinished.connect(self.prj_save)
        self.prj_fps_dsb.valueChanged.connect(self.prj_save)
        self.prj_res_x_sb.valueChanged.connect(self.prj_save)
        self.prj_res_y_sb.valueChanged.connect(self.prj_save)
        self.prj_scale_cb.currentIndexChanged.connect(self.prj_save)
1243678
def attached_to_model(self):
        """"""
        try:
            if not bool(self._model):
                return False
        except AttributeError:
            return False
        else:
            try:
                return not bool(self._instance)
            except AttributeError:
                return True
370122
def set(self, **signals):
        
        for name in signals:
            if name not in self._signals:
                self._init_status[name] = signals[name]
            self._signals[name] = signals[name]
1184611
def signals():
    """"""

    signalbus = current_app.extensions['signalbus']
    for signal_model in signalbus.get_signal_models():
        click.echo(signal_model.__name__)
155017
def connect(self, index):
        """"""
        # Determine which model is the target model as either side of the relation
        # may be passed as `field`.
        if index.object_type == self.field.rel.model:
            self.model = self.field.rel.related_model
            self.accessor = self.field.rel.field.attname
        else:
            self.model = self.field.rel.model
            if self.field.rel.symmetrical:
                # Symmetrical m2m relation on self has no reverse accessor.
                raise NotImplementedError(
                    'Dependencies on symmetrical M2M relations are not supported due '
                    'to strange handling of the m2m_changed signal which only makes '
                    'half of the relation visible during signal execution. For now you '
                    'need to use symmetrical=False on the M2M field definition.'
                )
            else:
                self.accessor = self.field.rel.get_accessor_name()

        # Connect signals.
        signals = super().connect(index)

        m2m_signal = ElasticSignal(self, 'process_m2m', pass_kwargs=True)
        m2m_signal.connect(m2m_changed, sender=self.field.through)
        signals.append(m2m_signal)

        # If the relation has a custom through model, we need to subscribe to it.
        if not self.field.rel.through._meta.auto_created:  # pylint: disable=protected-access
            signal = ElasticSignal(self, 'process_m2m_through_save', pass_kwargs=True)
            signal.connect(post_save, sender=self.field.rel.through)
            signals.append(signal)

            signal = ElasticSignal(self, 'process_m2m_through_pre_delete', pass_kwargs=True)
            signal.connect(pre_delete, sender=self.field.rel.through)
            signals.append(signal)

            signal = ElasticSignal(self, 'process_m2m_through_post_delete', pass_kwargs=True)
            signal.connect(post_delete, sender=self.field.rel.through)
            signals.append(signal)

        return signals
567759
def listens_to(name, sender=None, weak=True):
    
    def decorator(f):
        if sender:
            return signal(name).connect(f, sender=sender, weak=weak)
        return signal(name).connect(f, weak=weak)
    return decorator