本文整理汇总了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