grip_hook.quiz¶
grip_hook.quiz ¶
The quiz itself: generate questions, ask them, grade, decide.
QuizOutcome
dataclass
¶
Result of one quiz run.
Source code in src/grip_hook/quiz.py
render_intro ¶
Show what is about to be quizzed.
Source code in src/grip_hook/quiz.py
read_answer ¶
One answer: the line typed, or every line of a paste, line breaks kept.
A paste arrives faster than anyone types, so the lines already waiting after the first belong to the same answer, blank lines between paragraphs included. A paste can stop mid-line and leave its last line waiting for Enter, so a pasted answer runs on to the next empty line.
Source code in src/grip_hook/quiz.py
ask_questions ¶
Present each question and collect one line of answer for it.
Source code in src/grip_hook/quiz.py
render_result ¶
Print the score table and verdict.
Source code in src/grip_hook/quiz.py
run_quiz ¶
run_quiz(*, diff: Diff, cfg: Config, provider: Provider, term: Terminal, stage: Stage) -> QuizOutcome
Run the full quiz and return the outcome. Does not exit or raise on failure.