當前位置: 首頁>>代碼示例>>Python>>正文


Python Course.getName方法代碼示例

本文整理匯總了Python中models.Course.getName方法的典型用法代碼示例。如果您正苦於以下問題:Python Course.getName方法的具體用法?Python Course.getName怎麽用?Python Course.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Course的用法示例。


在下文中一共展示了Course.getName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: process

# 需要導入模塊: from models import Course [as 別名]
# 或者: from models.Course import getName [as 別名]

#.........這裏部分代碼省略.........
                    value = convert_time(value, student_wb)

                student_args[name] = value

        if not(invalid_row):
            students.append(Student(**student_args))
        else:
            # Student was mising a column they needed.
            invalid_students.append(i)

    courses = {}
    
    # Values that may be blank.
    course_acceptable_blanks = []
    invalid_courses = []

    # Put course information into course object.
    for i in range(1, course_sheet.nrows):
        invalid_row = False
        course_args = {}
        for name, col in course_headers.iteritems():
            cell_type = course_sheet.cell_type(i, col)
            if cell_type == xlrd.XL_CELL_EMPTY:
                invalid_row = True
                break
            else:
                course_args[name] = course_sheet.cell_value(i, col)

        if not(invalid_row):
            course = Course(**course_args)
            # Either add seats to existing course, or set course that
            # we haven't seen before.
            try:
                courses[course.getName()].addSeats(course.getSeats())
            except KeyError:
                courses[course.getName()] = course
        else:
            invalid_courses.append(i)

    # For testing, print values of courses.
    #for k, v in courses.iteritems():
    #    print([k])
    #    print(u"Course: {}; Seats: {}".format(v.getName(), v.getSeats()))

    # Do allocation of students, returns unsorted students and courses that were
    # not found, and also inserts students into the students list in each course
    unsorted_students, missing_courses = sortStudents(students, courses)
    # At this point,  courses will have had their arrays filled with students.
    
    ### UNSORTED STUDENTS ###
    u_students_filename = timeStamped("unsorted-students.xls")
    u_students_wb_path = os.path.join(
        app.config['UPLOAD_FOLDER'],
        u_students_filename
    )

    # Construct workbooks and populate them.
    unsorted_students_wb = xlwt.Workbook()
    unsorted_students_sheet = unsorted_students_wb.add_sheet("Students")
    unsorted_student_headers = [
        "ID", "First Name", "Last Name", "First Year Seminar DDB 1", "First Year Seminar DDB 2", "First Year Seminar DDB 3"
    ]
    for index, header in enumerate(unsorted_student_headers):
        unsorted_students_sheet.write(0, index, header)

    for i, student in enumerate(unsorted_students):
開發者ID:chrahunt,項目名稱:fsem-scheduler,代碼行數:70,代碼來源:app.py


注:本文中的models.Course.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。