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

Get the most recent scores for this user and assignment.

usage: python3 -m autograder.cli.courses.assignments.submissions.fetch.user.history
       [-h] [--version] [--server SERVER] [--user USER] [--pass PASS]
       [--course COURSE] [--assignment ASSIGNMENT]
       [--target-email TARGET_EMAIL] [--testing-mode]
       [--format {json,table,text}] [--include-extra-fields]
       [--pretty-headers] [--skip-headers]

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

testing options:
    --testing-mode      Run as if a test is being run (default: False).

output formatting options:
    --format {json,table,text}
                        The format to display the output as (default: text).
    --include-extra-fields
                        Include uncommon fields in results (default: False).
    --pretty-headers    When displaying headers, try to make them look
                        "pretty" (default: False).
    --skip-headers      Skip headers when outputting results, will not apply
                        to all formats (default: False).
 1"""
 2Get the most recent scores for this user and assignment.
 3"""
 4
 5import argparse
 6import sys
 7
 8import lms.model.base
 9
10import autograder.api.courses.assignments.submissions.fetch.user.history
11import autograder.cli.common
12import autograder.cli.parser
13
14def run_cli(args: argparse.Namespace) -> int:
15    """ Run the CLI. """
16
17    config = args._config_info.application_config
18
19    found_user, scores = autograder.api.courses.assignments.submissions.fetch.user.history.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    output = lms.model.base.base_list_to_output_format(scores, config.output_format,
26            skip_headers = args.skip_headers,
27            pretty_headers = args.pretty_headers,
28            include_extra_fields = args.include_extra_fields,
29    )
30    print(output)
31
32    return 0
33
34def main() -> int:
35    """ Get a parser, parse the args, and call run. """
36
37    return run_cli(_get_parser().parse_args())
38
39def _get_parser() -> argparse.ArgumentParser:
40    """ Get a parser for this operation. """
41
42    parser = autograder.cli.parser.get_parser(
43        __doc__.strip(),
44        autograder.api.courses.assignments.submissions.fetch.user.history.API_PARAMS,
45        include_output_format = True)
46
47    return parser
48
49if (__name__ == '__main__'):
50    sys.exit(main())
def run_cli(args: argparse.Namespace) -> int:
15def run_cli(args: argparse.Namespace) -> int:
16    """ Run the CLI. """
17
18    config = args._config_info.application_config
19
20    found_user, scores = autograder.api.courses.assignments.submissions.fetch.user.history.send(config, exit_on_error = True)
21
22    if (not found_user):
23        autograder.cli.common.print_no_match('user', config.target_email)
24        return 1
25
26    output = lms.model.base.base_list_to_output_format(scores, config.output_format,
27            skip_headers = args.skip_headers,
28            pretty_headers = args.pretty_headers,
29            include_extra_fields = args.include_extra_fields,
30    )
31    print(output)
32
33    return 0

Run the CLI.

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

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