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

Get the most recent scores for this assignment.

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

Get the most recent scores 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.

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 assignment.
 3"""
 4
 5import argparse
 6import sys
 7
 8import lms.model.base
 9
10import autograder.api.courses.assignments.submissions.fetch.course.scores
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    scores = autograder.api.courses.assignments.submissions.fetch.course.scores.send(config, exit_on_error = True)
19
20    output = lms.model.base.base_list_to_output_format(scores, config.output_format,
21            skip_headers = args.skip_headers,
22            pretty_headers = args.pretty_headers,
23            include_extra_fields = args.include_extra_fields,
24    )
25    print(output)
26
27    return 0
28
29def main() -> int:
30    """ Get a parser, parse the args, and call run. """
31
32    return run_cli(_get_parser().parse_args())
33
34def _get_parser() -> argparse.ArgumentParser:
35    """ Get a parser for this operation. """
36
37    parser = autograder.cli.parser.get_parser(
38        __doc__.strip(),
39        autograder.api.courses.assignments.submissions.fetch.course.scores.API_PARAMS,
40        include_output_format = True)
41
42    return parser
43
44if (__name__ == '__main__'):
45    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    scores = autograder.api.courses.assignments.submissions.fetch.course.scores.send(config, exit_on_error = True)
20
21    output = lms.model.base.base_list_to_output_format(scores, config.output_format,
22            skip_headers = args.skip_headers,
23            pretty_headers = args.pretty_headers,
24            include_extra_fields = args.include_extra_fields,
25    )
26    print(output)
27
28    return 0

Run the CLI.

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

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