def _graded_assignments(course_key):
 grading_context = grading_context_for_course(course_key)
 graded_assignments_map = OrderedDict()
 for (assignment_type_name, subsection_infos) in grading_context['all_graded_subsections_by_type'].iteritems():
  graded_subsections_map = OrderedDict()
  for (subsection_index, subsection_info) in enumerate(subsection_infos, start=1):
   subsection = subsection_info['subsection_block']
   header_name = u'{assignment_type} {subsection_index}: {subsection_name}'.format(assignment_type=assignment_type_name, subsection_index=subsection_index, subsection_name=subsection.display_name)
   graded_subsections_map[subsection.location] = header_name
  average_header = u'{assignment_type}'.format(assignment_type=assignment_type_name)
  use_subsection_headers = (len(subsection_infos) > 1)
  if use_subsection_headers:
   average_header += u' (Avg)'
  graded_assignments_map[assignment_type_name] = {'subsection_headers': graded_subsections_map, 'average_header': average_header, 'use_subsection_headers': use_subsection_headers}
 return graded_assignments_map

def _graded_assignments ( course_key ) : grading_context = grading_context_for_course ( course_key ) graded_assignments_map = OrderedDict ( ) for ( assignment_type_name , subsection_infos ) in grading_context [ 'all_graded_subsections_by_type' ] . iteritems ( ) : graded_subsections_map = OrderedDict ( ) for ( subsection_index , subsection_info ) in enumerate ( subsection_infos , start = 1 ) : subsection = subsection_info [ 'subsection_block' ] header_name = u'{assignment_type} {subsection_index}: {subsection_name}' . format ( assignment_type = assignment_type_name , subsection_index = subsection_index , subsection_name = subsection . display_name ) graded_subsections_map [ subsection . location ] = header_name average_header = u'{assignment_type}' . format ( assignment_type = assignment_type_name ) use_subsection_headers = ( len ( subsection_infos ) > 1 ) if use_subsection_headers : average_header += u' (Avg)' graded_assignments_map [ assignment_type_name ] = { 'subsection_headers' : graded_subsections_map , 'average_header' : average_header , 'use_subsection_headers' : use_subsection_headers } return graded_assignments_map
returns an ordereddict that maps an assignment type to a dict of subsection-headers and average-header .