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


Python handlers.DirectoryHandler類代碼示例

本文整理匯總了Python中bokeh.application.handlers.DirectoryHandler的典型用法代碼示例。如果您正苦於以下問題:Python DirectoryHandler類的具體用法?Python DirectoryHandler怎麽用?Python DirectoryHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DirectoryHandler類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: build_applications

    def build_applications(self, args):
        if args.files:
            files = args.files
        else:
            files = []

        applications = {}

        for file in files:
            file = os.path.abspath(file)
            if os.path.isdir(file):
                handler = DirectoryHandler(filename=file)
            else:
                handler = ScriptHandler(filename=file)

            if handler.failed:
                die("Error loading %s:\n\n%s\n%s " % (file, handler.error, handler.error_detail))

            application = Application()
            application.add(handler)

            route = handler.url_path()
            if not route:
                if '/' in applications:
                    die("Don't know the URL path to use for %s" % (file))
                route = '/'
            applications[route] = application

        if len(applications) == 0:
            # create an empty application by default, used with output_server typically
            applications['/'] = Application()

        return applications
開發者ID:Jessime,項目名稱:bokeh,代碼行數:33,代碼來源:__init__.py

示例2: load

 def load(filename):
     handler = DirectoryHandler(filename=filename)
     assert handler.safe_to_fork
     result['handler'] = handler
     handler.modify_document(doc)
     if handler.failed:
         raise RuntimeError(handler.error)
     assert not handler.safe_to_fork
開發者ID:bgyarfas,項目名稱:bokeh,代碼行數:8,代碼來源:test_directory.py

示例3: load

 def load(filename):
     handler = DirectoryHandler(filename=filename)
     handler.modify_document(doc)
     if handler.failed:
         raise RuntimeError(handler.error)
開發者ID:brianpanneton,項目名稱:bokeh,代碼行數:5,代碼來源:test_directory.py


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