#!/bin/python3 import operator import sys from optparse import OptionParser from shpc_grader import SHPCProblem, SHPCGrader, SHPCTestCase def parseOptions(): usage = "usage: %prog [options] submission-dir" parser = OptionParser(usage) parser.add_option("-o", "--output", dest="outfile", help="output file path to write grading result") options, args = parser.parse_args() if len(args) == 0: parser.error("submission directory name must be given") if len(args) != 1: parser.error("Illegal number of arguments") return options, args def main(): options, args = parseOptions() submission_dir = args[0] from hw1 import hw1_2 from hw2 import hw2_2, hw2_3 problems = [ hw1_2, hw2_2, hw2_3, ] users = [f"shpc{i:03}" for i in range(1, 181)] grader = SHPCGrader( submission_dir, problems, users, out=sys.stderr ) grader.grade() grader.to_csv(sep="\t") if __name__ == "__main__": main()