autograder.cli.courses.assignments.submissions.fetch.course.attempts

Get all recent submissions and grading information for this assignment.

usage: python3 -m autograder.cli.courses.assignments.submissions.fetch.course.attempts
       [-h] [--version] [--server SERVER] [--user USER] [--pass PASS]
       [--course COURSE] [--assignment ASSIGNMENT]
       [--target-users TARGET_USERS] [--out-dir OUT_DIR] [--testing-mode]

Get all recent submissions and grading information for this assignment.

options:
    -h, --help          show this help message and exit
    --version           show program's version number and exit

command-specific options:
    --server SERVER     The URL of the autograder server to communicate with.
    --user USER         The email of the user making this request.
    --pass PASS         The password of the user making this request.
    --course COURSE     The ID of the course to make this request to.
    --assignment ASSIGNMENT
                        The ID of the assignment to make this request to.
    --target-users TARGET_USERS
                        A list of course user references. Course user
                        references may be specified in four ways: 1) Email
                        address of the requested user, 2) "*" to request all
                        users in the course, 3) "" (e.g.,
                        student, grader) to request all course users with that
                        role, and 4) any of the previous options preceded by a
                        minus sign (e.g., "-alice@test.edulinq.org",
                        "-student") to exclude that user or role from the
                        request. Default: All users in the course.
    --out-dir OUT_DIR   A directory to write output in. (default: .)

testing options:
    --testing-mode      Run as if a test is being run (default: False).
 1"""
 2Get all recent submissions and grading information for this assignment.
 3"""
 4
 5import argparse
 6import sys
 7
 8import autograder.api.courses.assignments.submissions.fetch.course.attempts
 9import autograder.cli.parser
10import autograder.util.grading
11
12def run_cli(args: argparse.Namespace) -> int:
13    """ Run the CLI. """
14
15    config = args._config_info.application_config
16
17    grading_results = autograder.api.courses.assignments.submissions.fetch.course.attempts.send(config, exit_on_error = True)
18
19    count = 0
20    for grading_result in grading_results.values():
21        if (grading_result is None):
22            continue
23
24        autograder.util.grading.output_grading_result(grading_result, base_dir = config.out_dir)
25        count += 1
26
27    print(f"Wrote {count} attempts to '{config.out_dir}'.")
28
29    return 0
30
31def main() -> int:
32    """ Get a parser, parse the args, and call run. """
33
34    return run_cli(_get_parser().parse_args())
35
36def _get_parser() -> argparse.ArgumentParser:
37    """ Get a parser for this operation. """
38
39    parser = autograder.cli.parser.get_parser(
40        __doc__.strip(),
41        autograder.api.courses.assignments.submissions.fetch.course.attempts.API_PARAMS)
42
43    return parser
44
45if (__name__ == '__main__'):
46    sys.exit(main())
def run_cli(args: argparse.Namespace) -> int:
13def run_cli(args: argparse.Namespace) -> int:
14    """ Run the CLI. """
15
16    config = args._config_info.application_config
17
18    grading_results = autograder.api.courses.assignments.submissions.fetch.course.attempts.send(config, exit_on_error = True)
19
20    count = 0
21    for grading_result in grading_results.values():
22        if (grading_result is None):
23            continue
24
25        autograder.util.grading.output_grading_result(grading_result, base_dir = config.out_dir)
26        count += 1
27
28    print(f"Wrote {count} attempts to '{config.out_dir}'.")
29
30    return 0

Run the CLI.

def main() -> int:
32def main() -> int:
33    """ Get a parser, parse the args, and call run. """
34
35    return run_cli(_get_parser().parse_args())

Get a parser, parse the args, and call run.