Complete the standard debriefing form.

        Answers the questions in the base questionnaire.
972197
def complete_questionnaire(self):
        
        while True:
            data = {
                "question": "questionnaire",
                "number": 1,
                "response": json.dumps(self.question_responses),
            }
            url = "{host}/question/{self.participant_id}".format(
                host=self.host, self=self
            )
            try:
                result = requests.post(url, data=data)
                result.raise_for_status()
            except RequestException:
                self.stochastic_sleep()
                continue
            return True
1275295
def start(options={}, &block)
      debrief options
      @started = true
      load_completions
      Rc.module_eval(&block) if block
      true
    end
1155649
public function standard_mark_summary(question_attempt $qa, qbehaviour_renderer $behaviouroutput, question_display_options $options) {
        if (!$options->marks) {
            return '';

        } else if ($qa->get_max_mark() == 0) {
            return get_string('notgraded', 'question');

        } else if ($options->marks == question_display_options::MAX_ONLY ||
                is_null($qa->get_fraction())) {
            return $behaviouroutput->marked_out_of_max($qa, $this, $options);

        } else {
            return $behaviouroutput->mark_out_of_max($qa, $this, $options);
        }
    }
1043908
function ask(questions, finish, answers, input, output) {
    finish = finish || function() {};
    input = input || function(cb) {process.stdin.on('data', cb);};
    output = output || function(a) {console.log(a);};

    var i = 0;
    var ret = {};
    var e = questions[0];
    var v = match(ops, e);

    output(getOutput(e, v));
    input(getInput);

    function getOutput(e, v) {
        var o = f.isFunction(v.output)? v.output(e): '';

        return e.q + o;
    }

    function getInput(t) {
        t = t.trim();
        var r = v.exec(t, e);

        if(f.isDefined(r)) {
            ret[e.id] = r;
            i++;

            if(i >= questions.length) {
                // XXX: separate this somehow
                process.stdin.removeListener('data', getInput);
                process.stdin.pause();

                finish(ret);
            }
            else {
                e = questions[i];
                v = match(ops, e);
                output(getOutput(e, v));
            }
        }
    }
}
1108635
def create_question_group(self, quiz_id, course_id, quiz_groups_assessment_question_bank_id=None, quiz_groups_name=None, quiz_groups_pick_count=None, quiz_groups_question_points=None):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - course_id
        """ID"""
        path["course_id"] = course_id

        # REQUIRED - PATH - quiz_id
        """ID"""
        path["quiz_id"] = quiz_id

        # OPTIONAL - quiz_groups[name]
        """The name of the question group."""
        if quiz_groups_name is not None:
            data["quiz_groups[name]"] = quiz_groups_name

        # OPTIONAL - quiz_groups[pick_count]
        """The number of questions to randomly select for this group."""
        if quiz_groups_pick_count is not None:
            data["quiz_groups[pick_count]"] = quiz_groups_pick_count

        # OPTIONAL - quiz_groups[question_points]
        """The number of points to assign to each question in the group."""
        if quiz_groups_question_points is not None:
            data["quiz_groups[question_points]"] = quiz_groups_question_points

        # OPTIONAL - quiz_groups[assessment_question_bank_id]
        """The id of the assessment question bank to pull questions from."""
        if quiz_groups_assessment_question_bank_id is not None:
            data["quiz_groups[assessment_question_bank_id]"] = quiz_groups_assessment_question_bank_id

        self.logger.debug("POST /api/v1/courses/{course_id}/quizzes/{quiz_id}/groups with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("POST", "/api/v1/courses/{course_id}/quizzes/{quiz_id}/groups".format(**path), data=data, params=params, no_data=True)
533250
def simulationStep(self, step=0):
        
        self._queue.append(tc.CMD_SIMSTEP)
        self._string += struct.pack("!BBi", 1 +
                                    1 + 4, tc.CMD_SIMSTEP, step)
        result = self._sendExact()
        for subscriptionResults in self._subscriptionMapping.values():
            subscriptionResults.reset()
        numSubs = result.readInt()
        responses = []
        while numSubs > 0:
            responses.append(self._readSubscription(result))
            numSubs -= 1
        return responses
379199
def handle_query(self, msg, addr, port, orig):
        
        out = None

        # Support unicast client responses
        #
        if port != _MDNS_PORT:
            out = DNSOutgoing(_FLAGS_QR_RESPONSE | _FLAGS_AA, 0)
            for question in msg.questions:
                out.add_question(question)
        for question in msg.questions:
            if question.type == _TYPE_PTR:
                for service in self.services.values():
                    if question.name == service.type:
                        # FIXME: sometimes we just not in time filling cache
                        answer = self.cache.get(
                                DNSPointer(service.type,
                                    _TYPE_PTR, _CLASS_IN,
                                    service.ttl, service.name))
                        if out is None and answer is not None:
                            out = DNSOutgoing(_FLAGS_QR_RESPONSE | _FLAGS_AA)
                        if answer:
                            out.add_answer(msg, answer)
            if question.type == _TYPE_AXFR:
                if question.name in list(self.zones.keys()):
                    if out is None:
                        out = DNSOutgoing(_FLAGS_QR_RESPONSE | _FLAGS_AA)
                    for i in self.zones[question.name].services.values():
                        out.add_answer(msg, i)
            else:
                try:
                    if out is None:
                        out = DNSOutgoing(_FLAGS_QR_RESPONSE | _FLAGS_AA)

                    service = self.services.get(question.name.lower(), None)
                    try:
                        rs = service.records
                    except:
                        rs = []

                    # Answer A record queries for any service addresses we know
                    if (question.type == _TYPE_A or \
                            question.type == _TYPE_ANY) \
                            and (_TYPE_A in rs):
                        for service in self.services.values():
                            if service.server == question.name.lower():
                                for i in service.address:
                                    out.add_answer(msg, self.cache.get(
                                        DNSAddress(question.name,
                                            _TYPE_A, _CLASS_IN | _CLASS_UNIQUE,
                                            service.ttl, i)))

                    if not service:
                        continue

                    if (question.type == _TYPE_SRV or \
                            question.type == _TYPE_ANY) and (_TYPE_SRV in rs):
                        out.add_answer(msg, self.cache.get(
                            DNSService(question.name,
                                _TYPE_SRV, _CLASS_IN | _CLASS_UNIQUE,
                                service.ttl, service.priority, service.weight,
                                service.port, service.server)))
                    if (question.type == _TYPE_TXT or \
                            question.type == _TYPE_ANY) and \
                            (_TYPE_TXT in rs):
                        out.add_answer(msg, self.cache.get(
                            DNSText(question.name,
                                _TYPE_TXT, _CLASS_IN | _CLASS_UNIQUE,
                                service.ttl, service.text)))
                    if (question.type == _TYPE_SRV) and (_TYPE_SRV in rs):
                        for i in service.address:
                            out.add_additional_answer(self.cache.get(
                                DNSAddress(service.server,
                                    _TYPE_A, _CLASS_IN | _CLASS_UNIQUE,
                                    service.ttl, i)))
                except:
                    traceback.print_exc()

        if out is not None and out.answers:
            out.id = msg.id
            self.send(out, addr, port)
988045
def _stage(self, accepted, count=0):
        """"""
        new5 = self._combine_rest_push()
        new1 = self._combine_push_pop()
        new2 = self._combine_push_rest()
        new3 = self._combine_pop_rest()
        new4 = self._combine_rest_rest()
        new = new1 + new2 + new3 + new4 + new5
        del new1
        del new2
        del new3
        del new4
        del new5
        if len(new) == 0:
            # self.printer()
            # print 'PDA is empty'
            # logging.debug('PDA is empty')
            return None

        self.statediag = self.statediag + new
        del new
        # print 'cleaning...'

        # It is cheaper to create a new array than to use the old one and
        # delete a key
        newstates = []
        for key in self.statediag:
            if len(key.trans) == 0 or key.trans == {}:
                # rint 'delete '+`key.id`
                # self.statediag.remove(key)
                pass
            else:
                newstates.append(key)

        del self.statediag
        self.statediag = newstates
        self.quickresponse = {}
        self.quickresponse_types = {}
        self.quickresponse_types[0] = []
        self.quickresponse_types[1] = []
        self.quickresponse_types[2] = []
        self.quickresponse_types[3] = []
        self.quickresponse_types[4] = []
        for state in self.statediag:
            if state.id not in self.quickresponse:
                self.quickresponse[state.id] = [state]
            else:
                self.quickresponse[state.id].append(state)
            self.quickresponse_types[state.type].append(state)

            # else:
            #     print `key.id`+' (type: '+`key.type`+' and sym:'+`key.sym`+')'
            #     print key.trans
        # print 'checking...'
        exists = self._check(accepted)
        if exists == -1:
            # DEBUGself.printer()
            # raw_input('next step?')
            return self._stage(accepted, count + 1)
        else:
            # DEBUGself.printer()
            # print 'Found '
            print exists
            # return self._stage(accepted, count+1)
            return exists
958083
def get_survey
      url = ApiRequest.base_path("questionpro.survey.getSurvey")
      result = self.class.get(url, body: self.options)
      
      self.full_response = result
      self.status = result['status']

      survey = Survey.new(result['response'])

      return survey
    end
221402
def pass_acts_as_list_method_to(presentation_questionnaires, symbol, questionnaire)
      raise "A Questionnaire is needed to identify the PresentationQuesti" unless questionnaire.kind_of? Questionnaire
      presentation_questionnaire = presentation_questionnaires.where(:questionnaire_id => questionnaire.id).first
      presentation_questionnaire.send(symbol) if presentation_questionnaire
    end
365969
def refresh(self):
      '''
      '''
      response = requests.get('%s/guides/%s' % (API_BASE_URL, self.id))
      attributes = response.json()
      
      self.category = Category(attributes['category'])
      self.url = attributes['url']
      
      self.title = attributes['title']
      if attributes['image']:
         self.image = Image(attributes['image']['id'])
      else:
         self.image = None
      self.locale = attributes['locale']
      self.introduction = WikiText(attributes['introduction_raw'],
                                   attributes['introduction_rendered'])
      self.conclusion = WikiText(attributes['conclusion_raw'],
                                 attributes['conclusion_rendered'])
      #self.tools = attributes['tools']
      #self.parts = attributes['parts']
      self.subject = attributes['subject']
      self.modifiedDate = datetime.utcfromtimestamp(attributes['modified_date'])
      self.createdDate = datetime.utcfromtimestamp(attributes['created_date'])
      self.publishedDate = datetime.utcfromtimestamp(attributes['published_date'])
      #self.documents = attributes['documents']
      author = attributes['author']
      #self.author = User(author['userid'], name=author['text'])
      #self.timeRequired = attributes['timeRequired']
      self.steps = [Step(step['guideid'], step['stepid'], data=step) for step in attributes['steps']]
      self.type = attributes['type']
      self.public = attributes['public']
      self.revision = attributes['revisionid']
      self.difficulty = attributes['difficulty']
      self.prerequisites = [Guide(guide['guideid']) for guide in attributes['prerequisites']]
      #                     attributes['prereq_modified_date']
      #self.summary = attributes['summary']
      self.flags = [Flag.from_id(flag['flagid']) for flag in attributes['flags']]
645333
def _AskUser(self):
    
    if self._show_percent:
      progress = int(self._displayed*100 / (len(self._text.splitlines())))
      progress_text = ' (%d%%)' % progress
    else:
      progress_text = ''
    question = AnsiText(
        'Enter: next line, Space: next page, '
        'b: prev page, q: quit.%s' %
        progress_text, ['green'])
    sys.stdout.write(question)
    sys.stdout.flush()
    ch = self._GetCh()
    sys.stdout.write('\r%s\r' % (' '*len(question)))
    sys.stdout.flush()
    return ch
492689
private void completeCall(ClientResponseImpl response) {
        // if we're keeping track, calculate result size
        if (m_perCallStats.samplingProcedure()) {
            m_perCallStats.setResultSize(response.getResults());
        }
        m_statsCollector.endProcedure(response.getStatus() == ClientResponse.USER_ABORT,
                                      (response.getStatus() != ClientResponse.USER_ABORT) &&
                                      (response.getStatus() != ClientResponse.SUCCESS),
                                      m_perCallStats);
        // allow the GC to collect per-call stats if this proc isn't called for a while
        m_perCallStats = null;

        // send the response to the caller
        // must be done as IRM to CI mailbox for backpressure accounting
        response.setClientHandle(m_clientHandle);
        InitiateResponseMessage irm = InitiateResponseMessage.messageForNTProcResponse(m_ciHandle,
                                                                                       m_ccxn.connectionId(),
                                                                                       response);
        m_mailbox.deliver(irm);

        m_ntProcService.handleNTProcEnd(ProcedureRunnerNT.this);
    }
1124804
function () {
      var done = this.async();
      var questions = [];

      // Project name
      if (typeof this.preset.name === 'undefined' || this.preset.name === '') {
        questions.push({
          type: 'input',
          name: 'name',
          message: 'Project Name',
          default: this.settings.name || _s.titleize(this.appname)
        });
      }

      // Feature options
      options.forEach(function (option) {
        var question;
        var name = option.name;
        var type = option.type;
        if (typeof this.preset[name] === 'undefined') {
          switch (type) {
            case 'list':
              question = _.pick(option, 'name', 'message', 'type');
              question.choices = _.map(option.choices, function (choice) {
                var data = _.pick(choice, 'name', 'value', 'disabled');
                return data;
              }.bind(this));
              question.default = this.settings[name];
              break;
            case 'checkbox':
              question = _.pick(option, 'name', 'message', 'type', 'validate');
              question.choices = _.map(option.choices, function (choice) {
                var data = _.pick(choice, 'name', 'value', 'disabled');
                data.checked = _.includes(this.settings[name], data.value);
                return data;
              }.bind(this));
              break;
          }
          questions.push(question);
        }
      }.bind(this));

      // Save config or not
      if (this.configType === 'custom') {
        questions.push({
          type: 'confirm',
          name: 'store',
          message: 'Do you want to save this config to .yo-rc.json?',
          default: false
        });
      }

      this.prompt(questions, function (answers) {
        // Finalize generator settings
        this.settings.name = typeof answers.name !== 'undefined' ? answers.name : this.preset.name;
        this.store = answers.store || false;
        options.forEach(function (option) {
          var name = option.name;
          this.settings[name] = answers[name] || this.preset[name];
        }.bind(this));

        done();
      }.bind(this));
    }
905352
def add_question(self, qname, rdtype, rdclass=dns.rdataclass.IN):
        

        self._set_section(QUESTION)
        before = self.output.tell()
        qname.to_wire(self.output, self.compress, self.origin)
        self.output.write(struct.pack("!HH", rdtype, rdclass))
        after = self.output.tell()
        if after >= self.max_size:
            self._rollback(before)
            raise dns.exception.TooBig
        self.counts[QUESTION] += 1
1276086
function() {

            // Log results.
            if (responseStatus.failed > 0) {
                warnUnlessForced(responseStatus.failed + '/' + responseStatus.total +
                        ' pages failed (' + responseStatus.duration.toFixed(2) + 'sec)', force);
            } else if (responseStatus.total === 0) {
                warnUnlessForced('0/0 pages tested (' + responseStatus.duration.toFixed(2) + 'sec)', force);
            } else {
                grunt.verbose.writeln("--");
                grunt.log.ok(responseStatus.total + ' pages passed (' + responseStatus.duration.toFixed(2) + 'sec)', force);
            }

            // All done!
            done();
        }
507950
public function execute() {
        global $CFG;
        require_once($CFG->dirroot . '/question/engine/lib.php');

        // We delete previews that have not been touched for 24 hours.
        $lastmodifiedcutoff = time() - DAYSECS;

        mtrace("\n  Cleaning up old question previews...", '');
        $oldpreviews = new \qubaid_join('{question_usages} quba', 'quba.id',
            'quba.component = :qubacomponent
                    AND NOT EXISTS (
                        SELECT 1
                          FROM {question_attempts}      subq_qa
                          JOIN {question_attempt_steps} subq_qas ON subq_qas.questionattemptid = subq_qa.id
                          JOIN {question_usages}        subq_qu  ON subq_qu.id = subq_qa.questionusageid
                         WHERE subq_qa.questionusageid = quba.id
                           AND subq_qu.component = :qubacomponent2
                           AND (subq_qa.timemodified > :qamodifiedcutoff
                                    OR subq_qas.timecreated > :stepcreatedcutoff)
                    )
            ',
            ['qubacomponent' => 'core_question_preview', 'qubacomponent2' => 'core_question_preview',
                'qamodifiedcutoff' => $lastmodifiedcutoff, 'stepcreatedcutoff' => $lastmodifiedcutoff]);

        \question_engine::delete_questions_usage_by_activities($oldpreviews);
        mtrace('done.');
    }