autograder.cli.courses.assignments.submissions.remove

Remove a specified submission. Defaults to the most recent submission.

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

Remove a specified submission.
Defaults to the most recent 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"""
 2Remove a specified submission.
 3Defaults to the most recent submission.
 4"""
 5
 6import argparse
 7import sys
 8
 9import autograder.api.courses.assignments.submissions.remove
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 = autograder.api.courses.assignments.submissions.remove.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    print("Submission removed.")
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.remove.API_PARAMS)
42
43    return parser
44
45if (__name__ == '__main__'):
46    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 = autograder.api.courses.assignments.submissions.remove.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    print("Submission removed.")
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.