Sets the new numerator (number of items done).

        Positional arguments:
        numerator -- the new numerator to add to the timing data.

        Keyword arguments:
        calculate -- calculate the ETA and rate by default.
3184
def set_numerator(self, numerator, calculate=True):
        
        # Validate
        if self._timing_data and numerator < self._timing_data[-1][1]:
            raise ValueError('numerator cannot decrement.')

        # Update data.
        now = _NOW()
        if self._timing_data and now == self._timing_data[-1][0]:
            self._timing_data[-1] = (now, numerator)  # Overwrite.
        else:
            self._timing_data.append((now, numerator))

        # Calculate ETA and rate.
        if not self.done and calculate and self.started:
            self._calculate()
998851
def add(self, num):
        
        try:
            val = self.value() + num
        except:
            val = num

        chunk = self.mfac.value()
        if val % chunk > 0:
            if num > 0:
                val = chunk*(val // chunk + 1)
            elif num < 0:
                val = chunk*(val // chunk)

        val = max(self._min(), min(self._max(), val))
        self.set(val)
433500
def set(self, num):
        
        self._value = str(round(float(num), self.nplaces))
        self._variable.set(self._value)
832562
public Num calculate() {
        unbind();
        prepareForNewCalculation();
        
        PostfixCalculator pc = convertToPostfix();
        Num cv = pc.calculate(this, postfix, trackSteps);

        lastCalculatedValue = cv.clone();

        return cv;
    }
627540
def _calculate_eta(self, progress, data, value, elapsed):
        ''''''
        if elapsed:
            # The max() prevents zero division errors
            per_item = elapsed.total_seconds() / max(value, 1e-6)
            remaining = progress.max_value - data['value']
            eta_seconds = remaining * per_item
        else:
            eta_seconds = 0

        return eta_seconds
381474
def incrementor(start=0, step=1):
  
  def fxn(_):
    """Returns the next value in the sequnce defined by [start::step)"""
    nonlocal start
    rval = start
    start += step
    return rval
  return fxn
870537
def put(self, *args, **kwargs):
        
        self.inq.put((self._putcount, (args, kwargs)))
        self._putcount += 1
620550
public void update(long numProcessedDuringStep) {
        if (this.closed) {
            throw new ETAPrinterException("You cannot update a closed ETAPrinter!");
        }
        DateTime now = DateTime.now();
        ItemsDuration itemsDuration = null;
        if (numProcessedDuringStep > 0) {
            long stepDuration = new Duration(this.lastStep, now).getMillis();
            int numItems = 1;
            do {
                long duration = stepDuration / (numProcessedDuringStep / numItems);
                itemsDuration = new ItemsDuration(numItems, duration);
                numItems++;
            } while (itemsDuration.durationMillis == 0);
        }
        this.lastStep = now;
        this.numProcessed += numProcessedDuringStep;
        if (this.numProcessed == this.totalElementsToProcess) {
            this.close();
        } else {
            this.print(itemsDuration);
        }
    }
729541
def _at_print(self, calculator, rule, scope, block):
        
        value = calculator.calculate(block.argument)
        sys.stderr.write("%s\n" % value)
1086506
function Calculator(settings) {
    this.settings = assign({}, defaults, settings);
    this.requests = new Requests(this.settings['apiUrl'], this.settings['version'], this.settings['publicKey']);
}
420633
def _UpdateCounters(self, event):
    
    self._session.parsers_counter['total'] += 1

    # Here we want the name of the parser or plugin not the parser chain.
    parser_name = getattr(event, 'parser', '')
    _, _, parser_name = parser_name.rpartition('/')
    if not parser_name:
      parser_name = 'N/A'
    self._session.parsers_counter[parser_name] += 1
744670
def set_trig_start(self,time,pass_to_command_line=True):
    
    if pass_to_command_line:
      self.add_var_opt('trig-start-time',time)
    self.__trig_start = time
657642
def set_ticks(self, number):
        '''

        '''
        self.max_index = number
        self.current_index = 0
        self.slider.setMaximum(self.max_index-1)
        self.slider.setMinimum(0)
        self.slider.setPageStep(1)
293892
private void timing(String metric, Date startDate) {
        m_logger.trace("Time for '{}': {}", metric,
                       ((new Date()).getTime() - startDate.getTime()) + " millis");
    }
298162
def set(self, num):
        
        self._value = coord.Angle(num, unit=u.deg)
        self._variable.set(self.as_string())
478727
def add(self, *number):
        """"""
        return self._format_result(sum(
            # positional arguments are always strings
            [int(n) for n in number]))
626391
def NumRegressors(npix, pld_order, cross_terms=True):
    '''
    

    '''

    res = 0
    for k in range(1, pld_order + 1):
        if cross_terms:
            res += comb(npix + k - 1, k)
        else:
            res += npix
    return int(res)