Work out the number to display for each question/slot.
979186
protected function number_questions() {
        $number = 1;
        foreach ($this->pagelayout as $page => $slots) {
            foreach ($slots as $slot) {
                if ($length = $this->is_real_question($slot)) {
                    $this->questionnumbers[$slot] = $number;
                    $number += $length;
                } else {
                    $this->questionnumbers[$slot] = get_string('infoshort', 'quiz');
                }
                $this->questionpages[$slot] = $page;
            }
        }
    }
1352609
public function question_number($number) {
        if (is_numeric($number)) {
            $number = html_writer::span(get_string('question'), 'accesshide') . ' ' . $number;
        }
        return html_writer::tag('span', $number, array('class' => 'slotnumber'));
    }
1265625
private function calc()
    {
        $this->limitOffset = max((int)(($this->page - 1) * $this->count), 0);
        $this->limitEndOffset = $this->limitOffset + $this->count;
    }
171202
def r_num(obj):
    """"""
    if isinstance(obj, (list, tuple)):
        it = iter
    else:
        it = LinesIterator
    dataset = Dataset([Dataset.FLOAT])
    return dataset.load(it(obj))
1269935
def get_number(self, question, min_i=float("-inf"), max_i=float("inf"),
                   just_these=None):
        
        try:
            user_answer = self.get_answer(question)
            user_answer = float(user_answer)

            if min_i < user_answer < max_i:
                if just_these:
                    if user_answer in just_these:
                        return user_answer

                    exc = "Number cannot be accepted. Just these: "
                    exc += str(just_these)
                    raise Exception(exc)

                return user_answer

            exc = "Number is not within limits. "
            exc += "Min is " + str(min_i) + ". Max is " + str(max_i) + ""
            raise Exception(exc)
        except Exception as exc:
            print(str(exc))
            return self.get_number(
                self.last_question,
                min_i=min_i,
                max_i=max_i,
                just_these=just_these
            )
893810
def question(self, n):
        
        print("")
        prompt_ask = raw_input("{0} [K/O/R/D/M/Q]? ".format(n))
        print("")
        if prompt_ask in ("K", "k"):
            self.keep()
        elif prompt_ask in ("O", "o"):
            self._overwrite(n)
        elif prompt_ask in ("R", "r"):
            self._remove(n)
        elif prompt_ask in ("D", "d"):
            self.diff(n)
            self.i -= 1
        elif prompt_ask in ("M", "m"):
            self.merge(n)
        elif prompt_ask in ("Q", "q", "quit"):
            self.quit()
484114
def start(st_reg_number):
    """"""

    weights = [9, 8, 7, 6, 5, 4, 3, 2]
    number_state_registration = st_reg_number[0:len(st_reg_number) - 1]
    digit_state_registration = st_reg_number[-1]

    if st_reg_number[0:2] not in ['10', '11', '12']:
        return False

    if len(st_reg_number) != 9:
        return False

    sum_total = 0

    for i in weights:
        sum_total = sum_total + i * (int(number_state_registration[-i+1]))

    check_number = number_state_registration <= 10119997

    if sum_total % 11 == 0:
        return '0' == digit_state_registration

    elif sum_total % 11 == 1 and (int(number_state_registration) >= 10103105 and check_number):
        return '1' == digit_state_registration

    elif sum_total % 11 == 1:
        return '0' == digit_state_registration

    else:
        digit_check = 11 - sum_total % 11
        return digit_state_registration == str(digit_check)

    if number_state_registration == '11094402' and (number_state_registration == '1' or number_state_registration == '0'):
        return True
289169
public function load_and_initialise_questions_for_calculations($quiz) {
        // Load the questions.
        $questions = quiz_report_get_significant_questions($quiz);
        $questionids = array();
        foreach ($questions as $question) {
            $questionids[] = $question->id;
        }
        $fullquestions = question_load_questions($questionids);
        foreach ($questions as $qno => $question) {
            $q = $fullquestions[$question->id];
            $q->maxmark = $question->maxmark;
            $q->slot = $qno;
            $q->number = $question->number;
            $questions[$qno] = $q;
        }
        return $questions;
    }
1178679
@Override
	public int getNumberLeaves() {
		while (true) {
			try {
				int result = 0;
				for (Slot slot: subSlots){
					result += slot.getNumberLeaves();
				}
				return result;
			}
			catch (ConcurrentModificationException e) {
				// ignore and retry
			}
		}
	}
306958
def _displaystr2num(st):
    """"""
    num = None
    for s, n in [('DFP-', 16), ('TV-', 8), ('CRT-', 0)]:
        if st.startswith(s):
            try:
                curnum = int(st[len(s):])
                if 0 <= curnum <= 7:
                    num = n + curnum
                    break
            except Exception:
                pass
    if num is not None:
        return num
    else:
        raise ValueError('Unrecognised display name: ' + st)
1059386
def read_questions(self):
        """"""
        format = '!HH'
        length = struct.calcsize(format)
        for i in range(0, self.num_questions):
            name = self.read_name()
            info = struct.unpack(format,
                    self.data[self.offset:self.offset + length])
            self.offset += length

            question = DNSQuestion(name, info[0], info[1])
            self.questions.append(question)
179246
def _populate_inputs(self, total):
        
        total = total + 1
        for input_number in range(1, total):
            self.query('ISN'+str(input_number).zfill(2))
30986
def number(items):
    """"""
    n = len(items)
    if n == 0:
        return items
    places = str(int(math.log10(n) // 1 + 1))
    format = '[{0[0]:' + str(int(places)) + 'd}] {0[1]}'
    return map(
        lambda x: format.format(x),
        enumerate(items)
    )
178426
def calc_query(self):
        """"""
        # initial query
        if self.query_dist is None:
            self.query_dist = self.exp4p_.next(-1, None, None)
        else:
            self.query_dist = self.exp4p_.next(
                self.calc_reward_fn(),
                self.queried_hist_[-1],
                self.dataset.data[self.queried_hist_[-1]][1]
            )
        return
228870
def check_params(num_rows, num_cols, padding):
    """"""

    num_rows = check_int(num_rows, 'num_rows', min_value=1)
    num_cols = check_int(num_cols, 'num_cols', min_value=1)
    padding = check_int(padding, 'padding', min_value=0)

    return num_rows, num_cols, padding
1018463
def sr(self, multi=0):
        """"""  # noqa: E501
        remain = self.res[:]
        sr = []
        i = 0
        while i < len(remain):
            s = remain[i]
            j = i
            while j < len(remain) - 1:
                j += 1
                r = remain[j]
                if r.answers(s):
                    sr.append((s, r))
                    if multi:
                        remain[i]._answered = 1
                        remain[j]._answered = 2
                        continue
                    del(remain[j])
                    del(remain[i])
                    i -= 1
                    break
            i += 1
        if multi:
            remain = [x for x in remain if not hasattr(x, "_answered")]
        return SndRcvList(sr), PacketList(remain)
95041
private void scanNumber() {

        if (mInput >= '0' && mInput <= '9') {
            mOutput.append(mInput);
            mPos++;
        } else {
            // could be an e-number
            if (mInput == 'E' || mInput == 'e') {
                mStartState = State.E_NUM;
            }
            mFinnished = true;
        }
    }