override this so only right answers are returned
        :return:
358491
def get_answers(self):
        
        all_answers = self.my_osid_object._my_map['answers']
        right_answers = [a for a in all_answers
                         if a['genusTypeId'] != str(WRONG_ANSWER_GENUS_TYPE)]
        return AnswerList(right_answers,
                          runtime=self.my_osid_object._runtime,
                          proxy=self.my_osid_object._proxy)
654406
def ask_str(question: str, default: str = None):
    """"""
    default_q = " [default: {0}]: ".format(
        default) if default is not None else ""
    answer = input("{0} [{1}]: ".format(question, default_q))

    if answer == "":
        return default
    return answer
1220984
def ask_questions(self):
        
        out_config = {}

        for key in c.CONFIG_QUESTIONS:
            section = key[1]
            print
            for question in section:
                answer = utils.ask(question[1], question[2])
                out_config["{0}_{1}".format(key[0], question[0])] = answer

        for key in c.CONFIG_MULTIPLE_CHOICE_QUESTIONS:
            section = key[1]
            print
            # keep going until we get what we want
            while True:
                input = utils.ask(section[1], "")
                if (input.isdigit() and
                        int(input) > 0 and
                        int(input) <= section[0]):
                    answer = input

                    break
                print

            # store the answer as 1 less than it is, we're dealing with
            # a list to select the number which is 0 indexed
            answer = int(input) - 1

            if key[0] == "license":
                out_config["license_type"] = c.LICENSE_TYPES[answer][0]
                out_config["license_url"] = c.LICENSE_TYPES[answer][1]

        # merge in defaults without asking questions
        merged_config = dict(c.CONFIG_DEFAULTS.items() + out_config.items())

        return merged_config
896895
def _deliverAnswer(self, answer):
        
        router = self.siteRouter
        if answer.deliveryDeferred is None:
            d = answer.deliveryDeferred = router.routeAnswer(
                answer.originalSender, answer.originalTarget, answer.value,
                answer.messageID)
            def destroyAnswer(result):
                answer.deleteFromStore()
            def transportErrorCheck(f):
                answer.deliveryDeferred = None
                f.trap(MessageTransportError)
            d.addCallbacks(destroyAnswer, transportErrorCheck)
            d.addErrback(log.err)
797008
def validate_answer(self, value):
        
        # Check that the answer is JSON-serializable
        try:
            serialized = json.dumps(value)
        except (ValueError, TypeError):
            raise serializers.ValidationError("Answer value must be JSON-serializable")

        # Check the length of the serialized representation
        if len(serialized) > Submission.MAXSIZE:
            raise serializers.ValidationError("Maximum answer size exceeded.")

        return value
1059195
def limit(self, value):
        
        self._query = self._query.limit(value)

        return self
354977
public function find_right_answer($wrappedquestion) {
        // We only take into account *one* (the first) correct answer.
        while ($answer = array_shift($wrappedquestion->answers)) {
            if (!question_state::graded_state_for_fraction(
                    $answer->fraction)->is_incorrect()) {
                // Store this answer as a choice, only if this is a new one.
                $key = array_search($answer->answer, $this->choices);
                if ($key === false) {
                    $key = $answer->id;
                    $this->choices[$key] = $answer->answer;
                }
                return $key;
            }
        }
        // We should never get there.
        throw new coding_exception('shortanswerquestionwithoutrightanswer', $wrappedquestion->id);

    }
1277620
def answer(self):
        
        if isinstance(self.validator, list):
            return self.validator[0].choice()
        return self.validator.choice()
409020
def handle_cannot(reference_answers: List[str]):
    
    num_cannot = 0
    num_spans = 0
    for ref in reference_answers:
        if ref == 'CANNOTANSWER':
            num_cannot += 1
        else:
            num_spans += 1
    if num_cannot >= num_spans:
        reference_answers = ['CANNOTANSWER']
    else:
        reference_answers = [x for x in reference_answers if x != 'CANNOTANSWER']
    return reference_answers
1169970
def where(self, params):
        
        self.params = dict(self.params, **params)   # params overrides self.params
        return self
713957
def handle_answer(answer)
      return nil  if answer.nil?
      answer = convert(answer)
      field = opts[:field]
      if field
        answer = answer[field]
      end
      answer
    end
1240101
def _choose(self):
        
        answer = "all"

        if not self.force:
            for i, value in enumerate(self.current_values):
                self.out("{:>2d}. {}".format(i + 1, value))

            answer = self.prompt(
                'Which value to remove? Enter number or "all": ')

        if answer != "all":
            try:
                answer = int(answer) - 1

                if answer < 0 or answer >= len(self.current_values):
                    answer = None
            except ValueError:
                answer = None

        return answer
76241
def atleast(cls, lits, weights=None, bound=1, top_id=None,
            encoding=EncType.best):
        

        return cls.geq(lits, weights, bound, top_id, encoding)
712041
def ask_list(question: str, default: list = None) -> list:
    """"""
    default_q = " [default: {0}]: ".format(
        ",".join(default)) if default is not None else ""
    answer = input("{0} [{1}]: ".format(question, default_q))

    if answer == "":
        return default
    return [ans.strip() for ans in answer.split(",")]
1203304
def is_answer_valid(self, ans):
        """"""
        return ans in [str(i+1) for i in range(len(self.choices))]
1165745
def answers(self, other):
        """"""
        if other.__class__ == self.__class__:
            return (other.service + 0x40) == self.service or \
                   (self.service == 0x7f and
                    (self.requestServiceId == other.service))
        return 0
1328801
def _is_match(self, response, answer):
        """"""
        # TODO: this varies depending on question type
        if self._only_generic_right_feedback():
            return str(answer.genus_type) == str(RIGHT_ANSWER_GENUS)
        elif self._is_multiple_choice():
            return MultiChoiceItemRecord._is_match(self, response, answer)
        elif self._is_image_sequence() or self._is_mw_sentence():
            return OrderedChoiceItemRecord._is_match(self, response, answer)
        elif self._is_numeric_response():
            return CalculationInteractionItemRecord._is_match(self, response, answer)
        elif self._is_fitb():
            return MagicRandomizedInlineChoiceItemRecord._is_match(self, response, answer)
        return False