autograder.cli.courses.assignments.submissions.fetch.user.peek

Get a copy of the grading report for the specified submission. Does not submit a new submission.

usage: python3 -m autograder.cli.courses.assignments.submissions.fetch.user.peek
       [-h] [--version] [--server SERVER] [--user USER] [--pass PASS]
       [--course COURSE] [--assignment ASSIGNMENT]
       [--target-email TARGET_EMAIL] [--target-submission TARGET_SUBMISSION]
       [--testing-mode]

Get a copy of the grading report for the specified submission.
Does not submit a new submission.

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-email TARGET_EMAIL
                        The email of the user that is the target of this
                        request (defaults to you). (default: None)
    --target-submission TARGET_SUBMISSION
                        The ID of the submission (default to the most recent
                        submission). (default: None)

testing options:
    --testing-mode      Run as if a test is being run (default: False).
 1"""
 2Get a copy of the grading report for the specified submission.
 3Does not submit a new submission.
 4"""
 5
 6import argparse
 7import sys
 8
 9import autograder.api.courses.assignments.submissions.fetch.user.peek
10import autograder.cli.common
11import autograder.cli.parser
12
13def run_cli(args: argparse.Namespace) -> int:
14    """ Run the CLI. """
15
16    config = args._config_info.application_config
17
18    found_user, found_submission, result = autograder.api.courses.assignments.submissions.fetch.user.peek.send(config, exit_on_error = True)
19
20    if (not found_user):
21        autograder.cli.common.print_no_match('user', config.target_email)
22        return 1
23
24    if (not found_submission):
25        autograder.cli.common.print_no_match('submission', config.target_submission)
26        return 2
27
28    if (result is None):
29        raise ValueError("Existing submission was not provided by API.")
30
31    print(result.report())
32
33    return 0
34
35def main() -> int:
36    """ Get a parser, parse the args, and call run. """
37
38    return run_cli(_get_parser().parse_args())
39
40def _get_parser() -> argparse.ArgumentParser:
41    """ Get a parser for this operation. """
42
43    parser = autograder.cli.parser.get_parser(
44        __doc__.strip(),
45        autograder.api.courses.assignments.submissions.fetch.user.peek.API_PARAMS)
46
47    return parser
48
49if (__name__ == '__main__'):
50    sys.exit(main())
def run_cli(args: argparse.Namespace) -> int:
14def run_cli(args: argparse.Namespace) -> int:
15    """ Run the CLI. """
16
17    config = args._config_info.application_config
18
19    found_user, found_submission, result = autograder.api.courses.assignments.submissions.fetch.user.peek.send(config, exit_on_error = True)
20
21    if (not found_user):
22        autograder.cli.common.print_no_match('user', config.target_email)
23        return 1
24
25    if (not found_submission):
26        autograder.cli.common.print_no_match('submission', config.target_submission)
27        return 2
28
29    if (result is None):
30        raise ValueError("Existing submission was not provided by API.")
31
32    print(result.report())
33
34    return 0

Run the CLI.

def main() -> int:
36def main() -> int:
37    """ Get a parser, parse the args, and call run. """
38
39    return run_cli(_get_parser().parse_args())

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