jmu_gradescope_utils.utils

class jmu_gradescope_utils.utils.IOContext(in_string)

Context manager that allows specifying simulated keyboard input, and captures text output.

Use like so:

context = IOContext("program input")
with context:
    # my code block
output = context.output
jmu_gradescope_utils.utils.check_submitted_files(paths, base='/autograder/submission')

Checks that the files in the given list exist in the student’s submission.

Returns a list of missing files.

eg. check_submitted_files([‘src/calculator.py’])

jmu_gradescope_utils.utils.count_regex_matches(regex, filename, strip_comments=True)
jmu_gradescope_utils.utils.full_source_path(filename=None)
jmu_gradescope_utils.utils.full_submission_path(filename=None)
jmu_gradescope_utils.utils.replace_variables(filename, variables=None, new_name=None)
jmu_gradescope_utils.utils.run_flake8(filename, config='flake8.cfg')

Return the output of executing flake8. Should be an empty string if no formatting issues were found.

jmu_gradescope_utils.utils.run_flake8_docstring(filename)
jmu_gradescope_utils.utils.suppress_IO(in_string)

Suppresses standard io when running a block of code, feeding in the given in_string as input and squelching all output. Use as:

with suppress_IO("desired input"):
    # my code block