nbgrader

This module process the nbgrader generated csv grades files and the output directories, and use canvas api to post grade to students, with late penalty and the messages.

source

nbgrader_grade

 nbgrader_grade (credentials_fp='', late_exception_fp='',
                 API_URL='https://canvas.ucsd.edu', course_id='',
                 assignment_id=-1, grades_fp='', verbosity=0)

Initialize Canvas Group within a Group Set and its appropriate memberships

Type Default Details
credentials_fp str credential file path. Template of the credentials.json
late_exception_fp str late exception yaml file path. Template of the late_exception.yaml
API_URL str https://canvas.ucsd.edu the domain name of canvas
course_id str Course ID, can be found in the course url
assignment_id int -1 assignment id, can be found in the canvas assignment url
grades_fp str nbgrader csv grades exports file path
verbosity int 0 Controls the verbosity: 0 = Silent, 1 = print all messages

source

nbgrader_grade.auth_canvas

 nbgrader_grade.auth_canvas (credentials_fp:str)

Authorize the canvas module with API_KEY

Type Details
credentials_fp str the Authenticator key generated from canvas

source

nbgrader_grade.set_course

 nbgrader_grade.set_course (course_id:int)

Set the target course by the course ID

Type Details
course_id int the course id of the target course

source

nbgrader_grade.load_grades_csv

 nbgrader_grade.load_grades_csv (csv_pf:str)

Load nbgrader exported csv file

Type Details
csv_pf str csv file path

source

nbgrader_grade.load_late_exception

 nbgrader_grade.load_late_exception (yaml_fp:str)

Load Late Exception File

Type Details
yaml_fp str yaml file path stores exception student cases

source

nbgrader_grade.get_late_days

 nbgrader_grade.get_late_days (target_assignment:str, student_id:str)

Calculate the late day of students submission of the target assignment

Type Details
target_assignment str target assignment name. Must in the column of nbgrader assignment csv
student_id str student id
Returns int late days of the target assignment

source

nbgrader_grade.calculate_credit_balance

 nbgrader_grade.calculate_credit_balance
                                          (passed_assignments:[<class'str'
                                          >], student_id:str,
                                          default_credit=5)

Calculate the balance of late hours from the nbgrader file

Type Default Details
passed_assignments [<class ‘str’>] list of passed assignments name. Must in the column of assignment.
student_id str target student
default_credit int 5 default total number of allowed late days
Returns int late credit balance of the target student

source

nbgrader_grade._post_grade

 nbgrader_grade._post_grade (student_id:int, grade:float, text_comment='')

Post grade and comment to canvas to the target assignment

Type Default Details
student_id int canvas student id of student. found in self.email_to_canvas_id
grade float grade of that assignment
text_comment str text comment of the submission. Can feed
Returns Submission created submission

source

nbgrader_grade.post_to_canvas

 nbgrader_grade.post_to_canvas (target_assignment:str,
                                passed_assignments:[<class'str'>],
                                post=True)

Post grade to canvas with late penalty.

Type Default Details
target_assignment str target assignment name to grab the late time. Must in the column of nbgrader assignment csv
passed_assignments [<class ‘str’>] list of passed assignment. Must in the column of nbgrader assignment csv
post bool True for testing purposes. Can hault the post operation