当前位置: 首页>>代码示例>>Python>>正文


Python CorrectMap.get_property方法代码示例

本文整理汇总了Python中capa.correctmap.CorrectMap.get_property方法的典型用法代码示例。如果您正苦于以下问题:Python CorrectMap.get_property方法的具体用法?Python CorrectMap.get_property怎么用?Python CorrectMap.get_property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在capa.correctmap.CorrectMap的用法示例。


在下文中一共展示了CorrectMap.get_property方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: LoncapaProblem

# 需要导入模块: from capa.correctmap import CorrectMap [as 别名]
# 或者: from capa.correctmap.CorrectMap import get_property [as 别名]

#.........这里部分代码省略.........

        if problemtree.tag in html_problem_semantics:
            return

        problemid = problemtree.get('id')    # my ID

        if problemtree.tag in inputtypes.registry.registered_tags():
            # If this is an inputtype subtree, let it render itself.
            response_data = self.problem_data[problemid]

            status = 'unsubmitted'
            msg = ''
            hint = ''
            hintmode = None
            input_id = problemtree.get('id')
            answervariable = None
            if problemid in self.correct_map:
                pid = input_id

                # If we're withholding correctness, don't show adaptive hints either.
                # Note that regular, "demand" hints will be shown, if the course author has added them to the problem.
                if not self.capa_module.correctness_available():
                    status = 'submitted'
                else:
                    # If the the problem has not been saved since the last submit set the status to the
                    # current correctness value and set the message as expected. Otherwise we do not want to
                    # display correctness because the answer may have changed since the problem was graded.
                    if not self.has_saved_answers:
                        status = self.correct_map.get_correctness(pid)
                        msg = self.correct_map.get_msg(pid)

                    hint = self.correct_map.get_hint(pid)
                    hintmode = self.correct_map.get_hintmode(pid)
                    answervariable = self.correct_map.get_property(pid, 'answervariable')

            value = ''
            if self.student_answers and problemid in self.student_answers:
                value = self.student_answers[problemid]

            if input_id not in self.input_state:
                self.input_state[input_id] = {}

            # do the rendering
            state = {
                'value': value,
                'status': status,
                'id': input_id,
                'input_state': self.input_state[input_id],
                'answervariable': answervariable,
                'response_data': response_data,
                'has_saved_answers': self.has_saved_answers,
                'feedback': {
                    'message': msg,
                    'hint': hint,
                    'hintmode': hintmode,
                }
            }

            input_type_cls = inputtypes.registry.get_class_for_tag(problemtree.tag)
            # save the input type so that we can make ajax calls on it if we need to
            self.inputs[input_id] = input_type_cls(self.capa_system, problemtree, state)
            return self.inputs[input_id].get_html()

        # let each Response render itself
        if problemtree in self.responders:
            overall_msg = self.correct_map.get_overall_message()
开发者ID:cpennington,项目名称:edx-platform,代码行数:70,代码来源:capa_problem.py

示例2: LoncapaProblem

# 需要导入模块: from capa.correctmap import CorrectMap [as 别名]
# 或者: from capa.correctmap.CorrectMap import get_property [as 别名]

#.........这里部分代码省略.........
        """
        if not isinstance(problemtree.tag, basestring):
            # Comment and ProcessingInstruction nodes are not Elements,
            # and we're ok leaving those behind.
            # BTW: etree gives us no good way to distinguish these things
            # other than to examine .tag to see if it's a string. :(
            return

        if problemtree.tag == "script" and problemtree.get("type") and "javascript" in problemtree.get("type"):
            # leave javascript intact.
            return deepcopy(problemtree)

        if problemtree.tag in html_problem_semantics:
            return

        problemid = problemtree.get("id")  # my ID

        if problemtree.tag in inputtypes.registry.registered_tags():
            # If this is an inputtype subtree, let it render itself.
            response_data = self.problem_data[problemid]

            status = "unsubmitted"
            msg = ""
            hint = ""
            hintmode = None
            input_id = problemtree.get("id")
            answervariable = None
            if problemid in self.correct_map:
                pid = input_id
                status = self.correct_map.get_correctness(pid)
                msg = self.correct_map.get_msg(pid)
                hint = self.correct_map.get_hint(pid)
                hintmode = self.correct_map.get_hintmode(pid)
                answervariable = self.correct_map.get_property(pid, "answervariable")

            value = ""
            if self.student_answers and problemid in self.student_answers:
                value = self.student_answers[problemid]

            if input_id not in self.input_state:
                self.input_state[input_id] = {}

            # do the rendering
            state = {
                "value": value,
                "status": status,
                "id": input_id,
                "input_state": self.input_state[input_id],
                "answervariable": answervariable,
                "response_data": response_data,
                "feedback": {"message": msg, "hint": hint, "hintmode": hintmode},
            }

            input_type_cls = inputtypes.registry.get_class_for_tag(problemtree.tag)
            # save the input type so that we can make ajax calls on it if we need to
            self.inputs[input_id] = input_type_cls(self.capa_system, problemtree, state)
            return self.inputs[input_id].get_html()

        # let each Response render itself
        if problemtree in self.responders:
            overall_msg = self.correct_map.get_overall_message()
            return self.responders[problemtree].render_html(self._extract_html, response_msg=overall_msg)

        # let each custom renderer render itself:
        if problemtree.tag in customrender.registry.registered_tags():
            renderer_class = customrender.registry.get_class_for_tag(problemtree.tag)
开发者ID:hastexo,项目名称:edx-platform,代码行数:70,代码来源:capa_problem.py

示例3: LoncapaProblem

# 需要导入模块: from capa.correctmap import CorrectMap [as 别名]
# 或者: from capa.correctmap.CorrectMap import get_property [as 别名]

#.........这里部分代码省略.........
        Used by get_html.
        """
        if not isinstance(problemtree.tag, basestring):
            # Comment and ProcessingInstruction nodes are not Elements,
            # and we're ok leaving those behind.
            # BTW: etree gives us no good way to distinguish these things
            # other than to examine .tag to see if it's a string. :(
            return

        if (problemtree.tag == 'script' and problemtree.get('type')
                and 'javascript' in problemtree.get('type')):
            # leave javascript intact.
            return deepcopy(problemtree)

        if problemtree.tag in html_problem_semantics:
            return

        problemid = problemtree.get('id')    # my ID

        if problemtree.tag in inputtypes.registry.registered_tags():
            # If this is an inputtype subtree, let it render itself.
            status = "unsubmitted"
            msg = ''
            hint = ''
            hintmode = None
            input_id = problemtree.get('id')
            answervariable = None
            if problemid in self.correct_map:
                pid = input_id
                status = self.correct_map.get_correctness(pid)
                msg = self.correct_map.get_msg(pid)
                hint = self.correct_map.get_hint(pid)
                hintmode = self.correct_map.get_hintmode(pid)
                answervariable = self.correct_map.get_property(pid, 'answervariable')

            value = ""
            if self.student_answers and problemid in self.student_answers:
                value = self.student_answers[problemid]

            if input_id not in self.input_state:
                self.input_state[input_id] = {}

            # do the rendering
            state = {
                'value': value,
                'status': status,
                'id': input_id,
                'input_state': self.input_state[input_id],
                'answervariable': answervariable,
                'feedback': {
                    'message': msg,
                    'hint': hint,
                    'hintmode': hintmode,
                }
            }

            input_type_cls = inputtypes.registry.get_class_for_tag(problemtree.tag)
            # save the input type so that we can make ajax calls on it if we need to
            self.inputs[input_id] = input_type_cls(self.capa_system, problemtree, state)
            return self.inputs[input_id].get_html()

        # let each Response render itself
        if problemtree in self.responders:
            overall_msg = self.correct_map.get_overall_message()
            return self.responders[problemtree].render_html(
                self._extract_html, response_msg=overall_msg
开发者ID:Cgruppo,项目名称:edx-platform,代码行数:70,代码来源:capa_problem.py


注:本文中的capa.correctmap.CorrectMap.get_property方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。