MCPcopy Index your code
hub / github.com/datacamp/pythonwhat / __init__

Method __init__

pythonwhat/State.py:59–108  ·  view source on GitHub ↗
(
        self,
        student_code,
        solution_code,
        pre_exercise_code,
        student_process,
        solution_process,
        raw_student_output,
        # solution output
        reporter,
        force_diagnose=False,
        highlight=None,
        highlight_offset=None,
        highlighting_disabled=None,
        feedback_context=None,
        creator=None,
        student_ast=None,
        solution_ast=None,
        student_ast_tokens=None,
        solution_ast_tokens=None,
        student_parts=None,
        solution_parts=None,
        student_context=Context(),
        solution_context=Context(),
        student_env=Context(),
        solution_env=Context(),
    )

Source from the content-addressed store, hash-verified

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)
102
103 if highlight is None: # todo: check parent_state? (move check to reporting?)
104 self.highlight = self.student_ast
105
106 self.converters = get_manual_converters() # accessed only from root state
107
108 self.manual_sigs = None
109
110 def get_manual_sigs(self):
111 if self.manual_sigs is None:

Callers

nothing calls this directly

Calls 5

get_dispatcherMethod · 0.95
parseMethod · 0.95
get_manual_convertersFunction · 0.90
ContextClass · 0.85
copyMethod · 0.80

Tested by

no test coverage detected