MCPcopy Create free account
hub / github.com/datacamp/pythonwhat / prep_context

Function prep_context

pythonwhat/test_exercise.py:88–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86
87
88def prep_context():
89 cntxt = {"success_msg": success_msg}
90 from pythonwhat.sct_syntax import v2_check_functions
91 from pythonwhat.probe import build_probe_context
92
93 imports = [
94 "from inspect import Parameter as param",
95 "from pythonwhat.signatures import sig_from_params, sig_from_obj",
96 "from pythonwhat.State import set_converter",
97 "from pythonwhat.sct_syntax import F, Ex"
98 ]
99 [exec(line, None, cntxt) for line in imports]
100
101 # only if PYTHONWHAT_V2_ONLY is not set, support v1
102 if include_v1():
103 tree, probe_cntxt = build_probe_context()
104 cntxt.update(probe_cntxt)
105 else:
106 tree = None
107
108 cntxt.update(v2_check_functions)
109 # TODO: ChainStart instances cause errors when dill tries to pass manual converter functions
110 # cntxt.update(get_chains())
111 return tree, cntxt
112
113
114def setup_state(stu_code="", sol_code="", pec="", **kwargs):

Callers 1

test_exerciseFunction · 0.85

Calls 3

include_v1Function · 0.90
build_probe_contextFunction · 0.90
updateMethod · 0.80

Tested by

no test coverage detected