pythonwhat/checks/check_funcs.py
def check_part(state, name, part_msg, missing_msg=None, expand_msg=None):
    """Return child state with name part as its ast tree"""

    if missing_msg is None:
        missing_msg = "Are you sure you defined the {{part}}? "
    if expand_msg is None:
        expand_msg = "Did you correctly specify the {{part}}? "

    if not part_msg:
        part_msg = name
    append_message = {"msg": expand_msg, "kwargs": {"part": part_msg}}

    has_part(state, name, missing_msg, append_message["kwargs"])

    stu_part = state.student_parts[name]
    sol_part = state.solution_parts[name]

    assert_ast(state, sol_part, append_message["kwargs"])

    return part_to_child(stu_part, sol_part, append_message, state)
def check_part(state, name, part_msg, missing_msg=None, expand_msg=None):
    if missing_msg is None:
        missing_msg = "Are you sure you defined the {{part}}? "
    if expand_msg is None:
        expand_msg = "Did you correctly specify the {{part}}? "

    if not part_msg:
        part_msg = name
    append_message = {"msg": expand_msg, "kwargs": {"part": part_msg}}

    has_part(state, name, missing_msg, append_message["kwargs"])

    stu_part = state.student_parts[name]
    sol_part = state.solution_parts[name]

    assert_ast(state, sol_part, append_message["kwargs"])

    return part_to_child(stu_part, sol_part, append_message, state)
def check_part ( state , name , part_msg , missing_msg = None , expand_msg = None ) : if missing_msg is None : missing_msg = "Are you sure you defined the {{part}}? " if expand_msg is None : expand_msg = "Did you correctly specify the {{part}}? " if not part_msg : part_msg = name append_message = { "msg" : expand_msg , "kwargs" : { "part" : part_msg } } has_part ( state , name , missing_msg , append_message [ "kwargs" ] ) stu_part = state . student_parts [ name ] sol_part = state . solution_parts [ name ] assert_ast ( state , sol_part , append_message [ "kwargs" ] ) return part_to_child ( stu_part , sol_part , append_message , state )
Return child state with name part as its ast tree
Return child state with name part as its ast tree