Beispiel #1
0
def check_author_name_on_header():
    code = get_program()
    m_author = re.search('Author: \\w+', code)
    if not m_author:
        gently(
            "You need to add your name to the author field at the top of the file."
            "<br><br><i>(name_missing)<i></br></br>")
Beispiel #2
0
def check_output_on_header(expected_output):
    code = get_program()
    expected_output = str(expected_output)
    between_stars = code.split("*****")[2].strip()
    between_stars = "\\n".join([x.strip() for x in between_stars.split("\\n")])
    if 'REPLACE THIS TEXT WITH THE OUTPUT OF THIS PROGRAM' in between_stars:
        gently("In your code, you need to 'REPLACE THIS TEXT WITH THE OUTPUT OF THIS PROGRAM'")
    elif not expected_output in between_stars:
        gently("The output you copied between the *****, seems to be incorrect. You may have copied it into the wrong "
               "location, or it is incomplete.")
Beispiel #3
0
def check_output_on_header(expected_output):
    code = get_program()
    expected_output = str(expected_output)
    between_stars = code.split("*****")[2].strip()
    between_stars = "\\n".join([x.strip() for x in between_stars.split("\\n")])
    if 'REPLACE THIS TEXT WITH THE OUTPUT OF THIS PROGRAM' in between_stars:
        gently("In your code, you need to 'REPLACE THIS TEXT WITH THE OUTPUT OF THIS PROGRAM'"
               "<br><br><i>(wrong_output_blank)<i></br></br>")
    elif expected_output not in between_stars:
        gently("The output you copied between the *****, seems to be incorrect. You may have copied it into the wrong "
               "location, or it is incomplete.<br><br><i>(wrong_output_fill)<i></br></br>")
Beispiel #4
0
def check_author_name_on_header():
    code = get_program()
    m_author = re.search('Author: \\w+', code)
    if not m_author:
        gently("You need to add your name to the author field at the top of the file."
               "<br><br><i>(name_missing)<i></br></br>")
Beispiel #5
0
def find_in_code(regex):
    code = get_program()
    return re.search(regex, code)
Beispiel #6
0
def check_problem_submission(prob_id):
    if prob_id not in get_program():
        explain("Make sure that you are turning in {}<br><br><i>(wrong_problem)<i></br></br>".format(prob_id))
        return True
Beispiel #7
0
def check_author_name_on_header():
    code = get_program()
    m_author = re.search('Author: \\w+', code)
    if not m_author:
        gently_r("You need to add your name to the author field at the top of the file.", "name_missing",
                 label="Missing Name")
Beispiel #8
0
def find_in_code(regex):
    code = get_program()
    return re.search(regex, code)
Beispiel #9
0
def check_problem_submission(prob_id):
    if prob_id not in get_program():
        explain_r("Make sure that you are turning in {}</br>".format(prob_id), "wrong_problem", label="Wrong Problem")
        return True
Beispiel #10
0
def check_problem_submission(prob_id):
    if prob_id not in get_program():
        explain(
            "Make sure that you are turning in {}<br><br><i>(wrong_problem)<i></br></br>"
            .format(prob_id))
        return True