Delete all interrupt callbacks from a certain gpio
430497
def del_interrupt_callback(self, gpio_id):
        
        debug("- removing interrupts on gpio %s" % gpio_id)
        gpio_id = _GPIO.channel_to_gpio(gpio_id)
        fileno = self._map_gpioid_to_fileno[gpio_id]

        # 1. Remove from epoll
        self._epoll.unregister(fileno)

        # 2. Cache the file
        f = self._map_fileno_to_file[fileno]

        # 3. Remove from maps
        del self._map_fileno_to_file[fileno]
        del self._map_fileno_to_gpioid[fileno]
        del self._map_fileno_to_options[fileno]
        del self._map_gpioid_to_fileno[gpio_id]
        del self._map_gpioid_to_callbacks[gpio_id]

        # 4. Close file last in case of IOError
        f.close()
130906
def _clear_strobes(self):
        
        #reset some stuff
        self['SEQ']['GLOBAL_SHIFT_EN'].setall(False)
        self['SEQ']['GLOBAL_CTR_LD'].setall(False)
        self['SEQ']['GLOBAL_DAC_LD'].setall(False)
        self['SEQ']['PIXEL_SHIFT_EN'].setall(False)
        self['SEQ']['INJECTION'].setall(False)
885965
def no_interrupt(syscall, *args, **kwargs):
    
    ret = None

    while True:
        try:
            ret = syscall(*args, **kwargs)
        except OSError as e:
            if e.errno == errno.EINTR:
                continue
            else:
                raise
        else:
            break

    return ret
595628
def stop():
  '''  '''

  output, err = cli_syncthing_adapter.sys(exit=True)
  click.echo("%s" % output, err=err)
878933
def kill_all(self, kill_signal, kill_shell=False):
        """"""
        for key in self.processes.keys():
            self.kill_process(key, kill_signal, kill_shell)
297600
function () {
		var pointer = this;

		// Release all DOM events
		each(pointer._events, function (eventConfig) {	
			if (eventConfig[1].indexOf('on') === 0) {
				eventConfig[0][eventConfig[1]] = null; // delete breaks oldIE
			} else {		
				removeEvent(eventConfig[0], eventConfig[1], pointer['_' + eventConfig[2]]);
			}
		});
		delete pointer._events;

		// memory and CPU leak
		clearInterval(pointer.tooltipTimeout);
	}
836273
def suppress_keyboard_interrupt_message():
    
    old_excepthook = sys.excepthook

    def new_hook(type, value, traceback):
        if type != KeyboardInterrupt:
            old_excepthook(type, value, traceback)
        else:
            sys.exit(130)

    sys.excepthook = new_hook
545732
def off(  # pylint: disable=keyword-arg-before-vararg
            self, event: str = None, *handlers: T.Callable
    ) -> None:
        """"""

        if not event:
            self._events.clear()
            return

        if event not in self._events:
            raise EventNotFound(event)

        if not handlers:
            self._events.pop(event)
            return

        for callback in handlers:
            if callback not in self._events[event]:
                raise HandlerNotFound(event, callback)
            while callback in self._events[event]:
                self._events[event].remove(callback)
        return
658984
def stop_subprocess(pid):
    """"""
    if hasattr(os, "kill"):
        import signal
        os.kill(pid, signal.SIGTERM)
    else:
        import win32api
        pid = win32api.OpenProcess(1, 0, pid)
        win32api.TerminateProcess(pid, 0)
    os.waitpid(pid, 0)
1298793
def remove_all_callbacks(self):
        
        for cb_id in list(self._next_tick_callback_removers.keys()):
            self.remove_next_tick_callback(cb_id)
        for cb_id in list(self._timeout_callback_removers.keys()):
            self.remove_timeout_callback(cb_id)
        for cb_id in list(self._periodic_callback_removers.keys()):
            self.remove_periodic_callback(cb_id)
1106909
def reset(self):
        
        if self._spi_reset == None: return
        GPIO.output( self._spi_reset, 1 )
        time.sleep(0.002)
        GPIO.output( self._spi_reset, 0 )
        time.sleep(0.015)
        GPIO.output( self._spi_reset, 1 )
429637
def clear(self, signal=None):
        
        if signal is not None:
            self._callbacks.pop(signal, None)
        else:
            self._callbacks.clear()
1104814
def sigint(self) -> None:
        ''''''

        if self.stop_attempts < 1:
            Log.info('gracefully stopping tasks')
            self.stop_attempts += 1
            self.terminate()

        elif self.stop_attempts < 2:
            Log.info('forcefully cancelling tasks')
            self.stop_attempts += 1
            self.terminate(force=True)

        else:
            Log.info('forcefully stopping event loop')
            self.loop.stop()
1281264
def _handle_interrupt(self, fileno, val):
        
        val = int(val)

        # Filter invalid edge values (sometimes 1 comes in when edge=falling)
        edge = self._map_fileno_to_options[fileno]["edge"]
        if (edge == 'rising' and val == 0) or (edge == 'falling' and val == 1):
            return

        # If user activated debounce for this callback, check timing now
        debounce = self._map_fileno_to_options[fileno]["debounce_timeout_s"]
        if debounce:
            t = time.time()
            t_last = self._map_fileno_to_options[fileno]["interrupt_last"]
            if t - t_last < debounce:
                debug("- don't start interrupt callback due to debouncing")
                return
            self._map_fileno_to_options[fileno]["interrupt_last"] = t

        # Start the callback(s) now
        gpio_id = self._map_fileno_to_gpioid[fileno]
        if gpio_id in self._map_gpioid_to_callbacks:
            for cb in self._map_gpioid_to_callbacks[gpio_id]:
                cb(gpio_id, val)
786052
def interrupt(self, interrupt):
        """"""
        self._interrupt = True
        self.stop()
        self._interrupt = interrupt
862036
def off(self, events, callback):
        
        if isinstance(events, (str, unicode)):
            events = [events]
        for event in events:
            for callback_obj in self._on_off_events[event]:
                if callback_obj['callback'] == callback:
                    try:
                        del self._on_off_events[event]
                    except KeyError:
                        pass
692769
def interrupt_kernel_hack(signal_to_send=None):
    
    global pid
    import signal
    import os
    if pid is None:
        # Avoid errors if we couldn't get pid originally,
        # by trying to obtain it now
        pid = set_pid()

        if pid is None:
            echo("cannot get kernel PID, Ctrl-C will not be supported")
            return
    if not signal_to_send:
        signal_to_send = signal.SIGINT

    echo("KeyboardInterrupt (sent to ipython: pid " +
        "%i with signal %s)" % (pid, signal_to_send),"Operator")
    try:
        os.kill(pid, int(signal_to_send))
    except OSError:
        echo("unable to kill pid %d" % pid)
        pid = None