def __init__(self, task, problemid, content, translations=None):
        Problem.__init__(self, task, problemid, content, translations)
        self._boxes = []
        self._box_types = {"input-text": InputBox, "input-decimal": InputBox, "input-integer": InputBox,
                           "multiline": MultilineBox, "text": TextBox, "file": FileBox}
        if task.get_environment() is None:
            raise Exception("Environment undefined, but there is a problem with type=code or type=code-single-line")

        self._init_boxes(content)
Esempio n. 2
0
 def __init__(self, problemid, content, translations, taskfs):
     self._problemid = problemid
     self._trace = load_trace(taskfs, content.get('trace', ''), content.get('exclude', None))
     self._hidden_fields = content.get('hide', {})  # The fields to be hidden
     self._redacted_fields = content.get('redact', {})
     self._field_feedback = content.get('feedback', {})
     self._header = content.get('header', '')
     self._shuffle = content.get('shuffle', False)
     self._shuffle_feedback = (content.get('shuffle-feedback') or '').strip() or 'The order of packets is incorrect'
     Problem.__init__(self, problemid, content, translations, taskfs)
 def __init__(self, problemid, content, translations, taskfs):
     Problem.__init__(self, problemid, content, translations, taskfs)
     self._header = content['header'] if "header" in content else ""
     self._answers = list(content.get("answers", [])) or (
         [content.get("answer", "")] if content.get("answer", "") else []
     )  # retrocompat
     self._tolerance = content.get("tolerance", None)
     self._hints = content.get("hints", None)
     self._error_message = content.get("error_message", None)
     self._success_message = content.get("success_message", None)
     self._choices = content.get("choices", [])
 def __init__(self, problemid, content, translations, taskfs):
     Problem.__init__(self, problemid, content, translations, taskfs)
     self._boxes = []
     self._box_types = {
         "input-text": DisplayableInputBox,
         "input-decimal": DisplayableInputBox,
         "input-integer": DisplayableInputBox,
         "multiline": DisplayableMultilineBox,
         "text": DisplayableTextBox,
         "file": DisplayableFileBox
     }
     self._init_boxes(content)
 def __init__(self, problemid, content, translations, taskfs):
     Problem.__init__(self, problemid, content, translations, taskfs)
     self._header = content['header'] if "header" in content else ""
     self._answers = list(content.get("answers", [])) or (
         [content.get("answer", "")] if content.get("answer", "") else []
     )  # retrocompat
     self._tolerance = content.get("tolerance", None)
     self._hints = content.get("hints", None)
     self._error_message = content.get("error_message", None)
     self._success_message = content.get("success_message", None)
     self._choices = content.get("choices", [])
     self._comparison_type = content.get("comparison_type", "symbolic")
     self._use_log = content.get("use_log", False)
     self._use_trigo = content.get("use_trigo", False)
     self._use_complex = content.get("use_complex", False)
     self._error_message_visibility = content.get("error_msg_visibility",
                                                  "always")
     self._error_msg_attempts = content.get("error_msg_attempts", 0)
     self._error_msg_visibility_start = content.get(
         "error_msg_visibility_start", "2000-01-01 00:00:00")
Esempio n. 6
0
 def __init__(self, task, problemid, content, translations=None):
     Problem.__init__(self, task, problemid, content, translations)
     self._answer = str(content.get("answer", ""))
 def __init__(self, problemid, content, translations, taskfs):
     Problem.__init__(self, problemid, content, translations, taskfs)
     self._header = content['header'] if "header" in content else ""
     self._answer = str(content.get("answer", ""))
Esempio n. 8
0
 def __init__(self, task, problemid, content, translations=None):
     Problem.__init__(self, task, problemid, content, translations)
     self._circuit = str(content.get("circuit", ""))
     self._input_cycle = str(content.get("input_cycle", ""))
     self._input_direct = str(content.get("input_direct", ""))
     self._input_reverse = str(content.get("input_reverse", ""))