grader.checks package
Submodules
grader.checks.abstract_check module
Module containing a class representing an abstract check. Each check should inherit from this class.
- class grader.checks.abstract_check.AbstractCheck(name: str, max_points: int, project_root: str, is_venv_requred: bool = False)[source]
Bases:
ABC
Each check has a name and a maximum amount of points. It also needs the project root path.
- static is_running_within_venv() bool [source]
Determine if the check is running within a virtual environment.
- Returns:
True if running within a virtual environment, False otherwise.
- Return type:
bool
- property max_points: int
The maximum amount of points that can be achieved by the check. :rtype: int
- Type:
returns
- property name: str
Get the name of the check.
- Returns:
The name of the check.
- Return type:
str
grader.checks.checks_factory module
grader.checks.coverage_check module
Module containing the unit test code coverage check.
- class grader.checks.coverage_check.CoverageCheck(name: str, max_points: int, project_root: str)[source]
Bases:
AbstractCheck
The Coverage check class.
grader.checks.pylint_check module
grader.checks.requirements_check module
Module containing the requirements.txt check. It checks if requirements.txt exists in the project root.
- class grader.checks.requirements_check.RequirementsCheck(name: str, max_points: int, project_root: str)[source]
Bases:
AbstractCheck
The requirements.txt check class.
grader.checks.type_hints_check module
Module containing the type hints check. It calls mypy as a subprocess to generate a report and then read from the report.
- class grader.checks.type_hints_check.TypeHintsCheck(name: str, max_points: int, project_root: str)[source]
Bases:
AbstractCheck
The TypeHints check class.
- run() float [source]
Run the mypy check on the project.
First, find all python files in the project, then run mypy on all files with the special config. Mypy then generates a report with the amount of lines with type hints and the total amount of lines.
The first line in the report contains the values for all files. The line contains a lot of stuff, we just need the type-hinted lines and the total amount of lines.
- Returns:
The score from the mypy check.
- Return type:
float