Skip to content

Models

Data classes used throughout mograder for representing check results, notebook results, and other structured data.

mograder.core.models

Data models for mograder.

CheckResult dataclass

Result of a single check() callout.

Source code in src/mograder/core/models.py
@dataclass
class CheckResult:
    """Result of a single check() callout."""

    label: str
    status: str  # "success", "danger", "warn", or "error"
    details: list[str] = field(default_factory=list)
    earned_weight: float = 0
    total_weight: float = 0
    hidden: bool = False

NotebookResult dataclass

Aggregated results for one submitted notebook.

Source code in src/mograder/core/models.py
@dataclass
class NotebookResult:
    """Aggregated results for one submitted notebook."""

    path: Path
    checks: list[CheckResult] = field(default_factory=list)
    export_ok: bool = True
    export_error: str = ""
    cell_errors: int = 0
    html_path: Path | None = None
    tampered: list[str] = field(default_factory=list)

RemoteAssignment dataclass

An assignment available on a remote server (Moodle or HTTPS).

Source code in src/mograder/core/models.py
@dataclass
class RemoteAssignment:
    """An assignment available on a remote server (Moodle or HTTPS)."""

    name: str
    id: str
    files: list[dict] = field(default_factory=list)
    duedate: int = 0
    cmid: str = ""

RemoteSubmission dataclass

A student submission fetched from a remote server.

Source code in src/mograder/core/models.py
@dataclass
class RemoteSubmission:
    """A student submission fetched from a remote server."""

    userid: str
    username: str
    filename: str
    url: str
    status: str = "submitted"
    timemodified: int = 0  # Unix timestamp of last modification

RemoteStatus dataclass

Submission status for the current user on a remote server.

Source code in src/mograder/core/models.py
@dataclass
class RemoteStatus:
    """Submission status for the current user on a remote server."""

    status: str = "new"
    graded: bool = False
    grade: str | None = None
    feedback: str = ""