• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python config.Config类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中traitlets.config.Config的典型用法代码示例。如果您正苦于以下问题:Python Config类的具体用法?Python Config怎么用?Python Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Config类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: default_config

    def default_config(self):
        # import jupyter_core.paths
        # import os
        c = Config({
            'NbConvertBase': {
                'display_data_priority': ['application/javascript',
                                          'text/html',
                                          'text/markdown',
                                          'image/svg+xml',
                                          'text/latex',
                                          'image/png',
                                          'image/jpeg',
                                          'text/plain'
                                          ]
            },
            'CSSHTMLHeaderPreprocessor': {
                'enabled': True},
            'HighlightMagicsPreprocessor': {
                'enabled': True},
            'ExtractOutputPreprocessor': {
                'enabled': True},
            'latex_envs.LenvsLatexPreprocessor': {'enabled': True}
        }
        )
        from jupyter_contrib_nbextensions.nbconvert_support import (
            templates_directory)
        c.merge(super(LenvsLatexExporter, self).default_config)

        # user_templates = os.path.join(jupyter_core.paths.jupyter_data_dir(),
        # 'templates')
        c.TemplateExporter.template_path = ['.', templates_directory()]

        # c.Exporter.preprocessors = ['tmp.LenvsLatexPreprocessor' ]
        # c.NbConvertApp.postprocessor_class = 'tmp.TocPostProcessor'
        return c
开发者ID:flipphillips,项目名称:IPython-notebook-extensions,代码行数:35,代码来源:latex_envs.py


示例2: _compile_string

 def _compile_string(self, nb_json):
     """Export notebooks as HTML strings."""
     self._req_missing_ipynb()
     c = Config(self.site.config['IPYNB_CONFIG'])
     c.update(get_default_jupyter_config())
     exportHtml = HTMLExporter(config=c)
     body, _ = exportHtml.from_notebook_node(nb_json)
     return body
开发者ID:FelixSchwarz,项目名称:nikola,代码行数:8,代码来源:ipynb.py


示例3: default_config

 def default_config(self):
     c = Config({
         'RevealHelpPreprocessor': {
             'enabled': True,
             },
         })
     c.merge(super(SlidesExporter,self).default_config)
     return c
开发者ID:CaptainAL,项目名称:Spyder,代码行数:8,代码来源:slides.py


示例4: _compile_string

 def _compile_string(self, nb_json):
     """Export notebooks as HTML strings."""
     self._req_missing_ipynb()
     c = Config(self.site.config['IPYNB_CONFIG'])
     c.update(get_default_jupyter_config())
     if 'template_file' not in self.site.config['IPYNB_CONFIG'].get('Exporter', {}):
         c['Exporter']['template_file'] = 'basic.tpl'  # not a typo
     exportHtml = HTMLExporter(config=c)
     body, _ = exportHtml.from_notebook_node(nb_json)
     return body
开发者ID:humitos,项目名称:nikola,代码行数:10,代码来源:ipynb.py


示例5: default_config

    def default_config(self):
        c = Config({"ExtractOutputPreprocessor": {"enabled": True}})
        #  import here to avoid circular import
        from jupyter_contrib_nbextensions.nbconvert_support import templates_directory

        c.merge(super(TocExporter, self).default_config)

        c.TemplateExporter.template_path = [".", templates_directory()]

        return c
开发者ID:flipphillips,项目名称:IPython-notebook-extensions,代码行数:10,代码来源:toc2.py


示例6: default_config

 def default_config(self):
     import jupyter_core.paths
     import os
     c = Config({'ExtractOutputPreprocessor':{'enabled':True}})
     c.merge(super(TocExporter,self).default_config)
     
     user_templates = os.path.join(jupyter_core.paths.jupyter_data_dir(), 'templates')
     c.TemplateExporter.template_path = [
                             '.', user_templates ]
     return c
开发者ID:Jernej88,项目名称:IPython-notebook-extensions,代码行数:10,代码来源:toc2.py


示例7: default_config

 def default_config(self):
     c = Config({
         'ExtractOutputPreprocessor':{
             'enabled':True
             },
         'HighlightMagicsPreprocessor': {
             'enabled':True
             },
         })
     c.merge(super(RSTExporter,self).default_config)
     return c
开发者ID:jupyter,项目名称:nbconvert,代码行数:11,代码来源:rst.py


示例8: default_config

 def default_config(self):
     c = Config({
         'RegexRemovePreprocessor': {
             'enabled': True
             },
         'TagRemovePreprocessor': {
             'enabled': True
             }
         })
     c.merge(super(TemplateExporter, self).default_config)
     return c
开发者ID:BarnetteME1,项目名称:DnD-stuff,代码行数:11,代码来源:templateexporter.py


示例9: default_config

 def default_config(self):
     c = Config({
         'ExtractOutputPreprocessor': {
             'enabled': True,
             'output_filename_template': '{unique_key}_{cell_index}_{index}{extension}'
         },
         'HighlightMagicsPreprocessor': {
             'enabled': True
         },
     })
     c.merge(super(UpgradedRSTExporter, self).default_config)
     return c
开发者ID:sdpython,项目名称:pyquickhelper,代码行数:12,代码来源:notebook_exporter.py


示例10: check_install

    def check_install(self, argv=None, dirs=None):
        """Check files were installed in the correct place."""
        if argv is None:
            argv = []
        if dirs is None:
            dirs = {
                'conf': jupyter_core.paths.jupyter_config_dir(),
                'data': jupyter_core.paths.jupyter_data_dir(),
            }
        conf_dir = dirs['conf']

        # do install
        main_app(argv=['enable'] + argv)

        # list everything that got installed
        installed_files = []
        for root, subdirs, files in os.walk(dirs['conf']):
            installed_files.extend([os.path.join(root, f) for f in files])
        nt.assert_true(
            installed_files,
            'Install should create files in {}'.format(dirs['conf']))

        # a bit of a hack to allow initializing a new app instance
        for klass in app_classes:
            reset_app_class(klass)

        # do uninstall
        main_app(argv=['disable'] + argv)
        # check the config directory
        conf_installed = [
            path for path in installed_files
            if path.startswith(conf_dir) and os.path.exists(path)]
        for path in conf_installed:
            with open(path, 'r') as f:
                conf = Config(json.load(f))
            nbapp = conf.get('NotebookApp', {})
            nt.assert_not_in(
                'jupyter_nbextensions_configurator',
                nbapp.get('server_extensions', []),
                'Uninstall should empty'
                'server_extensions list'.format(path))
            nbservext = nbapp.get('nbserver_extensions', {})
            nt.assert_false(
                {k: v for k, v in nbservext.items() if v},
                'Uninstall should disable all '
                'nbserver_extensions in file {}'.format(path))
            confstrip = {}
            confstrip.update(conf)
            confstrip.pop('NotebookApp', None)
            confstrip.pop('version', None)
            nt.assert_false(confstrip, 'Uninstall should leave config empty.')

        reset_app_class(DisableJupyterNbextensionsConfiguratorApp)
开发者ID:gitter-badger,项目名称:jupyter_nbextensions_configurator-1,代码行数:53,代码来源:test_application.py


示例11: export_through_preprocessor

def export_through_preprocessor(
        notebook_node, preproc_cls, exporter_class, export_format, customconfig=None):
    """Export a notebook through a given preprocessor."""
    config=Config(NbConvertApp={'export_format': export_format })
    if customconfig is not None:
        config.merge(customconfig)
    exporter = exporter_class(
        preprocessors=[preproc_cls.__module__ + '.' + preproc_cls.__name__],
        config=config)
    try:
        return exporter.from_notebook_node(notebook_node)
    except PandocMissing:
        raise SkipTest("Pandoc wasn't found")
开发者ID:jcb91,项目名称:IPython-notebook-extensions,代码行数:13,代码来源:test_preprocessors.py


示例12: default_config

    def default_config(self):
        c = Config({'ExtractOutputPreprocessor': {'enabled': False}})
        #  import here to avoid circular import
        from jupyter_contrib_nbextensions.nbconvert_support import (
            templates_directory)
        c.merge(super(TocExporter, self).default_config)

        c.TemplateExporter.template_path = [
            '.',
            templates_directory(),
        ]

        return c
开发者ID:ipython-contrib,项目名称:jupyter_contrib_nbextensions,代码行数:13,代码来源:toc2.py


示例13: default_config

 def default_config(self):
     c = Config({
         'NbConvertBase': {
             'display_data_priority' : ['application/javascript', 'text/html', 'text/markdown', 'application/pdf', 'image/svg+xml', 'text/latex', 'image/png', 'image/jpeg', 'text/plain']
             },
         'CSSHTMLHeaderPreprocessor':{
             'enabled':True
             },
         'HighlightMagicsPreprocessor': {
             'enabled':True
             }
         })
     c.merge(super(HTMLExporter,self).default_config)
     return c
开发者ID:drocco007,项目名称:jupyter_nbconvert,代码行数:14,代码来源:html.py


示例14: load_config

    def load_config(self):
        paths = jupyter_config_path()
        paths.insert(0, os.getcwd())

        config_found = False
        full_config = Config()
        for config in NbGrader._load_config_files("nbgrader_config", path=paths, log=self.log):
            full_config.merge(config)
            config_found = True

        if not config_found:
            self.log.warning("No nbgrader_config.py file found. Rerun with DEBUG log level to see where nbgrader is looking.")

        return full_config
开发者ID:jhamrick,项目名称:nbgrader,代码行数:14,代码来源:handlers.py


示例15: test_url_config

def test_url_config(hub_config, expected):
    # construct the config object
    cfg = Config()
    for key, value in hub_config.items():
        cfg.JupyterHub[key] = value

    # instantiate the Hub and load config
    app = JupyterHub(config=cfg)
    # validate config
    for key, value in hub_config.items():
        if key not in expected:
            assert getattr(app, key) == value

    # validate additional properties
    for key, value in expected.items():
        assert getattr(app, key) == value
开发者ID:vilhelmen,项目名称:jupyterhub,代码行数:16,代码来源:test_app.py


示例16: get_html_from_filepath

def get_html_from_filepath(filepath):
    """Convert ipython notebook to html
    Return: html content of the converted notebook
    """
    config = Config({'CSSHTMLHeaderTransformer': {'enabled': True,
                                                  'highlight_class': '.highlight-ipynb'}})

    config.HTMLExporter.preprocessors = [HtmlLinksPreprocessor]
    config.HtmlLinksPreprocessor['enabled'] = True

    path = os.path.dirname(os.path.realpath(__file__))
    exporter = HTMLExporter(config=config, template_file='no_code',
                            template_path=['.', path + '/../../../scripts/'],
                            filters={'highlight2html': custom_highlighter})
    content, info = exporter.from_filename(filepath)

    return content, info
开发者ID:Huaguiyuan,项目名称:phys_codes,代码行数:17,代码来源:core.py


示例17: default_config

    def default_config(self):
        c = Config({
            'ExtractOutputPreprocessor': {'enabled': True},
            'NbConvertBase': {
                'display_data_priority': ['text/html',
                                          'text/markdown',
                                          'image/svg+xml',
                                          'text/latex',
                                          'image/png',
                                          'image/jpeg',
                                          'text/plain'
                                          ]
            },

        })
        c.merge(super(MarkdownExporter, self).default_config)
        return c
开发者ID:Carreau,项目名称:nbconvert,代码行数:17,代码来源:markdown.py


示例18: default_config

 def default_config(self):
     c = Config(
         {
             "NbConvertBase": {
                 "display_data_priority": [
                     "text/latex",
                     "application/pdf",
                     "image/png",
                     "image/jpeg",
                     "image/svg+xml",
                     "text/markdown",
                     "text/plain",
                 ]
             },
             "ExtractOutputPreprocessor": {"enabled": True},
             "SVG2PDFPreprocessor": {"enabled": True},
             "LatexPreprocessor": {"enabled": True},
             "SphinxPreprocessor": {"enabled": True},
             "HighlightMagicsPreprocessor": {"enabled": True},
         }
     )
     c.merge(super(LatexExporter, self).default_config)
     return c
开发者ID:joshhanna,项目名称:biostats-i-final,代码行数:23,代码来源:latex.py


示例19: default_config

 def default_config(self):
     c = Config({
         'NbConvertBase': {
             'display_data_priority' : ['text/latex', 'application/pdf', 'image/png', 'image/jpeg', 'image/svg+xml', 'text/markdown', 'text/plain']
             },
          'ExtractOutputPreprocessor': {
                 'enabled':True
              },
          'SVG2PDFPreprocessor': {
                 'enabled':True
              },
          'LatexPreprocessor': {
                 'enabled':True
              },
          'SphinxPreprocessor': {
                 'enabled':True
              },
          'HighlightMagicsPreprocessor': {
                 'enabled':True
              }
      })
     c.merge(super(LatexExporter,self).default_config)
     return c
开发者ID:Carreau,项目名称:nbconvert,代码行数:23,代码来源:latex.py


示例20: default_config

 def default_config(self):
     c = Config({'ExtractOutputPreprocessor':{'enabled':True}})
     c.merge(super(MarkdownExporter,self).default_config)
     return c
开发者ID:3kwa,项目名称:nbconvert,代码行数:4,代码来源:markdown.py



注:本文中的traitlets.config.Config类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python application.boolean_flag函数代码示例发布时间:2022-05-27
下一篇:
Python traitlets.link函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap