Execute algorithm (if max_times = None, there can be forever loop).
161272
def execute(self, string, max_tacts=None):
        """"""
        counter = 0
        self.last_rule = None

        while True:
            string = self.execute_once(string)
            if self.last_rule is None or self.last_rule[2]:
                break
            counter += 1
            if max_tacts is not None and counter >= max_tacts:
                raise TimeoutError("algorithm hasn't been stopped")

        return string
1276997
def max_values(args):
    
    return Interval(max(x.low for x in args), max(x.high for x in args))
305089
def blpop(self, key, *keys, timeout=0, encoding=_NOTSET):
        
        if not isinstance(timeout, int):
            raise TypeError("timeout argument must be int")
        if timeout < 0:
            raise ValueError("timeout must be greater equal 0")
        args = keys + (timeout,)
        return self.execute(b'BLPOP', key, *args, encoding=encoding)
726738
def command_max_run_time(self, event=None):
        
        try:
            max_run_time = self.max_run_time_var.get()
        except ValueError:
            max_run_time = self.runtime_cfg.max_run_time

        self.runtime_cfg.max_run_time = max_run_time
        self.max_run_time_var.set(self.runtime_cfg.max_run_time)
452291
def run_loop(agents, env, max_frames=0, max_episodes=0):
  """"""
  total_frames = 0
  total_episodes = 0
  start_time = time.time()

  observation_spec = env.observation_spec()
  action_spec = env.action_spec()
  for agent, obs_spec, act_spec in zip(agents, observation_spec, action_spec):
    agent.setup(obs_spec, act_spec)

  try:
    while not max_episodes or total_episodes < max_episodes:
      total_episodes += 1
      timesteps = env.reset()
      for a in agents:
        a.reset()
      while True:
        total_frames += 1
        actions = [agent.step(timestep)
                   for agent, timestep in zip(agents, timesteps)]
        if max_frames and total_frames >= max_frames:
          return
        if timesteps[0].last():
          break
        timesteps = env.step(actions)
  except KeyboardInterrupt:
    pass
  finally:
    elapsed_time = time.time() - start_time
    print("Took %.3f seconds for %s steps: %.3f fps" % (
        elapsed_time, total_frames, total_frames / elapsed_time))
1144003
def _repeat(self, index, stage, stop):
        
        times = None
        if 'iterations' in stage.kwargs:
            times = stage.kwargs['iterations'] - 1
        stages_back = 1
        if 'stages' in stage.kwargs:
            stages_back = stage.kwargs['stages']
        i = 0
        while i != times:
            if stop.is_set():
                break
            for forward in range(stages_back):
                if stop.is_set():
                    break
                stage_index = index - stages_back + forward
                self._execute_stage(stage_index, self._pipe[stage_index], stop)
            i += 1
551456
def run(self, **kwargs):
        """"""
        if 'timestamp' not in kwargs:
            kwargs['timestamp'] = datetime.datetime.utcnow().isoformat()
        if 'version' not in kwargs:
            kwargs['version'] = "Not Defined" #bibcat.__version__
        # log.debug("kwargs: %s", pprint.pformat({k:v for k, v in kwargs.items()
        #                                         if k != "dataset"}))
        # log.debug("parents: %s", self.parents)
        for map_key, triple_map in self.triple_maps.items():
            if map_key not in self.parents:
                self.execute(triple_map, **kwargs)
727753
def _run_forever(self):
        
        while True:
            try:
                tick = time.time()

                asyncore.loop(timeout=self.POLL_TIMEOUT, use_poll=True)

                # Sleep for remaining poll cycle time
                tick += self.POLL_TIMEOUT - time.time()
                if tick > 0:
                    # wait POLL_TIMEOUT at most (robust against time shifts)
                    time.sleep(min(tick, self.POLL_TIMEOUT))
            except KeyboardInterrupt as exc:
                self.LOG.info("Termination request received (%s)" % exc)
                break
            except SystemExit as exc:
                self.return_code = exc.code or 0
                self.LOG.info("System exit (RC=%r)" % self.return_code)
                break
            else:
                # Idle work
                #self.LOG.warn("IDLE %s %r" % (self.options.guard_file, os.path.exists(self.options.guard_file)))
                if self.options.guard_file and not os.path.exists(self.options.guard_file):
                    self.LOG.warn("Guard file '%s' disappeared, exiting!" % self.options.guard_file)
                    break
108775
def serve_forever(self):
        """"""
        loop = True
        while loop:
            loop = self.__serve_forever()
        self.end()
381136
def run_iteration(self):
        '''
        '''

        self._employer_phase()
        self._calc_probability()
        self._onlooker_phase()
        self._check_positions()
659352
def _run_alg(self, max_iter):
        

        if self.progress:
            with ProgressBar(redirect_stdout=True, max_value=max_iter) as bar:
                self._iterations(max_iter, bar=bar)
        else:
            self._iterations(max_iter)
480169
public function run()
    {
        $this->init();

        // Loop forever, except when a maximum number of requests is configured
        $requestsHandled = 0;
        while ($this->maxRequests === null || $requestsHandled < $this->maxRequests) {
            $this->doStep();
            $requestsHandled++;
        }
    }
1125706
def setMaximum(self, maximum):
        
        if not isinstance(maximum, int):
            raise TypeError("Argument is not of type int or long")
        self._maximum = maximum
949462
def start(self, max_val):
    
    self._timer.init_timer(max_value=max_val)

    self._infinite_mode = max_val <= 0
    self._infinite_position = 0

    self._max = max_val
    self._fill_empty()
    self._value = 0
    self.progress(0)
    self._status = ProgressBarStatus.started
214622
public void executeWithDelay() {
        long now = Clock.currentTimeMillis();
        if (delay + now > hardLimit) {
            scheduleNewExecution(now);
        } else if (!tryPostponeExecution()) {
            scheduleNewExecution(now);
        }
    }
962736
def execute_once(self):
        """"""
        symbol = self.tape.get(self.head, self.EMPTY_SYMBOL)

        index = self.alphabet.index(symbol)
        rule = self.states[self.state][index]

        if rule is None:
            raise RuntimeError('Unexpected symbol: ' + symbol)

        self.tape[self.head] = rule[0]

        if rule[1] == 'L':
            self.head -= 1
        elif rule[1] == 'R':
            self.head += 1

        self.state = rule[2]
762666
def intervals(_min, _max=None, size=1):
    
    if _max == None:
        _max = _min
        _min = 0
    _max = int(mo_math.ceiling(_max))
    _min = int(mo_math.floor(_min))

    output = ((x, min(x + size, _max)) for x in _range(_min, _max, size))
    return output