gradelib.policies.exceptions - Track grading exceptions

gradelib.policies.exceptions.make_exceptions(gradebook: Gradebook, student: Student | str, exceptions: Sequence[ForgiveLate | Drop | Replace])

Make policy exceptions for individual students.

Parameters:
  • gradebook (Gradebook) – The gradebook to apply the exceptions to. Will be modified.

  • students – A mapping from student names to a list of exceptions that will be applied. The exceptions should be instances of ForgiveLate, Drop, or Replace. The keys can be the full name or identifying substrings of names – if it is not a precise match (more than one student is found), an exception will be raised.

class gradelib.policies.exceptions.Drop(assignment: str, reason: str | None = None)

Drop a student’s assignment. To be used with make_exceptions().

Parameters:
  • assignment (str) – The name of the assignment that will be dropped.

  • reason (Optional[str]) – An optional reason for the exception.

class gradelib.policies.exceptions.ForgiveLate(assignment: str, reason: str | None = None)

Forgive a student’s late assignment. To be used with make_exceptions().

Parameters:
  • assignment (str) – The name of the assignment whose lateness will be forgiven.

  • reason (Optional[str]) – An optional reason for the exception.

class gradelib.policies.exceptions.Replace(assignment: str, with_: str | Points | Percentage, reason: str | None = None)

Replace a student’s score on an assignment. To be used with make_exceptions().

Parameters:
  • assignment (str) – The name of the assignment whose score will be replaced.

  • with (Union[str, Points, Percentage]) – If a string, it will be interpreted as the name of an assignment, and that assignment’s score will be used to replace the given assignment’s score. If Points, this will override the existing point total. If Percentage, the new point total is computed from the points possible for the assignment.

  • reason (Optional[str]) – An optional reason for the exception.