Return true if the answer should be store in
the global store, otherwise false.

@param  {Object}       question Inquirer prompt item
@param  {String|Array} answer   The inquirer answer
@return {Boolean}               Answer to be stored
@private
346079
function (question, answer) {
  var choiceValues = _.map(question.choices, 'value');
  var choiceIndex = choiceValues.indexOf(answer);

  // Check if answer is not equal to default value
  if (question.default !== choiceIndex) {
    return true;
  }

  return false;
}
1214974
public function correctAnswer(AbstractItem $question, $answer = [])
    {
        $corrected = new CorrectedAnswer();

        foreach ($question->getChoices() as $choice) {
            if (!empty($answer) && $choice->getUuid() === $answer) {
                // Choice has been selected by the user
                if (0 < $choice->getScore()) {
                    $corrected->addExpected($choice);
                } else {
                    $corrected->addUnexpected($choice);
                }
            } elseif (0 < $choice->getScore()) {
                // The choice is not selected but it's part of the correct answer
                $corrected->addMissing($choice);
            }
        }

        return $corrected;
    }
181578
def ask(question, no_input=False):
    """"""
    if no_input:
        return True
    else:
        input_ = input('%s [Y/n] ' % question)
        input_ = input_.strip().lower()
        if input_ in ('y', 'yes', ''):
            return True
        if input_ in ('n', 'no'):
            return False
        print('Invalid selection')
1087675
def get_yes_no(self, question):
        
        user_answer = self.get_answer(question).lower()
        if user_answer in self.yes_input:
            return True

        if user_answer in self.no_input:
            return False

        is_yes = self.is_yes(user_answer)  # check if similar to yes/no choices
        is_no = self.is_no(user_answer)
        if is_yes and not is_no:
            return True

        if is_no and not is_yes:
            return False

        if self.interactive:
            self.show_help()
            return self.get_yes_no(self.last_question)

        return False
85639
function (reqOptions) {
        var _a = exports.config.transformRequest(reqOptions), url = _a.url, options = _a.options, data = _a.data, _b = _a.method, method = _b === void 0 ? 'GET' : _b, store = _a.store;
        return exports.config.baseFetch(method, url, data, options && options.headers)
            .then(function (response) {
            var storeResponse = utils_1.assign(response, { store: store });
            return new Response_1.Response(exports.config.transformResponse(storeResponse), store, options);
        });
    }
1193686
function Question(name, message, options) {
  if (utils.isObject(name)) {
    options = utils.merge({}, message, name);
    message = options.message;
    name = options.name;
  }

  if (utils.isObject(message)) {
    options = utils.merge({}, options, message);
    message = options.message;
  }

  utils.define(this, 'isQuestion', true);
  utils.define(this, 'cache', {});

  this.options = options || {};
  this.type = this.options.type || 'input';
  this.message = message || this.options.message;
  this.name = name || this.options.name;

  if (!this.message) {
    this.message = this.name;
  }

  utils.merge(this, this.options);
  createNext(this);
}
1155319
function(){
		console.log("Unknown Response");

		if (_pathConfirmationCounter < 3){
			console.log("Please enter a 'Y' or an 'N' when answering.\n");
			_pathConfirmationCounter++;
			confirmDestination();
		} else {
			console.log("Unable to install at this time due to too many unknown responses.\n");
			_prompt.close();
		}
	}
724256
function format(answers) {
  // parentheses are only needed when a scope is present
  const scope = answers.scope ? '(' + answers.scope.trim() + ') ' : ''

  // build head line and limit it to 100
  const head = truncate(answers.type + ' ' + scope + answers.subject.trim(), 100)

  // wrap body at 100
  const body = wrap(answers.body, 100)

  const footer = (answers.issues.match(/#\d+/g) || [])
    .map(issue => `Closes ${issue}`)
    .join('\n')

  return [head, body, footer]
    .join('\n\n')
    .trim()
}
740579
private function getCorrectAnswerForFixMode(AbstractItem $question, $answer)
    {
        $corrected = new CorrectedAnswer();

        if (!is_null($answer)) {
            foreach ($answer as $gridAnswer) {
                $cell = $question->getCell($gridAnswer['cellId']);
                $choice = $cell->getChoice($gridAnswer['text']);

                if (!empty($choice)) {
                    if ($choice->isExpected()) {
                        $corrected->addExpected($choice);
                    } else {
                        $corrected->addUnexpected($choice);
                    }
                } else {
                    // Retrieve the best answer for the cell
                    $corrected->addMissing($this->findCellExpectedAnswer($cell));
                }
            }
        } else {
            $cells = $question->getCells();

            foreach ($cells as $cell) {
                if (0 < count($cell->getChoices())) {
                    $corrected->addMissing($this->findCellExpectedAnswer($cell));
                }
            }
        }

        return $corrected;
    }
841429
def marked?(question, choice)
      return if not_registered
      marked_choices[question].find {|x| x==choice} ? true : false
    end
1117511
public function correctAnswer(AbstractItem $question, $answer = [])
    {
        $corrected = new CorrectedAnswer();

        foreach ($question->getChoices() as $choice) {
            if (is_array($answer) && in_array($choice->getUuid(), $answer)) {
                // Choice has been selected by the user
                if (0 < $choice->getScore()) {
                    $corrected->addExpected($choice);
                } else {
                    $corrected->addUnexpected($choice);
                }
            } elseif (0 < $choice->getScore()) {
                // The choice is not selected but it's part of the correct answer
                $corrected->addMissing($choice);
            } else {
                // The choice is not selected as expected in correct answer
                $corrected->addExpectedMissing($choice);
            }
        }

        return $corrected;
    }
165700
def addAnswers(self, answers, callback=None, errback=None, **kwargs):
        
        if not self.data:
            raise RecordException('record not loaded')
        orig_answers = self.data['answers']
        new_answers = self._rest._getAnswersForBody(answers)
        orig_answers.extend(new_answers)
        return self.update(answers=orig_answers, callback=callback,
                           errback=errback, **kwargs)
1352976
public function correctAnswer(AbstractItem $question, $answer = [])
    {
        $corrected = new CorrectedAnswer();

        if (is_array($answer)) {
            foreach ($answer as $givenAnswer) {
                $item = $question->getItem($givenAnswer['itemId']);
                if (!empty($item->getPosition()) && $item->getPosition() === $givenAnswer['position']) {
                    $corrected->addExpected($item);
                } else {
                    $penalty = new GenericPenalty($question->getPenalty());
                    $corrected->addPenalty($penalty);
                }
            }
        }

        return $corrected;
    }
1235693
def is_correct(self, question_id):
        """"""
        response = self.get_response(question_id=question_id)
        if response.is_answered():
            item = self._get_item(response.get_item_id())
            return item.is_response_correct(response)
        raise errors.IllegalState()
174332
def is_question_valid(self):
        
        if self.question_upload_type == STRING:
            return self.question_answer_string and True
        else:
            return self.question_upload_file and self.question_checker_script
1280677
def query_input(question, default=None, color=default_color):
    
    if default is None or default == '':
        prompt = ' '
    elif type(default) == str:
        prompt = flo(' [{default}] ')
    else:
        raise ValueError("invalid default answer: '%s'" % default)

    while True:
        sys.stdout.write(color(question + prompt))
        choice = raw_input()
        if default is not None and choice == '':
            return default
        if choice != '':
            return choice
913505
public function validateAnswer($answer, AbstractItem $question, array $options = [])
    {
        $options[Validation::QUESTION] = $question;

        return $this->getAnswerValidator()->validate($answer, $options);
    }