API reference · assignments/base.py · 297 lines
assignments.base
Assignment grader base class and registry.
An assignment module maps rubric ids to check methods. Every check receives the same context and returns one RubricItemResult carrying a score, a status, a confidence and the evidence behind it (design.md §24).
Summary
| Name | Kind | Description |
|---|---|---|
GradingContext | class | Everything a check may look at. |
AssignmentGrader | class | Base grader: dispatches rubric ids to check_<rubric_id> methods. |
register() | function | Class decorator: register an AssignmentGrader subclass under its assignment_id. |
get_grader() | function | Return the grader for a rubric, falling back to the generic base. |
registered_assignments() | function |
Classes
Everything a check may look at.
Fields
| Name | Type | Default | Notes |
|---|---|---|---|
student_id | str | required | |
rubric | Rubric | required | |
analysis | NotebookAnalysis | required | |
execution | ExecutionRecord | required | |
probe | dict[str, Any] | None | None | |
workdir | Path | None | None | |
discovery_warnings | list[str] | field(default_factory=list) | |
qualitative_grader | Any | None | None | |
settings | dict[str, Any] | field(default_factory=dict) | |
cache | dict[str, Any] | field(default_factory=dict) | Scratch space for work shared between checks on one submission — e.g. HW2 reads the executed notebook once and grades seven items from it. |
Properties
Base grader: dispatches rubric ids to check_<rubric_id> methods.
Class attributes
| Name | Type | Default | Notes |
|---|---|---|---|
assignment_id | | 'base' |
Methods
- probe_config() -> dict[str, Any] #[source]
Config handed to the in-kernel probe (hidden tests included).
- grade(ctx: GradingContext) -> list[RubricItemResult] #[source]
Run every rubric item's
check_<id>method and return one result per item.A missing check returns
manual_review; a check that raises returnsmanual_reviewwith confidence 0 and the error in its evidence, so a broken check never loses a submission.
- result(item: RubricItem, score: float, status: str, confidence: float = 1.0, feedback: str = '', evidence: dict[str, Any] | None = None) -> RubricItemResult #[source]
Build a
RubricItemResult, rounding the score to the rubric'sscore_roundingincrement and clamping it to[0, points].
- no_probe_result(item: RubricItem, ctx: GradingContext) -> RubricItemResult #[source]
Shared response when the kernel never reported its namespace.
Rubric checks 2
Each check_<rubric_id> method grades the rubric item with that id and returns one RubricItemResult.
- check_unimplemented(ctx: GradingContext, item: RubricItem) -> RubricItemResult #[source]
No description.
- check_notebook_execution(ctx: GradingContext, item: RubricItem) -> RubricItemResult #[source]
Shared execution check (design.md §19). Never an automatic zero.
Functions
- register(cls: type[AssignmentGrader]) -> type[AssignmentGrader] #[source]
Class decorator: register an
AssignmentGradersubclass under itsassignment_id.
- get_grader(rubric: Rubric) -> AssignmentGrader #[source]
Return the grader for a rubric, falling back to the generic base.