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.

  • student (Union[Student, str]) – The student to apply the exceptions to. Can be a Student object or a string that will be used to find the student.

  • exceptions (Sequence[Union[ForgiveLate, Drop, Replace]]) – A sequence of exceptions to apply to the student. Each exception should be an instance of ForgiveLate, Drop, or Replace.

Example

>>> from gradelib.policies.exceptions import make_exceptions, ForgiveLate, Drop
>>> make_exceptions(gradebook, "Justin", [
        Drop("homework 01", reason="Illness."),
        ForgiveLate("homework 02", reason="Family emergency.")
    ])
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.