本文整理匯總了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)