Turns on Do Not Disturb mode for the current user, or changes its duration.

        Args:
            num_minutes (int): The snooze duration. e.g. 60
321430
def dnd_setSnooze(self, *, num_minutes: int, **kwargs) -> SlackResponse:
        
        self._validate_xoxp_token()
        kwargs.update({"num_minutes": num_minutes})
        return self.api_call("dnd.setSnooze", http_verb="GET", params=kwargs)
91034
def _delay_call(self):
        
        now = time.time()

        time_since_last = now - self.last_call_time

        if time_since_last < DELAY_TIME:
            time.sleep(DELAY_TIME - time_since_last)

        self.last_call_time = now
180808
def set_timeout(self, visibility_timeout):
        
        retval = self.set_attribute('VisibilityTimeout', visibility_timeout)
        if retval:
            self.visibility_timeout = visibility_timeout
        return retval
1073336
private void setInactivityTimer(long ms) {
        if (sessionInactivityTimer == null) {
            sessionInactivityTimer = new SessionInactivityTimer(sessionHandler.getScheduler(), this);
        }
        sessionInactivityTimer.setIdleTimeout(ms);
    }
593777
def interruptible_sleep(t, event=None):
    
    log.info("sleeping %s", t)

    if event is None:
        time.sleep(t)
        return False
    else:
        return not event.wait(t)
687218
def alarm_set(self, time, wake_with_radio=False):
        
        # TODO: check for correct time format
        log.debug("alarm => set...")
        params = {
            "enabled": True,
            "time": time,
            "wake_with_radio": wake_with_radio
        }
        self._app_exec("com.lametric.clock", "clock.alarm", params=params)
808611
def _disable(self):
        
        self.total_time += time() - self.enabled_start
        self.enabled_start = None
        del self.stack
1173164
def check_runtime_remaining(the_session, the_helper, the_snmp_value):
    
    a_minute_value = calc_minutes_from_ticks(the_snmp_value)
    the_helper.add_metric(
        label=the_helper.options.type,
        value=a_minute_value,
        warn=the_helper.options.warning,
        crit=the_helper.options.critical,
        uom="Minutes")
    the_helper.check_all_metrics()
    the_helper.set_summary("Remaining runtime on battery is {} minutes".format(a_minute_value))
9882
def setTimeout(self, time):
        """"""
        self.conversation.SetDDETimeout(round(time))
        return self.conversation.GetDDETimeout()
928418
def stop_timer(self, timer_id):
        
        self._logger.debug('Stop timer {} in stm {}'.format(timer_id, self.id))
        self._driver._stop_timer(timer_id, self)
1313948
def init_timer(client_id):
    
    if client_id in timers and timers[client_id]:
        timers[client_id].start()
        return
    # Create a timer to call check_new_message function after every 2 seconds.
    # client_id param is needed to be passed to check_new_message
    timers[client_id] = RepeatedTimer(2, check_new_messages, client_id)
784803
def set_time(self, time):
        '''
        
        '''
        self.length = int(time*self.sample_rate)
        return self
93590
def lock(self, seconds=5):
        
        self._current_application().lock(robot.utils.timestr_to_secs(seconds))
931118
def get_sleep_timer(self):
        
        resp = self.avTransport.GetRemainingSleepTimerDuration([
            ('InstanceID', 0),
        ])
        if resp['RemainingSleepTimerDuration']:
            times = resp['RemainingSleepTimerDuration'].split(':')
            return (int(times[0]) * 3600 +
                    int(times[1]) * 60 +
                    int(times[2]))
        else:
            return None
875107
def set(self, time):
        
        self._time = time
        self._pb.sec = int(self._time)
        self._pb.nsec = int((self._time - self._pb.sec) * 10 ** 9)
525335
def set_duration(self, duration):
        
        if duration == 0:
            self.widget.setDuration(-2) #: Infinite
        else:
            self.widget.setDuration(0)
197583
def timeout(seconds=10, default_output='default_output'):
    
    def decorator(func):
        def _handle_timeout(signum, frame):
            """ throw the custom TimeoutError if called """
            raise TimeoutError(strerror(ETIME))

        def wrapper(*args, **kwargs):
            """ main wrapper for the error """
            # set up the propper error signal
            signal(SIGALRM, _handle_timeout)
            # set the time the function has to run
            alarm(seconds)
            try:
                result = func(*args, **kwargs)
            except TimeoutError:
                if default_output == 'default_output':
                    raise
                else:
                    result = default_output
            finally:
                # cancel the timer
                alarm(0)
            return result

        return wraps(func)(wrapper)
    return decorator