本文整理汇总了Python中student.Student.set_average_by_week方法的典型用法代码示例。如果您正苦于以下问题:Python Student.set_average_by_week方法的具体用法?Python Student.set_average_by_week怎么用?Python Student.set_average_by_week使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类student.Student
的用法示例。
在下文中一共展示了Student.set_average_by_week方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_from_file
# 需要导入模块: from student import Student [as 别名]
# 或者: from student.Student import set_average_by_week [as 别名]
#.........这里部分代码省略.........
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)
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 self.is_tutor(complete_name, course):
continue
confirm_interaction = None
if complete_name in course.students:
student = course.students.get(complete_name)
confirm_interaction = student.set_interation(timestamp)
else:
student = Student(first_name, last_name)
confirm_interaction = student.set_interation(timestamp)
course.students[complete_name] = student
#Exclude the invalid dates
if confirm_interaction is not None:
course.add_to_week_average(timestamp, 1)
count_interaction += 1
data_student.close()
for student in course.students.itervalues():
student.set_average_by_week()
print "\n"
self.print_data_stats(count_interaction, course)
return course