def prep_context(): cntxt = {'success_msg': success_msg} from pythonwhat.check_syntax import v2_check_functions from pythonwhat.probe import build_probe_context imports = [ "from inspect import Parameter as param", "from pythonwhat.signatures import sig_from_params, sig_from_obj", "from pythonwhat.State import set_converter", "from pythonwhat.check_syntax import F, Ex" ] [exec(line, None, cntxt) for line in imports] # only if PYTHONWHAT_V2_ONLY is not set, support v1 if include_v1(): tree, probe_cntxt = build_probe_context() cntxt.update(probe_cntxt) else: tree = None cntxt.update(v2_check_functions) return tree, cntxt
def prep_context(): cntxt = {"success_msg": success_msg} from pythonwhat.sct_syntax import v2_check_functions from pythonwhat.probe import build_probe_context imports = [ "from inspect import Parameter as param", "from pythonwhat.signatures import sig_from_params, sig_from_obj", "from pythonwhat.State import set_converter", "from pythonwhat.sct_syntax import F, Ex" ] [exec(line, None, cntxt) for line in imports] # only if PYTHONWHAT_V2_ONLY is not set, support v1 if include_v1(): tree, probe_cntxt = build_probe_context() cntxt.update(probe_cntxt) else: tree = None cntxt.update(v2_check_functions) # TODO: ChainStart instances cause errors when dill tries to pass manual converter functions # cntxt.update(get_chains()) return tree, cntxt