本文整理汇总了Python中schedule.Schedule.add_lesson方法的典型用法代码示例。如果您正苦于以下问题:Python Schedule.add_lesson方法的具体用法?Python Schedule.add_lesson怎么用?Python Schedule.add_lesson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类schedule.Schedule
的用法示例。
在下文中一共展示了Schedule.add_lesson方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: should_add_up
# 需要导入模块: from schedule import Schedule [as 别名]
# 或者: from schedule.Schedule import add_lesson [as 别名]
def should_add_up(self):
schedule = Schedule()
schedule.add_lesson(RandomWeeklyLesson())
schedule.add_lesson(RandomWeeklyLesson())
b = Bins(schedule=schedule)
b_ = b.bins()
expect(b[0] + b[1] + b[2] + b[3] + b[4] + b[5]).to.equal(2)
expect(b_[0] + b_[1] + b_[2] + b_[3] + b_[4] + b_[5]).to.equal(2)
示例2: generate_sample_schedule
# 需要导入模块: from schedule import Schedule [as 别名]
# 或者: from schedule.Schedule import add_lesson [as 别名]
def generate_sample_schedule(self, business_forecast):
schedule = Schedule()
for i in business_forecast:
for j in range(0, int(i['frequency'] * i['schedule_type'])):
schedule.add_lesson(\
RandomWeeklyLesson(\
start_time_range=self.start_time_range,
day_of_week_range=self.day_of_week_range))
return schedule
示例3: __init__
# 需要导入模块: from schedule import Schedule [as 别名]
# 或者: from schedule.Schedule import add_lesson [as 别名]
def __init__(self, start_time_range=(0,23.75,), day_of_week_range=(0,6,)):
self.start_time_range = start_time_range
self.day_of_week_range = day_of_week_range
schedule = Schedule()
lower_limit_start_time, upper_limit_start_time = start_time_range
lower_limit_day_of_week, upper_limit_day_of_week = day_of_week_range
for i in np.linspace(lower_limit_start_time, upper_limit_start_time, 96):
for j in range(lower_limit_day_of_week, upper_limit_day_of_week + 1):
schedule.add_lesson( WeeklyLesson(start_time=i, day_of_week=j))
self.bins = Bins(schedule=schedule).bins()
示例4: it_should_aggregate_the_lesson_requests_per_bin
# 需要导入模块: from schedule import Schedule [as 别名]
# 或者: from schedule.Schedule import add_lesson [as 别名]
def it_should_aggregate_the_lesson_requests_per_bin(self):
schedule = Schedule()
schedule.add_lesson(RandomWeeklyLesson())
b = Bins(schedule=schedule)
expect(b.sum().sum()).to.equal(1)
示例5: by_default_should_be_6
# 需要导入模块: from schedule import Schedule [as 别名]
# 或者: from schedule.Schedule import add_lesson [as 别名]
def by_default_should_be_6(self):
schedule = Schedule()
schedule.add_lesson(RandomWeeklyLesson())
b = Bins(schedule=schedule)
expect(b.num_bins()).to.equal(6)