From 13030b6acdc41875a8868ec91362950a3dcd8fdf Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Mon, 11 Oct 2021 23:04:10 +0800 Subject: Specify homework id through CLI argument Remove HOMEWORK_ID from config. Instead, use CLI parameter -i/--homework-id . --- leningrade.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'leningrade.py') diff --git a/leningrade.py b/leningrade.py index a54e6e5..fe7ee9a 100644 --- a/leningrade.py +++ b/leningrade.py @@ -12,6 +12,12 @@ parser.add_argument( required=True, help="An integer. For h1, the value should be 1.", ) +parser.add_argument( + "-i", + "--homework-id", + required=True, + help="A hexadecimal string obtained from the JOJ URL of the homework.", +) parser.add_argument( "-I", "--no-individual", @@ -55,7 +61,7 @@ giteaWorker = GiteaWorker(args, GITEA_API_BASE, GITEA_ORG, GITEA_TOKEN, HGROUP) jojWorker = JOJWorker(args, JOJ_COURSE_ID, JOJ_SESSION_ID, HGROUP) JOJ_INFO = { - "homeworkID": JOJ_HOMEWORK_ID, + "homeworkID": cli_args.homework_id, "lang": LANGUAGE, # "problemInfo": [ # # filenames, problem ID, # of test cases @@ -64,7 +70,7 @@ JOJ_INFO = { # (["ex5.m"], "61553f8cb3c06a0006f45db2", 10), # (["ex6.m"], "6155414cb3c06a0006f45dc7", 10), # ], - "problemInfo": problem_info(JOJ_HOMEWORK_ID), + "problemInfo": problem_info(cli_args.homework_id), } indvScores = {} -- cgit v1.2.3