当前位置: 首页>>代码示例>>Python>>正文


Python Course.professors[complete_name]方法代码示例

本文整理汇总了Python中course.Course.professors[complete_name]方法的典型用法代码示例。如果您正苦于以下问题:Python Course.professors[complete_name]方法的具体用法?Python Course.professors[complete_name]怎么用?Python Course.professors[complete_name]使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在course.Course的用法示例。


在下文中一共展示了Course.professors[complete_name]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_from_file

# 需要导入模块: from course import Course [as 别名]
# 或者: from course.Course import professors[complete_name] [as 别名]
    def load_from_file(self, course_file_path, course_name, begin_date, end_date):

        print "\nStarting to load \'" + course_file_path + "\' file.\n"
        
        students_file_path = course_file_path + "students.in"
        professors_file_path = course_file_path + "professors.in"
        tutors_file_path = course_file_path + "tutors.in"
        
        ignore_file_path = course_file_path + "ignore"
        ignored_names = self._get_ignored_names(ignore_file_path)

        data_student = open(students_file_path)
        data_professor = open(professors_file_path)
        data_tutors = open(tutors_file_path)

        data_size = os.path.getsize(students_file_path) + os.path.getsize(professors_file_path) \
                                                        + os.path.getsize(tutors_file_path)

        # Put the carret at the right place
        data_processed = len(data_professor.readline()) + len(data_professor.readline())
        data_processed = data_processed + len(data_student.readline()) + len(data_student.readline())
        data_processed = data_processed + len(data_tutors.readline()) + len(data_tutors.readline())

        course = Course(course_name)
        count_interaction = 0
        
        #Professors loader
        for line in data_professor:
            data_processed = data_processed + len(line)
            self.progress_load(data_size, data_processed)

            new_line = remove_white_space(line)
            split_line = string.split(new_line, "|")

            #split_line must have 3 position
            if len(split_line) != 3:
                continue

            complete_name = split_line[0]+" "+split_line[1]
            first_name = split_line[0]
            last_name = split_line[1]
            timestamp = split_line[2]

            if complete_name in ignored_names:
                continue
            
            if not begin_date < int(timestamp) < end_date:
                continue
            
            if complete_name in course.professors:
                professor = course.professors.get(complete_name)
                conf_interaction = professor.set_interation(timestamp)
            else:
                professor = Professor(first_name, last_name)
                conf_interaction = professor.set_interation(timestamp)
                course.professors[complete_name] = professor

        data_professor.close()
        
        #Tutors loader
        for line in data_tutors:

            data_processed = data_processed + len(line)
            self.progress_load(data_size, data_processed)

            new_line = remove_white_space(line)
            split_line = string.split(new_line, "|")

            #split_line must have 3 position
            if len(split_line) != 3:
                continue

            complete_name = split_line[0]+" "+split_line[1]
            first_name = split_line[0]
            last_name = split_line[1]
            timestamp = split_line[2]

            if complete_name in ignored_names:
                continue
            
            if not begin_date < int(timestamp) < end_date:
                continue

            if self.is_professor(complete_name, course):
                continue

            if complete_name in course.tutors:
                tutor = course.tutors.get(complete_name)
                tutor.set_interation(timestamp)
            else:
                tutor = Tutor(first_name, last_name)
                tutor.set_interation(timestamp)
                course.tutors[complete_name] = tutor

        data_tutors.close()
            
        #Students loader
        for line in data_student:

            data_processed = data_processed + len(line)
#.........这里部分代码省略.........
开发者ID:ddetoni,项目名称:TCCTool,代码行数:103,代码来源:dataloader.py


注:本文中的course.Course.professors[complete_name]方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。