當前位置: 首頁>>代碼示例>>Python>>正文


Python Schedule.from_directory方法代碼示例

本文整理匯總了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
開發者ID:mahmoud,項目名稱:etavta-openshift,代碼行數:20,代碼來源:etavta_wsgi.py

示例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
開發者ID:mahmoud,項目名稱:etavta,代碼行數:24,代碼來源:wsgi.py

示例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
開發者ID:mahmoud,項目名稱:etavta-openshift,代碼行數:8,代碼來源:fetch.py


注:本文中的schedule.Schedule.from_directory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。