State of the SCT environment. This class holds all information relevevant to test the correctness of an exercise. It is coded suboptimally and it will be refactored soon, and documented thouroughly after that. kwargs: ... - reporter
| 42 | |
| 43 | @parameters_attr |
| 44 | class State(ProtoState): |
| 45 | """State of the SCT environment. |
| 46 | |
| 47 | This class holds all information relevevant to test the correctness of an exercise. |
| 48 | It is coded suboptimally and it will be refactored soon, and documented thouroughly |
| 49 | after that. |
| 50 | |
| 51 | kwargs: |
| 52 | ... |
| 53 | - reporter |
| 54 | |
| 55 | """ |
| 56 | |
| 57 | feedback_cls = Feedback |
| 58 | |
| 59 | def __init__( |
| 60 | self, |
| 61 | student_code, |
| 62 | solution_code, |
| 63 | pre_exercise_code, |
| 64 | student_process, |
| 65 | solution_process, |
| 66 | raw_student_output, |
| 67 | # solution output |
| 68 | reporter, |
| 69 | force_diagnose=False, |
| 70 | highlight=None, |
| 71 | highlight_offset=None, |
| 72 | highlighting_disabled=None, |
| 73 | feedback_context=None, |
| 74 | creator=None, |
| 75 | student_ast=None, |
| 76 | solution_ast=None, |
| 77 | student_ast_tokens=None, |
| 78 | solution_ast_tokens=None, |
| 79 | student_parts=None, |
| 80 | solution_parts=None, |
| 81 | student_context=Context(), |
| 82 | solution_context=Context(), |
| 83 | student_env=Context(), |
| 84 | solution_env=Context(), |
| 85 | ): |
| 86 | args = locals().copy() |
| 87 | self.debug = False |
| 88 | |
| 89 | for k, v in args.items(): |
| 90 | if k != "self": |
| 91 | setattr(self, k, v) |
| 92 | |
| 93 | self.ast_dispatcher = self.get_dispatcher() |
| 94 | |
| 95 | # Parse solution and student code |
| 96 | # if possible, not done yet and wanted (ast arguments not False) |
| 97 | if isinstance(self.student_code, str) and student_ast is None: |
| 98 | self.student_ast = self.parse(student_code) |
| 99 | if isinstance(self.solution_code, str) and solution_ast is None: |
| 100 | with debugger(self): |
| 101 | self.solution_ast = self.parse(solution_code) |
no outgoing calls