Search the signals DB for signal named *signal*,
    and which action matches *action* in a case
    insensitive way.

    :param signal: Regex for signal name.
    :param action: Regex for default action.
    :param signals: Database of signals.
165151
def search(signal='', action='', signals=SIGNALS):
    
    sig_re = re.compile(signal, re.IGNORECASE)
    act_re = re.compile(action, re.IGNORECASE)
    res = []
    for code in signals:
        sig, act, _ = signals[code]
        if sig_re.match(sig) and act_re.match(act):
            res.append(explain(code, signals=signals))
    return res
568460
def match(self, dom, act):
        
        return self.match_domain(dom) and self.match_action(act)
1222531
def signal_handler_mapping(self):
    """"""
    # Could use an enum here, but we never end up doing any matching on the specific signal value,
    # instead just iterating over the registered signals to set handlers, so a dict is probably
    # better.
    return {
      signal.SIGINT: self.handle_sigint,
      signal.SIGQUIT: self.handle_sigquit,
      signal.SIGTERM: self.handle_sigterm,
    }
147379
def _is_allowed_signal(self, signal):
        

        if signal not in self._allowed_signals:
            raise Exception("Signal '{0}' is not allowed for '{1}'.".format(
                signal, type(self)))
109427
def find_matching(cls, message, channel):
		
		return (
			handler
			for handler in cls._registry
			if isinstance(handler, cls)
			and handler.match(message, channel)
		)
1282753
def send_signal(self, signal_name, signal_args=None):
		
		try:
			self.__queues[signal_name].push(signal_args)
			for callback in self.__direct_callbacks[signal_name]:
				if callback is not None:
					callback(self, signal_name, signal_args)
		except KeyError:
			raise WUnknownSignalException('Unknown signal "%s"' % signal_name)
1104614
def _handle_signals(self):
        
        signal.signal(signal.SIGTERM, signal.SIG_DFL)
        signal.signal(signal.SIGINT, signal.SIG_IGN)
20700
def signal(self, details):
        
        log = self._params.get('log', self._discard)
        if '_signal' not in dir(self._parent) or not callable(getattr(self._parent, '_signal')):
            log.error("Event parent '%s' has no '_signal' method", self._name)
            return
        sig = utils.signum(self._handler_arg)
        if sig is None:
            log.error("Invalid signal '%s' for task '%s'", self._handler_arg, sig._name)
            return
        log.info("sending %s to all '%s' processes", utils.signame(sig), self._name)
        self._parent._signal(sig)
1270537
def signal_alias_exists(alias: str) -> bool:
        
        if SignalDispatcher.signals.get(alias):
            return True

        return False
509883
def register_signal(alias: str, signal: pyqtSignal):
        
        if SignalDispatcher.signal_alias_exists(alias):
            raise SignalDispatcherError('Alias "' + alias + '" for signal already exists!')

        SignalDispatcher.signals[alias] = signal
54950
def request_name(self, bus_name, flags) :
        ""
        if not self._registered_bus_names_listeners :
            self.connection.bus_add_match_action \
              (
                rule = "type=signal,interface=org.freedesktop.DBus,member=NameAcquired",
                func = self._bus_name_acquired,
                user_data = self
              )
            self.connection.bus_add_match_action \
              (
                rule = "type=signal,interface=org.freedesktop.DBus,member=NameLost",
                func = self._bus_name_lost,
                user_data = self
              )
            self._registered_bus_names_listeners = True
        #end if
        return \
            self.connection.bus_request_name(bus_name, flags)
337054
def _join_signals(self):
        """
        joined = dict()
        for name in self.signals:
            name_base = name.rsplit('_', 1)[0]
            names = joined.get(name_base, list())
            names.append(name)
            joined[name_base] = names
        for name_base, names in joined.items():
            if len(names) > 1:
                names = sorted(names)  # ensure dim ordering (_0, _1, etc.)
                signal_nd = np.stack([self.signals[n] for n in names], axis=1)
                self.signals[name_base] = signal_nd
                for name in names:
                    del self.signals[name]
316491
def _get_signal_event(self, s):
        '''
        
        '''
        try:
            return self._signal_events[int(s)]
        except KeyError:
            raise ValueError('Signal {} has not been enabled'.format(s))
1073147
def _get_action_type(self, action):
        '''
        
        '''
        action_name = next(iter(action or {'': None}))
        if ':' not in action_name:
            action_name = '{}:{}'.format(self.CALL_TYPE, action_name)

        return action_name.split(':')[0] or None
701470
def default_signal_map():
    
    name_map = {
        'SIGTSTP': None,
        'SIGTTIN': None,
        'SIGTTOU': None,
        'SIGTERM': 'terminate'}
    signal_map = {}
    for name, target in list(name_map.items()):
        if hasattr(signal, name):
            signal_map[getattr(signal, name)] = target
    return signal_map
830599
def signal(signal=None):
    '''
    
    '''
    valid_signals = {'forcestop': 'stop -force',
                     'securestart': 'start -security',
                     'start': 'start',
                     'stop': 'stop'}

    if signal not in valid_signals:
        return

    cmd = '{0}/bin/catalina.sh {1}'.format(
        __catalina_home(), valid_signals[signal]
    )
    __salt__['cmd.run'](cmd)
843741
def do_signal(self, signame: str) -> None:
        """"""
        if hasattr(signal, signame):
            os.kill(os.getpid(), getattr(signal, signame))
        else:
            self._sout.write('Unknown signal %s\n' % signame)