本文整理匯總了Python中schedule.Schedule.from_directory方法的典型用法代碼示例。如果您正苦於以下問題:Python Schedule.from_directory方法的具體用法?Python Schedule.from_directory怎麽用?Python Schedule.from_directory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類schedule.Schedule
的用法示例。
在下文中一共展示了Schedule.from_directory方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_app
# 需要導入模塊: from schedule import Schedule [as 別名]
# 或者: from schedule.Schedule import from_directory [as 別名]
def create_app(schedule_dir, template_dir):
schedule = Schedule.from_directory(schedule_dir)
resources = {'schedule': schedule,
'name_index': fm,
'LEGS': ALL_LEGS}
subroutes = [('/', home, 'station_list.html'),
('/<path:station_name>', get_stops, 'stop_times.html'),
('/favicon.ico', not_found)]
mako_response = MakoRenderFactory(template_dir)
cc_mw = HTTPCacheMiddleware(max_age=30, must_revalidate=True)
middlewares = [GzipMiddleware(), ProfilerMiddleware(), SimpleContextProcessor(LEGS=ALL_LEGS), cc_mw]
subapp = Application(subroutes, resources, mako_response, middlewares,
error_handlers=err_handlers)
routes = [('/', subapp), ('/v2/', subapp)]
app = Application(routes, error_handlers=err_handlers)
return app
示例2: create_app
# 需要導入模塊: from schedule import Schedule [as 別名]
# 或者: from schedule.Schedule import from_directory [as 別名]
def create_app(schedule_dir, template_dir):
schedule = Schedule.from_directory(schedule_dir)
resources = {"schedule": schedule, "name_index": NAME_MATCHER, "LEGS": ALL_LEGS}
subroutes = [
("/", home, "station_list.html"),
("/favicon.ico", lambda: NotFound()),
("/<station_name>", get_stops, "stop_times.html"),
]
mako_factory = MakoRenderFactory(template_dir)
cc_mw = HTTPCacheMiddleware(max_age=30, must_revalidate=True)
middlewares = [
SimpleProfileMiddleware(),
GetParamMiddleware(["sdate", "stime"]),
SimpleContextProcessor(LEGS=ALL_LEGS),
cc_mw,
]
app = Application(subroutes, resources, mako_factory, middlewares)
# routes = [('/', app), ('/v2/', app)]
# app = Application(routes)
return app
示例3: _check_integrity
# 需要導入模塊: from schedule import Schedule [as 別名]
# 或者: from schedule.Schedule import from_directory [as 別名]
def _check_integrity(self):
try:
self._schedule = Schedule.from_directory(target_dir_path)
except Exception as e:
# something's bork'd, add it to the report
pass