Skip to content
Snippets Groups Projects
Commit e9d40fc9 authored by Tue Herlau's avatar Tue Herlau
Browse files

2021 coming up

parent b2812840
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,5 @@ setup( ...@@ -10,6 +10,5 @@ setup(
author_email='tuhe@dtu.dk', author_email='tuhe@dtu.dk',
description='A lightweight student evaluation framework build on unittest', description='A lightweight student evaluation framework build on unittest',
include_package_data=True, include_package_data=True,
install_requires=['jinja2', 'tabulate', 'sklearn', 'compress_pickle', ], install_requires=['jinja2', 'tabulate', 'sklearn', 'compress_pickle', "pyfiglet", "numpy"],
# package_data={'', ['*.dat']},#'cs101courseware_example/Report1_resources_do_not_hand_in.dat', 'cs101courseware_example/Report2_resources_do_not_hand_in.dat')},
) )
__version__ = "0.0.8" __version__ = "0.0.9"
import os import os
import compress_pickle import compress_pickle
......
import numpy as np import numpy as np
from tabulate import tabulate from tabulate import tabulate
from datetime import datetime from datetime import datetime
import pickle
import pyfiglet import pyfiglet
import unitgrade
from unitgrade import Hidden, myround, msum, mfloor from unitgrade import Hidden, myround, msum, mfloor
from unitgrade import __version__ from unitgrade import __version__
...@@ -30,13 +28,13 @@ Note this scripts does not grade your report. To grade your report, use: ...@@ -30,13 +28,13 @@ Note this scripts does not grade your report. To grade your report, use:
> python report1_grade.py > python report1_grade.py
Finally, note that if your report is part of a module (package), and the report script requires part of that package, the -m option for python may be useful. Finally, note that if your report is part of a module (package), and the report script requires part of that package, the -m option for python may be useful.
As an old, suppose the report file is Documents/course_package/assignment1_dp.py, and `course_package` is a python package. Change directory to 'Documents/` and execute: For instance, if the report file is in Documents/course_package/assignment1_dp.py, and `course_package` is a python package, then change directory to 'Documents/` and run:
> python -m course_package.report1 > python -m course_package.report1
see https://docs.python.org/3.9/using/cmdline.html see https://docs.python.org/3.9/using/cmdline.html
""", formatter_class=argparse.RawTextHelpFormatter) """, formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('-q', nargs='?', type=str, default=None, help='Only evaluate this question (old: -q 2)') parser.add_argument('-q', nargs='?', type=str, default=None, help='Only evaluate this question (e.g.: -q 2)')
parser.add_argument('--showexpected', action="store_true", help='Show the expected/desired result') parser.add_argument('--showexpected', action="store_true", help='Show the expected/desired result')
parser.add_argument('--showcomputed', action="store_true", help='Show the answer your code computes') parser.add_argument('--showcomputed', action="store_true", help='Show the answer your code computes')
parser.add_argument('--unmute', action="store_true", help='Show result of print(...) commands in code') parser.add_argument('--unmute', action="store_true", help='Show result of print(...) commands in code')
...@@ -63,7 +61,6 @@ def evaluate_report_student(report, question=None, qitem=None, unmute=None, pass ...@@ -63,7 +61,6 @@ def evaluate_report_student(report, question=None, qitem=None, unmute=None, pass
unmute = args.unmute unmute = args.unmute
if passall is None: if passall is None:
passall = args.passall passall = args.passall
print(args.unmute, unmute)
results, table_data = evaluate_report(report, question=question, qitem=qitem, verbose=False, passall=passall, show_expected=args.showexpected, show_computed=args.showcomputed,unmute=unmute) results, table_data = evaluate_report(report, question=question, qitem=qitem, verbose=False, passall=passall, show_expected=args.showexpected, show_computed=args.showcomputed,unmute=unmute)
if question is None: if question is None:
...@@ -89,7 +86,7 @@ def upack(q): ...@@ -89,7 +86,7 @@ def upack(q):
# ws, possible, obtained = (np.asarray(x).squeeze() for x in zip([(i['w'], i['possible'], i['obtained']) for i in q.values()])) # ws, possible, obtained = (np.asarray(x).squeeze() for x in zip([(i['w'], i['possible'], i['obtained']) for i in q.values()]))
# return ws, possible, obtained # return ws, possible, obtained
def evaluate_report(report, question=None, qitem=None, passall=False, verbose=False, show_expected=False, show_computed=False,unmute=False): def evaluate_report(report, question=None, qitem=None, passall=False, verbose=False, show_expected=False, show_computed=False,unmute=False, show_help_flag=True):
now = datetime.now() now = datetime.now()
# show_expected = True # show_expected = True
ascii_banner = pyfiglet.figlet_format("UnitGrade", font="doom") ascii_banner = pyfiglet.figlet_format("UnitGrade", font="doom")
...@@ -100,7 +97,7 @@ def evaluate_report(report, question=None, qitem=None, passall=False, verbose=Fa ...@@ -100,7 +97,7 @@ def evaluate_report(report, question=None, qitem=None, passall=False, verbose=Fa
s = report.title s = report.title
if report.version is not None: if report.version is not None:
s += " version " + report.version s += " version " + report.version
print("Evaluating " + s, "(use --help for options)") print("Evaluating " + s, "(use --help for options)" if show_help_flag else "")
print(f"Loaded answers from: ", report.computed_answers_file, "\n") print(f"Loaded answers from: ", report.computed_answers_file, "\n")
table_data = [] table_data = []
nL = 80 nL = 80
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment