gradelib#

Provides the core types and functionality of gradelib.

Core Types#

Functions#

gradelib.combine_gradebooks(gradebooks: Collection[Gradebook], restrict_to_students: Collection[str | Student] | None = None) Gradebook#

Create a new Gradebook by safely combining existing gradebooks.

The gradebooks being combined must all have the same students, and an assignment name cannot appear in more than one gradebook. If either of these conditions are violated, a ValueError is raised.

The new gradebook’s grading groups are reset; there are no groups.

If the scales are the same in each gradebook, the new gradebook’s scale is set accordingly. If they are different, a ValueError is raised. The same is true for the options attribute.

Parameters:
  • gradebooks (Collection[Gradebook]) – The gradebooks to combine.

  • restrict_to_students (Optional[Collection[Union[str, Student]]]) – If provided, each input gradebook will be restricted to the Students/PIDs given before attempting to combine them. This is a convenience option, and it simply calls Gradebook.restrict_to_students() on each of the inputs. Default: None

Returns:

A gradebook combining all of the input gradebooks.

Return type:

Gradebook

Raises:

ValueError – If the PID indices of gradebooks do not match; if there is a duplicate assignment name; the options do not match; the scales do not match.